Home-Is-Where-You-Hang-Your-Hack / sensor.goveetemp_bt_hci

Govee Temperature/Humidity BLE Home Assistant Component
MIT License
161 stars 29 forks source link

Latest Update not Starting #12

Closed mdframe closed 4 years ago

mdframe commented 4 years ago

After installing the latest beta I am receiving the following error:

Configuration invalid:

Platform error sensor.govee_ble_hci - No module named 'bleson'

I validated that a version of bleson is installed and does respond when I perform the --observer option.

Thrilleratplay commented 4 years ago

What version of Home Assistant supervisor are you using?

mdframe commented 4 years ago

Latest version 229. I reverted back but now all my temperatures stay at 71.6 so rollback is not working either.

Thrilleratplay commented 4 years ago

Hmm. I need to do more testing around the deployment. For now, stay on v0.5. Sorry for the issue.

mdframe commented 4 years ago

I was able to resolve the error by uninstalling the component, restarting, reinstalled the beta then restarting. However all eight devices report the same temperature of 71.6. Looking at debug and source to see why.

Thrilleratplay commented 4 years ago

I am looking into this as well.

Thrilleratplay commented 4 years ago

@mdframe It took me a while get the bleson dependency installed correct but now the values appear correctly for me. Are the values appearing correctly for you yet? Can you double check the states under Developer Tools?

mdframe commented 4 years ago

Values are showing but they are all the same. The temperature is always 71.6 and humidity is always 48% all eight devices are doing the same thing.

Which bleson component are you installing? Process?

Thrilleratplay commented 4 years ago

@mdframe I am using v0.6_beta_R2 but the changes I made between that and v0.6_beta wouldn't have changed the sensor values.

I logged into the root machine and attached the running docker container using docker exec -it homeassistant /bin/bash and ran pip3 install bleson==0.1.5

mdframe commented 4 years ago

Updated to v2 and bleson is on the same version but still have the same issue. I'll let it run to see if it starts reporting correctly.

Thrilleratplay commented 4 years ago

Try a full reboot of the system. As it was a bit of a hack, some of processes from the previous version may be running in the background.

mdframe commented 4 years ago

I've performed multiple host system reboots but am game for another.

mdframe commented 4 years ago

Temperature is now always either 71.6 or 73.4. Its almost like Homeassistant is only receiving one value and displaying for all. I need to turn debug back on and look at raw values again.

Thrilleratplay commented 4 years ago

@mdframe Do you have names with your mac addresses in the configuration.yaml? The only thing I can think of that would be causing this at this point is if I messed up the default naming home how,

mdframe commented 4 years ago

Yes, I have everything named. The H5075 and Homeassistant never show the same temperature or humidity. All of the other devices are the H5074 but I know my rooms are not the temp they are reporting and all 3 floors are never the same including the outside device.

Thrilleratplay commented 4 years ago

@mdframe Sorry, I am stumped. I have 8 H5075 and 1 H5074 across three floors and the they displaying different and accurate values.

mdframe commented 4 years ago

Hmm, I even took the batteries out of several devices to see if restart would correct it. Are you scanning at 60 second intervals or longer?

Thrilleratplay commented 4 years ago

I am using a 30 second period.

mdframe commented 4 years ago

Just figured out the cause but do not know why yet. I had decimals set to 0, as soon as I put decimals 2 all temperature and humidity values matched perfectly.

Thrilleratplay commented 4 years ago

Hmmm, that sounds like the cause of the problem as I have mine default to 2. Do you have rounding set to yes as well? Did you have decimals set to 0 before?

mdframe commented 4 years ago

I had decimals 0 prior and do not have rounding set as default value is True.

Thrilleratplay commented 4 years ago

@mdframe Oh wait, it is defaulted to True. I am still not sure why that cause issues but that at least gives me a place to start.

mdframe commented 4 years ago

FYI what made me start to look at the decimal issue is with the following debug update I added:

` # If mfg data information is defined, update values

                if ga.packet is not None:
                    device.update(ga.temperature, ga.humidity, ga.packet)
                    _LOGGER.debug("MAC: {} rssi: {} battery: {} temp: {} humidity: {}".format(device.mac, ga.rssi, ga.battery, ga.temperature, ga.humidity))`

I could see the raw decimal value was correct.

I do like the changes just need to review and understand the new code as I just got my head wrapped around the existing code. ;)

Thrilleratplay commented 4 years ago

Hopefully the newer code should be easier to follow (if it isn't let me know where I can improve the comments). Basically, it is broken into three parts, govee_advertisement.py which takes the bluetooth message and decodes it, ble_ht.py which just a data object to store and normalize values, and sensor.py ties these two together and updates the sensor data every PERIOD seconds. ga is the govee advertisement being parsed. This should be display the absolute values from the device. There must be something going on with how the state or data is being displayed where a float without any decimal places is getting messaged up.

Thrilleratplay commented 4 years ago

How different are the temperatures between all of your the sensors? The rounding is applied to the raw value, which is in celcius, if the temperatures only vary between three degrees F, this may explain why the values were not updating.

mdframe commented 4 years ago

I need to better understand the question. How different before I added decimals back or now that they are working correctly?

Thrilleratplay commented 4 years ago

Yeah, before. What I mean is 71.6F is 22.0C and if the devices are reading roughly between 21.5C/70.7F and 22.5C/72.5F they would round to 71.6F; all appearing to be the same and not updating.

mdframe commented 4 years ago

You nailed it, that is what I was seeing. Previously the rounding didn't seem to cause this however now I am experiencing this challenge with rounding. I agree which is why I started looking for the raw Celsius value which comes in at four decimals places. I got to thinking about why the value was always the same and then each floor started to have the same value for each device on the same floor so your explanation is right on with my experience.

Thrilleratplay commented 4 years ago

Oh good because I am stumped otherwise. I have an older house and windows open in different rooms, even when setting decimals to 0, there was enough for each of them to very where I can notice them change. The reasons I have so many of these things is because the temperature and humidity can vary from room to room through the year and I wanted to track it.

I will make a note in the ReadMe about when rounding is applied. Odd as this is how it worked before. Thank you for ~being a guinea pig~ helping in testing to this rewrite.

Thrilleratplay commented 4 years ago

@mdframe With the release of V0.6, I am closing this ticket. Again, thank you for your help and if there are any other issues, please feel free to open a new ticket.