Hi,
I’ve set up two sensors which pull data from my micro inverter via curl. Actually the command works fine. But every morning the sensor / template to show my current production shows unavailable / unknown.
Once I restart HA all values are available.
Is it because the micro inverter isn’t reachable during night? How could I handle this?
My configuration.yaml looks as follows:
default_config:
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
recorder:
commit_interval: 30
purge_keep_days: 7
logger:
default: critical
logs:
homeassistant.core: fatal
command_line:
- sensor:
name: "power_balkon_pv_now"
command: curl -s -u user:pass http://192.168.xx.xx/status.html | grep -E "\webdata_now_p(\s|$)" | cut -d'"' -f 2
unit_of_measurement: 'W'
scan_interval: 60
- sensor:
name: "power_balkon_pv_total"
command: curl -s -u user:pass http://192.168.xx.xx/status.html | grep -E "\webdata_total_e(\s|$)" | cut -d'"' -f 2
unit_of_measurement: 'kWh'
scan_interval: 120
template:
- sensor:
- name: "Stromzähler Gesamt Verbrauch"
unique_id: "StromVerbrauch"
unit_of_measurement: 'kWh'
device_class: "energy"
state_class: "total_increasing"
state: >-
{{ float(states('sensor.tasmota_sml_total_in')) | round(3) }}
- sensor:
- name: "Stromzähler Aktuell"
unique_id: "StromAktuell"
unit_of_measurement: 'W'
device_class: "energy"
state_class: "total"
state: >-
{{ states('sensor.tasmota_sml_power_cur') }}
- sensor:
- name: "Stromzähler Aktuell Verbrauch"
unique_id: "StromAktuellVerbrauch"
unit_of_measurement: 'W'
device_class: "energy"
state_class: "total"
state: >-
{% set curr_power = states('sensor.tasmota_sml_power_curr') | float %}
{% if curr_power > 0 %}
{{ curr_power }}
{% else %}
{{ 0 }}
{% endif %}
- sensor:
- name: "Stromzähler Aktuell Einspeisung"
unique_id: "StromAktuellEinspeisung"
unit_of_measurement: 'W'
device_class: "energy"
state_class: "total"
state: >-
{% set curr_power = states('sensor.tasmota_sml_power_curr') | float %}
{% if curr_power < 0 %}
{{ -curr_power }}
{% else %}
{{ 0 }}
{% endif %}
- sensor:
- name: "Terasse Erzeugung Total"
state: "{{ states('sensor.power_balkon_pv_total') if states('sensor.power_balkon_pv_total') | float > 0 }}"
unit_of_measurement: 'kWh'
device_class: "energy"
state_class: "total_increasing"
unique_id: "balkon_pv_energy"
- sensor:
- name: "Terasse Erzeugung Aktuell"
state: "{{ states('sensor.power_balkon_pv_now') }}"
unit_of_measurement: 'W'
device_class: "energy"
state_class: "measurement"
unique_id: "balkon_pv_energy_now"
Thank you in advance!