Created
April 20, 2026 07:25
-
-
Save nimasmi/ff18e738750e57b68ad205b6784c8b7c to your computer and use it in GitHub Desktop.
Home Assistant GivEnergy (GivTCP) inverter timeout restart with backoff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias: Inverter timeout response with backoff | |
| description: > | |
| Periodically checks if the inverter timestamp is stale (>3m30s). Stops GivTCP, | |
| waits 7 minutes, restarts, then waits a further 2 minutes and checks whether | |
| comms have recovered. Increments a counter on failure (for backoff) and | |
| resets it on success. | |
| triggers: | |
| - trigger: time_pattern | |
| minutes: /5 | |
| conditions: | |
| - condition: template | |
| value_template: | | |
| {{ (now() - states('sensor.givtcp_fhxxxxxxxx_last_updated_time') | |
| | as_datetime | as_local).total_seconds() > 210 }} | |
| actions: | |
| - action: notify.ntfy | |
| data: | |
| message: >- | |
| GivTCP hung: restarting (last update {{ ((now() - | |
| states('sensor.givtcp_fhxxxxxxxx_last_updated_time') | as_datetime | | |
| as_local).total_seconds() / 60) | round(1) }}m ago, attempt {{ | |
| states('input_number.givtcp_restart_count') | int + 1 }}) | |
| - action: hassio.addon_stop | |
| data: | |
| addon: 533ea71a_givtcp | |
| - delay: | |
| minutes: >- | |
| {{ [7, 11, 18, 29, 47, 60][states('input_number.givtcp_restart_count') | | |
| int] }} | |
| - action: hassio.addon_start | |
| data: | |
| addon: 533ea71a_givtcp | |
| - delay: | |
| minutes: 2 | |
| - if: | |
| - condition: template | |
| value_template: | | |
| {{ (now() - states('sensor.givtcp_fhxxxxxxxx_last_updated_time') | |
| | as_datetime | as_local).total_seconds() < 210 }} | |
| then: | |
| - action: input_number.set_value | |
| data: | |
| value: 0 | |
| target: | |
| entity_id: input_number.givtcp_restart_count | |
| - action: notify.ntfy | |
| data: | |
| message: GivTCP recovered — comms restored, back-off counter reset | |
| else: | |
| - action: input_number.set_value | |
| data: | |
| value: >- | |
| {{ [states('input_number.givtcp_restart_count') | int + 1, 4] | min | |
| }} | |
| target: | |
| entity_id: input_number.givtcp_restart_count | |
| - action: notify.ntfy | |
| data: | |
| message: >- | |
| GivTCP still unresponsive after restart (attempt {{ | |
| states('input_number.givtcp_restart_count') | int }}) | |
| mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment