Hey Kravatak76,
Yes, you can get the current temperature when using this custom integration.
It would be an attribute of the climate entity that the integration creates once it’s set.
You can check it by going to the (1) “Developer Tools”, and (2) “States”, and then find your climate device (3). There you will be able to see the “current temperature” attribute (4).
That attribute can be used in many different ways like automations, scripts, dashboards, and much more.
Hi @reinaldo, thank you very much. I tried creating a sensor entity, everything works great. I just have a question, if there isn’t a simpler way in HA to create it than writing it manually in the configuration.
bed_temperature_sensor:
friendly_name: "Bed Temperature Sensor"
value_template: "{{ state_attr('climate.bed_thermostat', 'current_temperature') }}"
Hey @Kravatak76,
Yes, since HA 2023.09 now you can.
It’s still basically the same JSON solution but with a much nicer visual interface.
They introduced a new “Helper” called “Template Sensor”.
There you can create JSON sensors that are now much easier to manage from within the Home Assistant interface. It’s still JSON, but works great and you have an instant visualization if it’s working as well.
I’ve taken a screenshot from my mobile.
Hope it helps.
Hi @reinaldo One more question. Is it possible to find out from some attribute that the thermostat has turned on the heating or that the heating is on? Thank you
As far as I know… there is no way to get that information on HA. You can even see it on the Tuya app, but I asked around as well, but never managed to get hold of it.
The way I set it here is by using HA to control that thermostat at all times with automations. I have individual smart radiator valves linked to temperature probes and if any valve opens, that triggers the boiler thermostat to “Heat” and set a high temperature so it will surely turn the heat On. Then turn it off as soon as all valves closes again.
So basically this thermostat is just an On/Off switch for me… hehe.
@reinaldo interestingly, according to this article https://smarthomescene.com/reviews/moes-zigbee-smart-thermostat-bht-002/, the thermostat should have an integrated HA entity running_state: The current running state (Idle, Heat, Cool). Is it possible that only the zigbee version has it?
My best guess is that since this integration is not official, it might be outdated or it simply does not have access to this new attribute.
You could open a ticket on this integration git and ask for the developer to have a look. I myself am not a programmer so I can’t help with that sort of problem.
The other solution is… If you are up for the challenge, you could try to fix it yourself and propose a PR to the project maintainer. =)
Cheers!
I have a smart thermostat type WT400-3A-B
I wanted to control the thermostat with the original Tuya firmware via localtuya.
I can switch on some functions such as parental controls. I can also see the status of the relay or valve.
What I absolutely cannot manage is setting the target temperature.
I also don’t see any actual temperatures or anything else that has to do with the actual temperature control.
I have all the data points.
> `{
"result": {
"properties": [
{
"code": "switch",
"custom_name": "",
"dp_id": 1,
"time": 1697708912396,
"value": true
},
{
"code": "mode",
"custom_name": "",
"dp_id": 2,
"time": 1697708912433,
"value": "manual"
},
{
"code": "temp_set",
"custom_name": "",
"dp_id": 16,
"time": 1697708919341,
"value": 180
},
{
"code": "upper_temp",
"custom_name": "",
"dp_id": 19,
"time": 1697708912471,
"value": 400
},
{
"code": "temp_current",
"custom_name": "",
"dp_id": 24,
"time": 1697708921302,
"value": 210
},
{
"code": "lower_temp",
"custom_name": "",
"dp_id": 26,
"time": 1697708912569,
"value": 100
},
{
"code": "temp_correction",
"custom_name": "",
"dp_id": 27,
"time": 1697708912607,
"value": 0
},
{
"code": "valve_state",
"custom_name": "",
"dp_id": 36,
"time": 1697708919297,
"value": "close"
},
{
"code": "factory_reset",
"custom_name": "",
"dp_id": 39,
"time": 1697384377876,
"value": false
},
{
"code": "child_lock",
"custom_name": "",
"dp_id": 40,
"time": 1697708919321,
"value": false
},
{
"code": "sensor_choose",
"custom_name": "",
"dp_id": 43,
"time": 1697708912627,
"value": "in"
},
{
"code": "fault",
"custom_name": "",
"dp_id": 45,
"time": 1697708912724,
"value": 0
},
{
"code": "backlight_enum",
"custom_name": "",
"dp_id": 52,
"time": 1697708912453,
"value": "50_bright"
},
{
"code": "temp_floor",
"custom_name": "",
"dp_id": 101,
"time": 1697384377876,
"value": 0
},
{
"code": "freeze_free",
"custom_name": "",
"dp_id": 103,
"time": 1697708912767,
"value": true
},
{
"code": "programming_mode",
"custom_name": "",
"dp_id": 104,
"time": 1697708912742,
"value": "weekend"
},
{
"code": "temp_differ_on",
"custom_name": "",
"dp_id": 106,
"time": 1697708912587,
"value": 5
},
{
"code": "schedule",
"custom_name": "",
"dp_id": 108,
"time": 1697708923324,
"value": "BgAUCAAQCx4UDB4QEQAUFgAQCAAUFwAQ"
}
]
},
"success": true,
"t": 1697708938372,
"tid": "b97bd14d6e6411ee8a93c6134cf5636b"
`
I’ve been trying to configure the device for hours now but it just won’t work.
Now I don’t know if it’s an error in localTuya or if the error is here in front of the screen.
Would be nice if you could help me.
Thanks and regards
Please, anyone can point me to the right direction to have “current temperature” properly displayed.
I have configured the BHT-002 using the Local Tuya integration and the “temperature target” is displayed properly, but the “current temperature” is divided by 5.
I am running HAOS Core 2023.11.2 and Local Tuya 5.2.1
Tia would the zigbee version of this part number BHT-002-GC be easier to integrate as it shouldnt need the tuyalocal. I already have HA generic thermostat and i already have zigbee ZHA so could i just use this as my switch entity ?
Hello, I have 15 pcs of bht-002 thermostats.
-I flashed the first 8 pcs to the wthermostat-v1.22-fas.bin software without any problems, there was a TW3S chip. These work continuously
-but I had the other 7 pcs with the CB2S chip, which does not support this firmware, so I re-soldered them with esp8266, everything seemed to work correctly.
-but now the thermostats freeze sporadically. Communication via mqtt continues to work, even restarting via the web interface does not help. I have to disconnect the power supply for a moment.
-sometimes I don’t freeze for a few days, other times 3 pcs per day.
with the flood CB2S I had the thermostats connected for 1 month and they worked without problems.
Please do you know where the problem could be?
Hello sorry if I am in the wrong place. But I have a Moes BHT-002, and I am really ok with original app and using original cloud. Only thing I want is that the deadzone temperature set to 0.5, originally it is 1C - means if 21C temp set it would turn on the heater only when it drops to 20C but not 20.5C.
What are the easiest way to do it?
I am also interested in setting a lower deadzone temperature. Does anyone know anything about this?
I want to receive the information I marked in red.When the set value is reached, automation will be triggered with this information.How can I get this information?
Also having a bit of trouble catching the states of this thermostat.
Having such code:
- type: state-icon
entity: climate.termo1dush
icon: mdi:heating-coil
icon_color:
if (attributes.hvac_action === 'idle') return 'green';
if (attributes.hvac_action === 'off') return 'green';
if (attributes.hvac_action === 'heat) return 'red';
tap_action:
action: more-info
style:
top: 55%
left: 40%
transform: rotate(270deg)
But the icon de not change color on turning on/off
Any suggestion?
Because the deadzone was annoying me, i have done a PWM workaround in nodered. I use a standard PID and a standard PWM node. The actual value is coming from the thermostat. Setpoint of the Thermostat is dynamic, based on PWM state and room temperature.
If PWM = TRUE → Tuya setpoint = room temperature + 2K (Relais will turn on)
If PWM = FALSE → Tuya setpoint = room temperature - 2K (Relais will turn off)
I use 2K because 1K delta does not trigger the relais in some cases.
Now i am switching from Tasmota to ESPhome. Need to adapt this feature to ESPhome without nodered and using the ESPhome PID controls. But i am new to ESPhome and HA. Any ideas how to script it?
So i had some more time today and gave it a try with ESPhome. Lets see what is happening tonight. Due I am new to all this .yaml stuff,Ii didn’t manage to make a setpoint calculation. Instead I just set to 19°C for OFF and 26°C for ON.
esp8266:
board: esp01_1m
uart:
rx_pin: GPIO3
tx_pin: GPIO1
baud_rate: 9600
time:
- platform: homeassistant
id: ha_time
tuya:
time_id: ha_time
climate:
# PID Control
- platform: pid
name: "PID Raumtemperaturregelung"
sensor: temperature_sensor
default_target_temperature: 21°C
heat_output: sd_heater_output
control_parameters:
kp: 1.0
ki: 0.0001
kd: 0.0
output_averaging_samples: 5
derivative_averaging_samples: 5
deadband_parameters:
threshold_high: 0.5°C
threshold_low: -0.5°C
# Making PWM
output:
- platform: sigma_delta_output
update_interval: 300s
id: sd_heater_output
turn_on_action:
then:
number.set:
id: heater_relay
value: 26 # here i need to do some math to set tuya target_temperature_datapoint to temperature_sensor + 2K
turn_off_action:
then:
number.set:
id: heater_relay
value: 19 # here i need to do some math to set tuya target_temperature_datapoint to temperature_sensor + 2K
number:
# Write Tuya Setpoint
- platform: "tuya"
min_value: 19
max_value: 26
number_datapoint: 2
multiply: 2
step: 1
id: heater_relay
sensor:
# Tuya Room Temperature
- platform: "tuya"
name: "Raumtemperatur"
sensor_datapoint: 3
unit_of_measurement: "°C"
device_class: "temperature"
accuracy_decimals: 1
id: temperature_sensor
filters:
- multiply: 0.5
disabled_by_default: false
# Tuya Setpoint
- platform: "tuya"
name: "Solltemperatur"
sensor_datapoint: 2
unit_of_measurement: "°C"
device_class: "temperature"
accuracy_decimals: 1
id: temperature_set
filters:
- multiply: 0.5
disabled_by_default: false
# PID Output
- platform: pid
name: "Stellgröße"
type: HEAT
EDIT:
First test this night:
So far so promising. The output relay is PWM like expected. During this thest the room controller was open loop. The valve was in manual mode 100% and the heatpump is set to maintain living room temperature.
Next step:
I will put the code on another room thermostat kwith automatic valve control to adjust the PID.
Further step:
- PID Parameter Setup by UI
- Setpoint dynamic change by +/-2K to room temperature
- PID Parameter stored permanent (if possible)