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

Basic support for Hysen Heating Controller (dev type 0x4ead) #138

Merged
merged 23 commits into from
Mar 18, 2018

Conversation

ptd006
Copy link
Contributor

@ptd006 ptd006 commented Jan 4, 2018

Contains a new device class hysen for various Broadlink-OEM WiFi thermostats made by Xiamen Hysen Control Technology Co., Ltd. These are sold under brands including Floureon.

It now provides essentially complete support, including:

  • get_temp() : get current room temperature
  • set_temp(temp in degrees C) : switch to manual control and set thermostat temperature
  • switch_to_auto() : switch to automatic (predefined) schedule/temperatures
  • get_full_status() : get all known fields, incl. timer schedule
  • set_advanced( ... ) : advanced settings
  • set_time(hour,minute,second,day)
  • set_schedule( ... ) : set times/temps for auto mode
  • set_power : power on/off (doesn't disable WiFi) and control lock.
  • set_mode : set sensor, loop mode and control mode.

Photo of device: http://peter.windridge.org.uk/playing-with-cheap-iot-devices/20171120_163450.jpg

Note that package PyCRC is used for calculating the CRC16 required in payload.

Fixes #130

@ralphm2004
Copy link

Tested with
https://www.amazon.de/FLOUREON-Heizk%C3%B6rperthermostat-Heizungsthermostat-Heizungsregelung-Programmierbar/dp/B0771MPJXK
and worked.

ralphm2004 added a commit to ralphm2004/broadlink-thermostat that referenced this pull request Jan 20, 2018
  https://github.com/mjg59/python-broadlink
with Basic support for Hysen Heating Controller (dev type 0x4ead)
  mjg59/python-broadlink#138
@serjs
Copy link
Contributor

serjs commented Jan 26, 2018

Hi!

Thank you for your work! I can confirm that changes reusable for FLOUREON thermostat, i have same as @ralphm2004 mention in his comment. Looks like this solved almost all Chinese thermostat based on Broadlink OEM-T1

I also notice that you use PyCRC (link) which is new module dependency for this project. I think that we need to add this dep as setup requirements on the road to mainstream if we really need to use CRC16

@mjg59 Can you look into this?

@ptd006
Copy link
Contributor Author

ptd006 commented Jan 26, 2018

Hi @serjs,
Thanks for testing, glad it's working!

Modbus CRC16 is required. It could be implemented as a standalone function to avoid the extra dependency. However, personally I favour keeping it as a dependency. I have added it to my setup.py in ptd006@586f17f .

The downside is people not using this thermostat may baulk at installing extra packages.

@ptd006
Copy link
Contributor Author

ptd006 commented Jan 28, 2018

N.b. I think part of the control byte in switch_to_auto (the 0x11 in input_payload) actually controls the "loop mode" (which defines whether Saturday should follow the weekend or weekday schedule). More specifically I think this byte should actually be:
`( (loop_mode + 1) << 4) + auto_mode
where

  # auto_mode = 1 for auto (scheduled/timed) mode, 0 for manual mode
  # loop_mode refers to index in [ "12345,67", "123456,7", "1234567" ] using the Android app's notation
  # E.g. loop_mode = 0 ("12345,67") means Saturday and Sunday follow the "weekend" schedule
  # loop_mode = 2 ("1234567") means every day (including Saturday and Sunday) follows the "weekday" schedule

I have not tested this properly but hope to do so next week when I will also commit code to set the timer schedule.

I hadn't noticed before because I was only using "Saturday and Sunday weekend" mode (I guess that applies for most people..)

ptd006 and others added 16 commits January 28, 2018 14:36
The room_temp_adj (or simply 'adj') only applies to the room_temp. It's limited to -5.0..+5.0, but uses a 2 byte data type.
This leads to the assumption that external_temp could also use this data type, maybe for showing temperatures below 0 - but I cannot test this currently. Maybe I have to place it near a fridge to confirm.
Again: maybe payload[17] also belongs to the external temperature...
 Explain remaining unknowns for Hysen thermostat
Just confirmed, that lowest outside temp is 0. So it seems to only need 1 byte, as room temp does.
Remove comment about guessed meaning of unknown
Turn display power on/off
add ability to toogle hysen device power
Sorry, there was still one thing missing: set/unset remote_lock.
I captured again and changed the set_power accordingly.
Update set_power() to support remote_lock for Hysen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants