Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added set_message command for user message area, for CT80 #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions radiotherm/thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,26 @@ def set_day_program(self, heat_cool, day, program):
"""
self.post('/tstat/program/%s/%s' % (heat_cool, day), json.dumps(program).encode('utf-8'))

def set_time(self, day, hour, minute):
"""
Sets thermostat time

:param day: Integer value representing the day of the week,
with day 0 being Monday
:param hour: Integer value representing number of hours elapsed
since midnight.
:param minute: Integer value representing number of minutes elapsed
since start of the hour.
"""
if not isinstance(day, int) or day > 6 or day < 0:
raise ValueError('Invalid day of week, must be 0-6')
if not isinstance(hour, int) or hour > 23 or hour < 0:
raise ValueError('Invalid hour, must be 0-23')
if not isinstance(minute, int) or minute > 59 or minute < 0:
raise ValueError('Invalid minute, must be 0-59')
json_obj = {'day': day, 'hour': hour, 'minute': minute}
self.post('/tstat/time', json.dumps(json_obj).encode('utf-8'))


class CT30(CommonThermostat):
"""
Expand Down Expand Up @@ -213,6 +233,19 @@ class CT80(CommonThermostat):

humidifier_setpoint = fields.Field('/tstat/thumidity', 'thumidity')

### methods ###
def set_message(self, line, message):
"""
Sets a line in the user messaging area.

:param line: Line 0 or 1
:param message: Message to display
"""
if (line > 1 or line < 0):
raise ValueError('Invalid line number, must be 0 or 1')
msg_json = {'line': line, 'message': message}
self.post('/tstat/uma', json.dumps(msg_json).encode('utf-8'))


class CT80RevB(CT80):
"""
Expand Down