Electronic heating thermostat reverse engineering (Beok, Floureon, Decdeal)

(Eoin Daltún) #41

Unfortunately I didn’t get any further with my investigation.
It should be a case of figuring out what JSON to send to the service but as it’s https I wasn’t able to decrypt it.

(Ohad Eytan) #42

I suggest setting the thermostats static IPs via your DHCP server, then generate the devices yourself instead of using the discover function.

To do so, I changed line 213:

 devices = broadlink.discover(timeout=conf.get('lookup_timeout', 5))

To something like:

hysen = 0x4EAD
d1 = broadlink.gendevice(hysen, ('', 80), bytearray(b'>\xenn\xebw\x0fx'))
d2 = broadlink.gendevice(hysen, ('', 80), bytearray(b'\x18\vebw\x0fx'))
d3 = broadlink.gendevice(hysen, ('', 80), bytearray(b'\xb5\xef\xeb\x0fx'))
d4 = broadlink.gendevice(hysen, ('', 80), bytearray(b'\x93@4\xea4'))
devices = [d1, d2, d3, d4]

Based on the info I got from running in python:

import broadlink
d = broadlink.discover(10)
for x in d:
    print(x.devtype, x.host, x.mac)

That works flawlessly (I’m using 4 thermostats).


(Winter Mute) #43

Thanks, I will hopefully have the time to try that out this evening - was thinking in the same direction and configured the DHCP IPs, but didn’t get to the coding stuff yet.

What do those byte arrays represent?

(Ohad Eytan) #44

Yeah, I have that thought for a while and finally did it.

The byte arrays are the MAC addresses in some format. As I mentioned, the easiest way to get it is using discover manually.

(Tanel) #45

About the Floureon thermostat FL-TH-012, I have also tried to connect it without success using the broadcom script. I have contacted the manufacturer -BECA Energy.
The server API description is avaliable at: https://docs.tuya.com/en/cloudapi/deviceAPI/index.html

I have no experience with API connectivity. It seems the thermostats are accessible via cloud connections. Could anyone look into it, is it sufficient for integration into OpenHAB?

(Peter Loron) #46

Hello. Would those of you who have gotten these to work with OH please post which model numbers you purchased? There are a tone of different ones available, and it seems like not all are supported. Thanks.

(Ohad Eytan) #47

I didn’t find an exact model number, but I bought:


(Peter Loron) #48

@OhadEytan Thanks!

(Nikolaos Dasyras) #49

Continuing the discussion from Electronic heating thermostat reverse engineering (Beok, Floureon, Decdeal):

Dear All,
This is a great thread and many thanks to all that have provided code and information. I have just setup a Broadlink OEM thermostat with OpenHAB Embeded MQTT Broker using Generic MQTT Thing and I would like to share the way I did it in case anybody finds it usefull.

Firstly I followed @DennisVonDerBey post #5 in this thread to setup the necessart scripts.
I also followed @OhadEytan post also in this thread to setup systemd.

Having done the above, my thermostat has been automaticaly discovered and I copied it’s MAC. This can be done either from the output of the broadlink-thermostat.py script or it can be found in the CId reported in OpenHAB’s log (CId=broadlink--<process_id>).

Then, in the Generic MQTT Thing (in PaperUI) I added the following channels:
state: /broadlink//room_temp

state: /broadlink//thermostat_temp
command: /broadlink//cmd/set_temp

state: /broadlink//active
On/Open Value: 1
Off/Closed Value: 0

state: /broadlink//auto_mode
command: /broadlink//cmd/set_mode
On/Open Value: 1
Off/Closed Value: 0

state: /broadlink//power
command: /broadlink//cmd/set_power
On/Open Value: 1
Off/Closed Value: 0

Please note: There is no need for transformation, only to define On/Open & Off/Closed values for switch channels by pressing the “Show More” Button.

I then added the following items:

Number  TS_temp     "Thermostat Temperature [%.1f °C]"    <temperature>   (Room)    {channel="mqtt:topic:<MQTT_Thing_ID>:TS_temp"}
Number  TS_Set  "Thermostat Setpoint [%.1f °C]"     <heating>   (Room) {channel="mqtt:topic:<MQTT_Thing_ID>:TS_Set"}
Switch  TS_Active    "Thermostat is heating"    <switch>     (Room)    {channel="mqtt:topic:<MQTT_Thing_ID>:TS_Active"}
Switch TS_Auto_Mode   "Thermostat Auto-Mode (ON/OFF)"    <switch>     (Room)    {channel="mqtt:topic:<MQTT_Thing_ID>:TS_Auto_Mode"}
Switch TS_Power  "Thermostat Power (ON/OFF)"    <switch>     (Room)    {channel="mqtt:topic:<MQTT_Thing_ID>:TS_Power"}

Finally, I added in sitemap:

Text      item=TS_temp  labelcolor=[TS_Active==ON="red"]  valuecolor=[>22="orange",>17="green",>5="blue"]
Setpoint  item=TS_Set minValue=5 maxValue=35 step=0.5
Switch    item=TS_Active
Switch    item=TS_Auto_Mode
Switch    item=TS_Power

(Dennis Von Der Bey) #50

If anyone else has problems with ‘broken pipe’ errors after some time that requires restarting the bridge:

I opened a pull request with fix for that and I hope the maintainer will merge it soon. In the meantime you can download the script from the fix branch:

(Peter Loron) #51

Hello @ndasyras. Would you please say which specific thermostat you purchased? Thanks.

(Nikolaos Dasyras) #52

Hi @peterloron. It is an ubranded OEM thermostat identified as Hysen HY02.