Page 1 of 1

Python plugin for MOES BHT-002 Termostat

Posted: Tuesday 04 December 2018 20:38
by vanbasten
Hi,
I need help connecting domoticz and MOES BHT-002 thermostat series (https://www.aliexpress.com/item/WiFi-Th ... 5ff5a881fe.

Currently thermostat is controlled with Smart Life APP (Alexa) and working fine, but I want to control it via domoticz.

So, I was wondering if you guys could point me in right direction regarding documentation or there is already a plugin for domoticz which can control above mentioned thermostat series.

Thanks in advance!

Re: Python plugin for MOES BHT-002 Termostat

Posted: Thursday 06 December 2018 20:32
by vanbasten
After some research using tuya-cli I found that there are actually all informations that we need in order to write domoticz plugin for above mentioned thermostat series:

here are some examples of data gathered with tuya-cli:

dev:~# tuya-cli get --ip 192.168.6.105 --id 65363xxx --key ff87122xxx --dps 1
true
dev:~# tuya-cli get --ip 192.168.6.105 --id 65363xxx --key ff87122xxx --dps 2
50
dev:~# tuya-cli get --ip 192.168.6.105 --id 65363xxx --key ff87122xxx --dps 3
45
dev:~# tuya-cli get --ip 192.168.6.105 --id 65363xxx --key ff87122xxx --dps 4
1
dev:~# tuya-cli get --ip 192.168.6.105 --id 65363xxx --key ff87122xxx --dps 5
false
dev:~# tuya-cli get --ip 192.168.6.105 --id 65363xxx --key ff87122xxx --dps 6
false

and explained :
--dps 1 true/false - true when device is on, false for off
--dps 2 number - desired temperature divided by 2 (25 degrees are shown as 50)
--dps 3 number - current temperature divided by 2 (22.5 degrees are shown as 45)
--dps 4 0/1 - 0 for scheduled mode, 1 for manual mode
--dps 5 not sure
--dps 6 not sure

Since I have no experience in writing plugins for domoticz, and we have all data needed, it would be cool if someone could step in and help with the plugin.

Cheers


EDIT:

using set command we can set:
desired temperature...

dev:~# tuya-cli set --ip 192.168.6.105 --id 65363xxx --key ff87122xxx --set 60 --dps 2
Set succeeded.

or turn on/off the thermostat...
dev:~# tuya-cli set --ip 192.168.6.105 --id 65363xxx --key ff87122xxx --set false --dps 1

sheduled/manual mode setting via tuya-cli ends with:
{ Error: Error communicating with device. Make sure nothing else is trying to control it or connected to it.
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '192.168.6.105',
port: 6668 }

Re: Python plugin for MOES BHT-002 Termostat

Posted: Friday 04 January 2019 12:57
by harangozop
Hi,
I bought the same thermostat, and I'm planning to build an environment on top of domoticz. I was just wondering if I could control the thermostat from domoticz, and that's a good start what you found.

I think dps 5 and 6 are "eco mode" and "lock/unlock".

Re: Python plugin for MOES BHT-002 Termostat

Posted: Saturday 02 February 2019 17:21
by Itschi
Hi,

just bougth one of theses thermostats as well. One question: Where did you get the key for use of tuya cli from?

Regards, Yavuz

Re: Python plugin for MOES BHT-002 Termostat

Posted: Sunday 03 February 2019 10:46
by vanbasten
I have used this tutorial to obtain the key.

https://github.com/codetheweb/tuyapi/bl ... s/SETUP.md



Cheers.

Re: Python plugin for MOES BHT-002 Termostat

Posted: Sunday 03 February 2019 18:44
by Itschi
Thanks for your quick answer. I finally got it working (had a specifict network issue with my PC). In general it works but I couldn't get SET working. I always end up with a timeout for response. However, the GET commands are working, as lon as the APP is not running. Did you do anythng specific to get SET command working?

Regards, Itschi

Re: Python plugin for MOES BHT-002 Termostat

Posted: Monday 04 February 2019 9:57
by vanbasten
Try to enable manual mode.

Re: Python plugin for MOES BHT-002 Termostat

Posted: Wednesday 27 February 2019 22:40
by Itschi
I had no time to write a Plugin but a tiny Python script to control these Thermostats. If anybody is interested I could post it here.

Regards, Itschi

Re: Python plugin for MOES BHT-002 Termostat

Posted: Thursday 28 March 2019 0:37
by jmartinr64
Hi Itschi

I'm interested for the python script that you are using to control these great thermostats. I'm testing a device to replace al analogue thermostats setup at home.

Could you please share the script? Even how to setup this thermostat within domoticz.

Best regards Javier

Re: Python plugin for MOES BHT-002 Termostat

Posted: Tuesday 09 April 2019 11:21
by vanbasten
Itschi wrote: Wednesday 27 February 2019 22:40 I had no time to write a Plugin but a tiny Python script to control these Thermostats. If anybody is interested I could post it here.

Regards, Itschi
Please post.

Re: Python plugin for MOES BHT-002 Termostat

Posted: Saturday 15 February 2020 11:29
by FearNaBoinne
DPS 102 is floor sensor temperature

Anyone know what DPS 104 is?

Code: Select all

{
  devId: '8***85',
  dps: {
    '1': true,
    '2': 50,
    '3': 44,
    '4': '1',
    '5': false,
    '6': false,
    '102': 42,
    '104': true
  }
}
Still wondering about the error when settingDPS 4 (manual/schedule mode)

Re: Python plugin for MOES BHT-002 Termostat

Posted: Monday 14 December 2020 13:11
by Nautilus
Hi,

Have been using the plugin (https://github.com/iasmanis/Domoticz-Tu ... tat-Plugin) for a few weeks and it is working nicely. However, I was thinking it would be useful to know if the heting is on or off? Of course, in most situations you can derive this from setpoint and temperature, but it is not always clear and depends e.g. of the deadzone setting. So it would be convenient to get this directly from the decive. Could this information be available e.g. through DPS 104?