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

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.

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, ('192.168.1.61', 80), bytearray(b'>\xenn\xebw\x0fx'))
d2 = broadlink.gendevice(hysen, ('192.168.1.62', 80), bytearray(b'\x18\vebw\x0fx'))
d3 = broadlink.gendevice(hysen, ('192.168.1.63', 80), bytearray(b'\xb5\xef\xeb\x0fx'))
d4 = broadlink.gendevice(hysen, ('192.168.1.64', 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).

Goodluck

3 Likes

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?

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.

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?

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.

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


and

@OhadEytan Thanks!

1 Like

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:
TS_temp
state: /broadlink//room_temp

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

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

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

TS_Power
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
3 Likes

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:

2 Likes

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

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

Hello folks,
I stumbled upon this thread, after first giving up making my night storage heaters smart.
Those Beok Thermostats look very good.

I stumbled upon another thread on FHEM, where the User Wzut came up with a Module for it.

Maybe it would be possible to make an openHAB Add On for that, or at least a complete software for that.

Edit:
Here are additional infos.

1 Like

I am able to succesfully communicate with the 3 BEOK thermostats from a mosquito server that is running on a multi-vlan server after I followed your advice and modified the script to access thermostats via fixed IP addresses. However, in such setup I am only able to receive updates over the MQTT. When I try to publish using mosquito_pub the changes are not applied to the device. On a contrary, when I run the same command in a single interface environment all works fine.

Any ideas on how to solve that?

I have no idea. That doesn’t make sense for me :frowning:

1 Like

Fixed it. My bad, didnt pay enough attention to little things
All works now, thanks.

1 Like

Thank you!

How would I go about using MQTT 1.x with this? I can see the units being discovered and I’ve setup static mappings for their IP address and created the systemd file. That all works fine.

Any pointers on how to now get the info into item states with the older MQTT binding?

Thanks!

EDIT: Found an example :slight_smile:


16:40:14.702 [INFO ] [smarthome.event.ItemStateChangedEvent] - Thermo1_Room changed from NULL to 21.50
16:40:14.703 [INFO ] [smarthome.event.ItemStateChangedEvent] - Thermo1_Room_Power changed from NULL to ON
16:40:14.719 [INFO ] [smarthome.event.ItemStateChangedEvent] - Thermo1_Room_Set changed from NULL to 14.00
16:40:14.720 [INFO ] [smarthome.event.ItemStateChangedEvent] - Thermo1_Room_Activ changed from NULL to OFF
16:40:14.721 [INFO ] [smarthome.event.ItemStateChangedEvent] - Thermo1_Room_Mode changed from NULL to OFF

Awesome guys really well done!

See above MQTTv2 config:

So the items in MQTTv1 would be:

Number  TS_temp     "Thermostat Temperature [%.1f °C]"    <temperature>   (Room)    {mqtt="<[mybroker:/broadlink//room_temp:state:default]"}
Number  TS_Set  "Thermostat Setpoint [%.1f °C]"     <heating>   (Room) {mqtt="<[mybroker:/broadlink//thermostat_temp:state:default], <[mybroker:/broadlink//thermostat_temp:command:*:default]"}

You may need to adjust the topics according to your broadlink setup
You may need to use transformations

2 Likes

Thanks Vincent (glad you’re still alive!) I found an example on github which spelt it out nicely also :slight_smile:

Do these thermostats allow heating/cooling options?