kivancsikert / ugly-duckling

Firmware for FarmHub devices
0 stars 0 forks source link

Check well schedule execution #154

Closed lptr closed 2 months ago

lptr commented 3 months ago

Well seems to have opened for 15 minutes at 5:02 am, even though it's configured to open at midnight (22PM UTC).

2024-05-17 05:02:47.249 [Info] Opening valve 'flow-control-a'
2024-05-17 05:17:47.374 [Info] Closing valve 'flow-control-a'
...
2024-05-29 05:02:48.060 [Info] Opening valve 'flow-control-a'
2024-05-29 05:17:49.169 [Info] Closing valve 'flow-control-a'

Actual schedule:

"schedule": [
  {
    "start": "2024-05-15T22:00:00Z", // midnight CEST
    "period": 129600,                // 36 hours
    "duration": 1800                 // 30 mins
  }
]

Given the 36-hour period, it should trigger at midnight and noon alternating. Where does 5AM come from?

lptr commented 3 months ago

It's also curious that the schedule of the peripheral is sometimes printed multiple times during startup:

2024-05-25 05:40:26.879 [Error] MQTT: Connection failed, error = -6
2024-05-25 05:40:26.918 [Info] mDNS: found 1 services, choosing first:
2024-05-25 05:40:26.939 [Info] Effective configuration for '/p/flow-control-a': {
  "schedule": [
    {
      "start": "2024-05-15T22:00:00Z",
      "period": 129600,
      "duration": 1800
    }
  ]
}
2024-05-25 05:59:12.976 [Info] Effective configuration for '/p/flow-control-a': {
  "schedule": [
    {
      "start": "2024-05-15T22:00:00Z",
      "period": 129600,
      "duration": 1800
    }
  ]
}
2024-05-26 05:42:01.924 [Info] Effective configuration for '/p/flow-control-a': {
  "schedule": [
    {
      "start": "2024-05-15T22:00:00Z",
      "period": 129600,
      "duration": 1800
    }
  ]
}
2024-05-27 05:24:01.075 [Error] MQTT: Connection failed, error = -6
2024-05-27 05:24:01.135 [Info] mDNS: found 1 services, choosing first:
2024-05-27 05:24:01.147 [Info]  *1) barn:1883 (192.168.1.108)
2024-05-27 05:24:01.215 [Info] Effective configuration for '/p/flow-control-a': {
  "schedule": [
    {
      "start": "2024-05-15T22:00:00Z",
      "period": 129600,
      "duration": 1800
    }
  ]
}
2024-05-27 09:50:32.382 [Info] Overriding valve 'flow-control-a' to state 1 until 1

This might have something to do with MQTT connection errors... 🤔