Python plugin for MOES BHT-002 Termostat

For heating/cooling related questions in Domoticz

Moderator: leecollings

Post Reply
vanbasten
Posts: 5
Joined: Tuesday 04 December 2018 20:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Python plugin for MOES BHT-002 Termostat

Post 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!
vanbasten
Posts: 5
Joined: Tuesday 04 December 2018 20:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post 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 }
harangozop
Posts: 1
Joined: Friday 04 January 2019 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post 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".
Itschi
Posts: 18
Joined: Saturday 16 May 2015 14:58
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post 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
vanbasten
Posts: 5
Joined: Tuesday 04 December 2018 20:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post by vanbasten »

I have used this tutorial to obtain the key.

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



Cheers.
Itschi
Posts: 18
Joined: Saturday 16 May 2015 14:58
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post 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
vanbasten
Posts: 5
Joined: Tuesday 04 December 2018 20:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post by vanbasten »

Try to enable manual mode.
Itschi
Posts: 18
Joined: Saturday 16 May 2015 14:58
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post 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
User avatar
jmartinr64
Posts: 8
Joined: Friday 01 December 2017 23:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10.419
Location: Madrid
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post 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
vanbasten
Posts: 5
Joined: Tuesday 04 December 2018 20:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post 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.
User avatar
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post 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)
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Python plugin for MOES BHT-002 Termostat

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest