Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Some Govee readings cycle between two widely separated values #907

Closed
fovea1959 opened this issue Jun 23, 2022 · 8 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@fovea1959
Copy link

What happened?

I have a Govee 5178; ble_monitor has started reporting the battery level as changing between 69 and 48 on a frequent basis (17 or 18 times per hour).

Screenshot from 2022-06-23 09-41-40

The Govee app on my phone does not show this; it does show the current level for the battery in the base unit to be 3 of 5 bars, and the battery in the remote sensor to be 2 of 5 bars.

I have also had some like this happen with a H5075's temperature readings. Removing and replacing the (same) battery solved it.

Is there a way to get a raw dump of the packets coming in so troubleshooting can proceed?

Sensor type

H5178, H5075

Relevant log output

(none)
@fovea1959 fovea1959 added the bug Something isn't working label Jun 23, 2022
@Ernst79
Copy link
Collaborator

Ernst79 commented Jun 23, 2022

I normally add the following to the code to do some debugging

_LOGGER.error("Data: %s ", data.hex())

e.g. in govee.py

@fovea1959
Copy link
Author

ok, added a _LOGGER.debug into the H5178.

2022-06-29 12:30:23 DEBUG (Thread-3) [custom_components.ble_monitor.ble_parser.govee] H5178 packet: 039c23, sensor_id 1, batt 43
2022-06-29 12:30:25 DEBUG (Thread-3) [custom_components.ble_monitor.ble_parser.govee] H5178 packet: 039ff1, sensor_id 0, batt 68
2022-06-29 12:30:29 DEBUG (Thread-3) [custom_components.ble_monitor.ble_parser.govee] H5178 packet: 039ff1, sensor_id 0, batt 68
2022-06-29 12:30:31 DEBUG (Thread-3) [custom_components.ble_monitor.ble_parser.govee] H5178 packet: 039c23, sensor_id 1, batt 43
2022-06-29 12:30:33 DEBUG (Thread-3) [custom_components.ble_monitor.ble_parser.govee] H5178 packet: 039ff4, sensor_id 0, batt 68
2022-06-29 12:30:35 DEBUG (Thread-3) [custom_components.ble_monitor.ble_parser.govee] H5178 packet: 039c23, sensor_id 1, batt 43

I think that battery level being reported by the H5178 is the battery level for whichever sensor the temp/hum data is for; sensor 0 is the indoor (base) unit, and sensor 1 is the remote (outdoor) unit.

In the H5178 leg of govee.py:

    ####
    _LOGGER.debug(f'H5178 packet: {packet_5178}, sensor_id {sensor_id}, batt {batt}')
    ####
    if sensor_id == 0:
        result.update(
            {
                "temperature": temp,
                "humidity": humi,
                "battery": batt,
                "sensor id": sensor_id
            }
        )
    elif sensor_id == 1:
        result.update(
            {
                "temperature outdoor": temp,
                "humidity outdoor": humi,
                "battery": batt,
                "sensor id": sensor_id
            }
        )

If the sensor_id is 1, does it make sense to map the battery level into the result dict as item 'battery outdoor'?

@fovea1959
Copy link
Author

Just looked at the rest of the code; no provision for "battery outdoor". Need to do one of:

  • add "battery outdoor" into sensor.py and friends
  • break the outdoor module of a H5178 into it's own device (or entity?)
  • drop the outdoor battery reading
  • live with it

@Ernst79
Copy link
Collaborator

Ernst79 commented Jun 29, 2022

Ah, that makes sense. I will fix it, probably by adding “battery outdoor”. Splitting it in two devices is way more complicated, as all devices are based on the MAC address, and the Govee only has one MAC for both devices.

@fovea1959
Copy link
Author

fovea1959 commented Jun 29, 2022 via email

@Ernst79
Copy link
Collaborator

Ernst79 commented Jun 29, 2022

Yes, that might also be an option, but I need to check th consequences, as all code depends the MAC address, also e.g. the device settings. I’ll look into it

@Ernst79
Copy link
Collaborator

Ernst79 commented Jun 30, 2022

Try 8.9.3, sensor is split into two devices. I had to increase the MAC address of the outdoor sensor with 1, it wasn't possible to add a suffix to the MAC, as there are quite some checks that the MAC address is 12 characters long, in a certain format.

@Ernst79 Ernst79 closed this as completed Jun 30, 2022
@fovea1959
Copy link
Author

fix works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants