Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.79k stars 1.64k forks source link

Thermostat Using/Showing Temperature of Wrong Sensor #15144

Closed norsemangrey closed 1 year ago

norsemangrey commented 1 year ago

What happened?

I have paired a Namron thermostat with Z2M using the ZBDongle-E and integrated in HA.

The climate sensor is not showing temperature value of the sensor being used in the temperature control. There is an option to select between air temperature sensor (local_temperature) and floor temperature sensor (outdoor_temperature) for heating control. When the floor temperature sensor is selected the device is regulating by that temperature, however, the actual temperature shown on the Climate sensor in HA is still the air temperature.

image image image

image

What did you expect to happen?

The value of the temperature sensor selected for temperature regulation should be the one used/shown in the HA climate sensor.

How to reproduce it (minimal and precise)

Pair Namron (4512737/4512738) thermostat with coordinator and find in HA. Select floor sensor from HA/Z2M or on device. See that temperature shown on the Climate sensor in HA is the value of the air temperature sensor.

Zigbee2MQTT version

1.28.2-1

Adapter firmware version

6.10.3.0 build 297

Adapter

Sonoff Zigbee 3.0 USB Dongle Plus (ZBDongle-E / EFR32MG21)

Debug log

NA

danieledwardgeorgehitchcock commented 1 year ago

You may need to create an MQTT Climate entity in Home Assistant for this rather than using the one derived from Zigbee2MQTT:

Home Assistant - MQTT Climate

I think the default behaviour of Home Assistant is to take the local_temperature sensor entity for an automatically created climate entity..

owangen commented 1 year ago

@norsemanGrey When climate entity is defined in z2m for the device it takes by default (and there no way to change it) the local_temperatur. See documentation here https://www.zigbee2mqtt.io/guide/usage/exposes.html#climate As for now there is now way to fix this issue from z2m, if not climate that is exposed is changed to support both local_temp and external_temp and a way to switch between those. Not sure how that could be done.

atus commented 1 year ago

+1 As a side effect, when looking at history this is what you get. My thermostat is outside the actual room. bilde

I'm new to this space, but tried reading some docs. Any chance we could write an extension or converter to fix this temporarily?

atus commented 1 year ago

Related issue on HA https://github.com/home-assistant/core/issues/78797

brainix112 commented 1 year ago

Hey I have just the same issue! Just got around to hook up the thermostat, changed from ZHA to z2m, and finally got everything over and noticed this. With the thermostat on the outside of the room this is gonna create some issues.. As you can see, the thermostat entity is using the local_temperature image image

Should we open an issue at zigbee-herdsman-converters as well about this?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Leissson commented 1 year ago

Think I finally found clean workaround for this.

In z2m configuration.yaml add current_temperature_template line under climate device:

devices:
  '0xxxxxxxxxxxxxxxxxx':
    friendly_name: Bathroom Thermostat
    homeassistant:
      name: Bathroom Thermostat
      current_temperature_template: '{{ value_json.outdoor_temperature }}'
    legacy: false
    optimistic: true
    thermostat_unit: celsius 

Restart z2m AddOn to effect changes.

@norsemanGrey @brainix112 @atus Let me know what you think.

pittbull commented 1 year ago

@Leissson Would you perhaps know how I can workaround this on the zwave version?

To clairy: I am running zwavejs2mqtt without the mqtt integration, but seeing your post I enabled it and got the thermostat populated to my already running instance. I am however unable to implement your code into my configuration.yaml as I am not running it as an addon.

I've tried pulling only current_temperature_template value into my main HA configuration file, but HA fails to render a functioning climate device. Your example is the closest I've found to my situation and I was hoping you had some smart ideas for me to try :)

Leissson commented 1 year ago

@pittbull Unofrtunately I'm not familiar with zwave. But you should somehow populate current_temperature with outdoor_temperature. It should be done before sending it to HA, so it thinks that is the correct value for using as climate temp.

Is @johanko in the right path?

https://github.com/zwave-js/zwave-js-ui/issues/661#issuecomment-782939932

pittbull commented 1 year ago

Thanks for providing me with the insight to this other issue - it put me on a path to a solution.

I was unable to make customDevices.json work in websock mode, but when switching to mqtt and manipulating the discovery template for this specific device it actually worked.

Thank you so much (has bugged me for months)

Leissson commented 1 year ago

Nice, I know the feeling!

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

atus commented 1 year ago

Works like a charm. I consider this a fix so the issue might even be marked as fixed. You won't be switching between floor and room sensor ever/often so it's a good enough fix.

Added this to documentation so it doesn't get lost.