ChristianKuehnel / plantgateway

Bluetooth to mqtt gateway for Xiaomi Mi plant sensors
Apache License 2.0
271 stars 43 forks source link

MQTT autodiscovery - add "force_update" #37

Open aherbjornsen opened 4 years ago

aherbjornsen commented 4 years ago

The new autodiscovery is working great. However, I try to monitor for stale sensors and then it would be nice if the announcement included a 'force_update= true'

I solved this by adding payload['force_update'] = True to plantgw.py around line 300

But this should probably be configurable from .plantgw.yaml

bimmerhead23 commented 4 years ago

The new autodiscovery is working great. However, I try to monitor for stale sensors and then it would be nice if the announcement included a 'force_update= true'

I solved this by adding payload['force_update'] = True to plantgw.py around line 300

But this should probably be configurable from .plantgw.yaml

I found plantgw.py in /usr/local/lib/python3.7/dist-packages/plantgw/ and added the line above. How do I recompile and get this change into my instance?

aherbjornsen commented 4 years ago

You do not have to recompile anything, just make the change in the py-file.

Anyway, I found that this did not help because Home Assistant changes the sensor last_updated time when it receive announcements (and not only when it receives actual sensor updates).

I've created an issue here: https://github.com/home-assistant/core/issues/26725 Unfortunately there was not much interest in the problem, so it is now closed.