Skip to content

Instantly share code, notes, and snippets.

@algirdasc
Created November 15, 2019 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save algirdasc/87b574427b8ffb7d21cd72c55901383d to your computer and use it in GitHub Desktop.
Save algirdasc/87b574427b8ffb7d21cd72c55901383d to your computer and use it in GitHub Desktop.
Set Floureon thermostat schedule script
#!/usr/bin/python3
import broadlink
from datetime import datetime
# https://github.com/mjg59/python-broadlink/blob/master/broadlink/__init__.py
thermostats = [
{
"name": "thermostat1",
"host": "1.2.3.4",
"port": 80,
"mac": "00:00:00:00:00:00",
"advanced": {
"osv": 30,
"dif": 1,
"svh": 30,
"svl": 10,
"fre": 0,
"adj": 0,
"sensor": 1,
"poweron": 1,
"loop_mode": 2
},
"schedule": {
"weekday": [
{'start_hour': 6, 'start_minute': 0, 'temp': 18},
{'start_hour': 8, 'start_minute': 0, 'temp': 15},
{'start_hour': 11, 'start_minute': 0, 'temp': 15},
{'start_hour': 12, 'start_minute': 0, 'temp': 15},
{'start_hour': 16, 'start_minute': 30, 'temp': 18},
{'start_hour': 21, 'start_minute': 0, 'temp': 15}
],
"weekend": [
{'start_hour': 8, 'start_minute': 0, 'temp': 18},
{'start_hour': 22, 'start_minute': 0, 'temp': 15}
]
}
},
{
"name": "thermostat2",
"host": "1.2.3.4",
"port": 80,
"mac": "00:00:00:00:00:00",
"advanced": {
"osv": 30,
"dif": 1,
"svh": 30,
"svl": 10,
"fre": 0,
"adj": 0,
"sensor": 1,
"poweron": 1,
"loop_mode": 2
},
"schedule": {
"weekday": [
{'start_hour': 6, 'start_minute': 0, 'temp': 22},
{'start_hour': 8, 'start_minute': 0, 'temp': 15},
{'start_hour': 11, 'start_minute': 0, 'temp': 15},
{'start_hour': 12, 'start_minute': 0, 'temp': 15},
{'start_hour': 16, 'start_minute': 30, 'temp': 22},
{'start_hour': 23, 'start_minute': 0, 'temp': 15}
],
"weekend": [
{'start_hour': 8, 'start_minute': 0, 'temp': 22},
{'start_hour': 22, 'start_minute': 0, 'temp': 15}
]
}
}
]
for thermostat in thermostats:
mac = bytes.fromhex(''.join(reversed(thermostat['mac'].split(':'))))
device = broadlink.gendevice(0x4EAD, (thermostat['host'], thermostat['port']), mac)
if device.auth():
info = device.get_full_status()
print("Current {0} schedule:".format(thermostat['name']))
print(info)
# now = datetime.now()
# device.set_time(now.hour, now.minute, now.second, now.weekday() + 1)
# # device.set_advanced(**thermostat['advanced'])
device.set_schedule(**thermostat['schedule'])
print()
print("Done!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment