wez/govee2mqtt

Temperature and Humidity values wrong for H5103 and H5179

Closed this issue · 11 comments

Govee Device SKU

H5103 and H5179

Govee2MQTT Version

2024.04.29-30cf7732

Describe the issue

image
Since some time now the values for the temperature as well as humidity are wrong.
As seen in the picture the values are now with a 0, in front - while they should have a factor x100 (so temperature, e.g. 62,1° and humidity 69%).
As well as the temperature is given in Fahrenheit, not Celcius as set in the add on.
So the correct values should be: 16,7°C and 69% humidity.

Startup Diagnostics

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
GOVEE_API_KEY=REDACTED
GOVEE_MQTT_HOST=core-mosquitto
GOVEE_TEMPERATURE_SCALE=C
GOVEE_EMAIL=REDACTED
GOVEE_PASSWORD=REDACTED
GOVEE_MQTT_PASSWORD=REDACTED
GOVEE_MQTT_USER=addons
GOVEE_MQTT_PORT=1883
++ cd /app
++ exec /app/govee serve
[2024-05-29T10:55:10 INFO govee::commands::serve] Starting service. version 2024.04.29-30cf7732
[2024-05-29T10:55:10 INFO govee::commands::serve] Querying platform API for device list
[2024-05-29T10:55:11 INFO govee::commands::serve] Querying undocumented API for device + room list
[2024-05-29T10:55:13 INFO govee::service::iot] Connected to IoT: CONNACK code 0: Connection Accepted.
[2024-05-29T10:55:13 INFO govee::commands::serve] Starting LAN discovery
[2024-05-29T10:55:13 INFO govee::service::iot] IoT (re)connected with status CONNACK code 0: Connection Accepted.
[2024-05-29T10:55:13 INFO govee::commands::serve] Waiting 10 seconds for LAN API discovery
[2024-05-29T10:55:23 INFO govee::commands::serve] Devices returned from Govee's APIs
[2024-05-29T10:55:23 INFO govee::commands::serve] Weinkeller Thermometer (D3:C4:D0:35:34:31:40:4F H5103)
[2024-05-29T10:55:23 INFO govee::commands::serve] Platform API: devices.types.thermometer. supports_rgb=false supports_brightness=false
[2024-05-29T10:55:23 INFO govee::commands::serve] color_temp=None segment_rgb=None
[2024-05-29T10:55:23 INFO govee::commands::serve] Undoc: room=None supports_iot=false ble_only=true
[2024-05-29T10:55:23 INFO govee::commands::serve] Quirk { sku: "H5103", icon: "mdi:thermometer", supports_rgb: false, supports_brightness: false, color_temp_range: None, avoid_platform_api: false, ble_only: false, lan_api_capable: false, device_type: Thermometer, platform_temperature_sensor_units: Some(CelsiusTimes100), platform_humidity_sensor_units: Some(RelativePercentTimes100), iot_api_supported: false, show_as_preset_buttons: None }
[2024-05-29T10:55:23 INFO govee::commands::serve]
[2024-05-29T10:55:23 INFO govee::commands::serve] H5075_4530 (71:30:A4:C1:38:CD:45:30 H5075)
[2024-05-29T10:55:23 INFO govee::commands::serve] Undoc: room=None supports_iot=false ble_only=true
[2024-05-29T10:55:23 WARN govee::commands::serve] Unknown device type. Cannot map to Home Assistant.
[2024-05-29T10:55:23 INFO govee::commands::serve]
[2024-05-29T10:55:23 INFO govee::commands::serve] Wifi Thermometer (2E:78:19:3D:31:31:2C:D0 H5179)
[2024-05-29T10:55:23 INFO govee::commands::serve] Platform API: devices.types.thermometer. supports_rgb=false supports_brightness=false
[2024-05-29T10:55:23 INFO govee::commands::serve] color_temp=None segment_rgb=None
[2024-05-29T10:55:23 INFO govee::commands::serve] Undoc: room=None supports_iot=false ble_only=true
[2024-05-29T10:55:23 INFO govee::commands::serve] Quirk { sku: "H5179", icon: "mdi:thermometer", supports_rgb: false, supports_brightness: false, color_temp_range: None, avoid_platform_api: false, ble_only: false, lan_api_capable: false, device_type: Thermometer, platform_temperature_sensor_units: Some(CelsiusTimes100), platform_humidity_sensor_units: Some(RelativePercentTimes100), iot_api_supported: false, show_as_preset_buttons: None }
[2024-05-29T10:55:23 INFO govee::commands::serve]
[2024-05-29T10:55:23 INFO govee::service::http] http server addr is 0.0.0.0:8056
[2024-05-29T10:55:28 INFO govee::service::hass] Wait 500ms for hass to settle on 10 entity configs
[2024-05-29T10:55:29 INFO govee::service::hass] MQTT connected with status=CONNACK code 0: Connection Accepted.
[2024-05-29T10:55:43 INFO govee::service::state] requesting update via Platform API Weinkeller Thermometer (D3:C4:D0:35:34:31:40:4F H5103) None
[2024-05-29T10:55:43 INFO govee::service::state] requesting update via Platform API Wifi Thermometer (2E:78:19:3D:31:31:2C:D0 H5179) None

Additional Logs

No response

Home Assistant Logs

No response

Anything else?

No response

I'm seeing the same issue with my H5179 sensors. If I look in at the MQTT *-gv2mqtt-status messages however I see the right temperature and humidity reported.

I'm not familiar with this code base, but I'm going to take a look to see if I can find what's going wrong.

Hey @rhofour

Please respond to open issue #188 as well please.
I have looked and looked for several days on what file or code it could be under. I also tried several calibration methods with code and automations but keeping the same entity would require a python script I believe. I am new to automation codes and what not, please if you do find a solution please share.

Thanks

Any movement on this?

Problem still exists on my end. I have found work arounds but haven't been able to find where to fix the issue.

@rhofour

I'm hoping to have some time today, but I haven't made much progress yet.

I found out that what's happening for me appears to be that the units are assumed to be 1/100C when what's reported in the status messages are in F. If I take the value I see reported in the status message, divide by 100, then do the C to F conversion I get back the numbers I see (which are all very close to 33.3).

Next up is getting the code running locally so I can track down where this is happening and confirm any changes I make actually fix it.

wez commented

You probably just need to add/correct a Quirk entry like this, for your device(s):

Quirk::thermometer("H5103")
.with_platform_temperature_sensor_units(TemperatureUnits::CelsiusTimes100)
.with_platform_humidity_sensor_units(HumidityUnits::RelativePercentTimes100),

I could definitely update those. So I guess the API used to return them with different units and now it's changed?

@rhofour So on my end, it gives me a value of some high number like 170+ when it should be 78 or so. If you reverse the Fahrenheit/Celsius calculation it shows the value correctly. Not sure for everyone else. I have a separate ticket At #188 for this.

Thank you.

@Phillycityboy I don't see that device (H5051) in the quirks file yet. It seems like it should be able to fix my problem and yours with two minor changes to the quirks file.

Longer term it might be nice if the code can automatically compare the value in the status message with the computed value from the API. This would easily detect when something like this is wrong.

I made the code changes, but I don't have time to test them right now. I may get to this tomorrow, if not then likely Thursday or Friday.

wez commented

BTW, the other thing that is important in the context of HASS is setting the Temperature Scale correctly.
IMO, this shouldn't be necessary, but I've found that HASS doesn't appear to auto-correct/auto-scale temperature measurements for entities registered via MQTT.

image

Thanks, I've already checked the setting, but unfortunately it hadn't made it any better.