Dank dieses Forums habe ich viel über Home Assistant gelernt und möchte jetzt auch etwas zurückgeben.
Ich habe seit Jahren den DAFI Smartfox Reg Extended (Energiemanager) im Einsatz.
Dieses Modell hat noch keinen MODBUS und kann über eine API ausgelesen bzw. beschrieben werden.
Folgende Code verwende ich in der configuration.yaml:
rest:
- scan_interval: 10
resource: http://XXX.XXX.XXX.XXX/outputs
sensor:
- name: "smartfox_analog_status"
value_template: "{{value_json.analog.mode}}"
json_attributes:
- "analog"
- scan_interval: 60
resource: http://XXX.XXX.XXX.XXX/energy
sensor:
- name: "smartfox_energy"
json_attributes:
- "datetime"
- "energy_in"
- "energy_out"
- "energy_sf"
- "day_energy_in"
- "day_energy_out"
- "day_energy_sf"
- scan_interval: 5
resource: http://XXX.XXX.XXX.XXX/power
sensor:
- name: "smartfox_power"
json_attributes:
- "datetime"
- "power_io"
- "power_sf"
template:
- sensor:
- name: "power_io"
unit_of_measurement: "W"
device_class: "power"
state_class: "measurement"
state: >
{{ state_attr('sensor.smartfox_power', 'power_io') }}
- name: "power_sf"
unit_of_measurement: "W"
device_class: "power"
state_class: "measurement"
state: >
{{ state_attr('sensor.smartfox_power' , 'power_sf') }}
- name: "energy_in"
unit_of_measurement: "Wh"
device_class: "energy"
state_class: "total_increasing"
state: >
{{ state_attr('sensor.smartfox_energy', 'energy_in') }}
- name: "energy_out"
unit_of_measurement: "Wh"
device_class: "energy"
state_class: "total_increasing"
state: >
{{ state_attr('sensor.smartfox_energy', 'energy_out') }}
- name: "energy_sf"
unit_of_measurement: "Wh"
device_class: "energy"
state_class: "total_increasing"
state: >
{{ state_attr('sensor.smartfox_energy', 'energy_sf') }}
- name: "day_energy_in"
unit_of_measurement: "Wh"
device_class: "energy"
state_class: "total_increasing"
state: >
{{ state_attr('sensor.smartfox_energy', 'day_energy_in') }}
- name: "day_energy_out"
unit_of_measurement: "Wh"
device_class: "energy"
state_class: "total_increasing"
state: >
{{ state_attr('sensor.smartfox_energy', 'day_energy_out') }}
- name: "day_energy_sf"
unit_of_measurement: "Wh"
device_class: "energy"
state_class: "total_increasing"
state: >
{{ state_attr('sensor.smartfox_energy', 'energy_sf') }}
Vielleicht kann ja jemand etwas damit anfangen.