mirror of
https://github.com/cmur2/miflorad.git
synced 2024-12-22 02:54:24 +01:00
miflorad: check meta data incl battery level every hour instead daily
- the battery voltage level seems to have more flexibility than one change a day - short drops announcing end of battery life could go unnoticed
This commit is contained in:
parent
0595d76f00
commit
143dc374cf
@ -126,7 +126,7 @@ func getMQTTOptions() *mqtt.ClientOptions {
|
|||||||
func readData(peripheral *peripheral, client ble.Client) (common.SensorDataResponse, error) {
|
func readData(peripheral *peripheral, client ble.Client) (common.SensorDataResponse, error) {
|
||||||
// re-request meta data (for battery level) if last check more than 24 hours ago
|
// re-request meta data (for battery level) if last check more than 24 hours ago
|
||||||
// Source: https://github.com/open-homeautomation/miflora/blob/ffd95c3e616df8843cc8bff99c9b60765b124092/miflora/miflora_poller.py#L92
|
// Source: https://github.com/open-homeautomation/miflora/blob/ffd95c3e616df8843cc8bff99c9b60765b124092/miflora/miflora_poller.py#L92
|
||||||
if time.Since(peripheral.lastMetaDataFetch) >= 24*time.Hour {
|
if time.Since(peripheral.lastMetaDataFetch) >= 1*time.Hour {
|
||||||
metaData, err := impl.RequestVersionBattery(client)
|
metaData, err := impl.RequestVersionBattery(client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.SensorDataResponse{}, errors.Wrap(err, "can't request version battery")
|
return common.SensorDataResponse{}, errors.Wrap(err, "can't request version battery")
|
||||||
|
Loading…
Reference in New Issue
Block a user