i have a sensor for the battery %, which is setted via an automat with a Webhook from another system.
my sensor :
- sensor:
- name: "pourcent_portail_batterie_aeotec"
unique_id: "pourcent_portail_batterie_aeotec01"
unit_of_measurement: "%"
device_class: battery
state_class: measurement
state: >
{{ "0"}}
and the automat
- id: '1705240855162'
alias: reçois % batterie aeotec portail
description: ''
trigger:
- platform: webhook
allowed_methods:
- POST
- PUT
- GET
local_only: true
webhook_id: pourcent_batterie_aeotec_portail
condition: []
action:
- service: python_script.set_state
data_template:
entity_id: sensor.pourcent_portail_batterie_aeotec
state: '{{ (trigger.query.pourcent_portail_batterie_aeotec) | float }}'
mode: single
each time i restart HA the sensor is reset to “0”
i havn’t found how to reset the sensor at the last value before restart ?