wez / govee2mqtt

Govee2MQTT: Connect Govee lights and devices to Home Assistant
MIT License
510 stars 32 forks source link

Target Temperature mqtt issue #160

Open skavan opened 7 months ago

skavan commented 7 months ago

Govee Device SKU

H7133

Govee2MQTT Version

latest

Describe the issue

This is going to be difficult to describe! I have a H7133 Smart Space Heater. Your mqtt integration is phenomenal with one (big) issue. The temperature reported through Target Temperature is wrong in a really weird way. Let's say the target temperature on the device, set by the app, is 72F (22C, 295K). The MQTT generated entity reports it as 161.6 which is the Fahrenheit equivalent of 72C as opposed to the Fahrenheit representation of 72F!!!!!!! Since this is outside the allowed range (which is also misreported in Centigrade as 5-30), we get an error and the entity is unusable.

Why?

As I understand this, your add-on creates a mqtt state that both describes the entities and reports their status. HA mqtt then consumes this to create entities. (I could be wrong!). I think but am not sure, that the problem is in the metadata generated by your code which confused the mqtt integration.

Perhaps (and I am totally guessing) it's here:

{
    "dataType": "ENUM",
    "defaultValue": "Celsius",
    "fieldName": "unit",
    "options": [
        { "name": "Celsius", "value": "Celsius" },
        { "name": "Fahrenheit", "value": "Fahrenheit" }
    ],
    "required": true
                        }

the value might need to be C and F. This is a guess. All I know is that I get a Invalid value for number.space_heater_pro_target_temperature: 161.6 (range 5.0 - 30.0)

Another example of the problem. In the pic below, I set the target temperature to 68F (which happens to be 20C). It updated the H7133 correctly and posted the correct value to MQTT.

But the value posted in number.space_heater_pro_target_temperature was 156.2 (see screenshot below), which is 68C (as opposed to 68F) in Fahrenheit!

image

I suspect my description of the problem is inadequate! So please interrogate me for more data!

Startup Diagnostics

Invalid value for number.space_heater_pro_target_temperature: 161.6 (range 5.0 - 30.0)

Additional Logs

No response

Home Assistant Logs

No response

Anything else?

No response

sixtwentytwo commented 7 months ago

A similar problem with the Govee Humidifier issue: https://github.com/wez/govee2mqtt/issues/171

sjafferali commented 3 months ago

Have a PR to fix this: https://github.com/wez/govee2mqtt/pull/256