die Home Assistant API gibt bei folgende Befehl:
dieses aus:curl -X GET -H "Authorization: Bearer YOUR_ACCESS_TOKEN" https://YOUR_HOME_ASSISTANT_URL.COM/api/states/YOUR_ENTITY_ID
Die Einstellung für Api Aktivierung geht wie folgt in Home Assistant:{"entity_id":"YOUR_ENTITY_ID","state":"345","attributes":{"attributes":{"state_class":"measurement","attribute":4,"unit_of_measurement":"W","device_class":"power","friendly_name":"YOUR_ENTITY_NAME"},"friendly_name":"YOUR_ENTITY_ID"},"last_changed":"2023-05-14T18:04:23.651548+00:00","last_updated":"2023-05-14T18:04:23.651548+00:00","context":{"id":"12345678901234567890","parent_id":null,"user_id":null}}
Code: Alles auswählen
# Example configuration.yaml entry
sensor:
- platform: rest
resource: http://YOUR_SERVER_IP:8123/api/states/YOUR_ENTITY_ID
name: "YOUR_ENTITY_ID"
value_template: '{{ value_json.state }}'
json_attributes:
- attributes
headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Wäre es möglich den "state" als Verbrauchswert zu nutzen?
Gruß Sascha