Hi Community,
I have the following sensor that only provides me with a state of “unknown.” I want to consolidate 12 individual command line sensors into one sensor with all attributes. In this example, each individual sensor provides the correct value, but when I attempt to add them as attributes, they don’t show up as attributes, and the sensors remain in the “unknown” state. Why is this happening, and how can I fix the issue? I’ve discovered that running separate sensors is quite performance-intensive.
I have tried to see if anyone else is experiencing the same issue, but the solutions don’t seem to fit this specific example.
Looking forward hearing from you, Rasmus.
command_line:
- sensor:
name: Solutronic inverter
command: "python3 /config/solutronic.py"
scan_interval: 10
json_attributes:
- 'PAC'
- 'PACL1'
- 'PACL2'
- 'PACL3'
- 'UDC1'
- 'UDC2'
- 'UDC3'
- 'IDC1'
value_template: >
{% if value == "unavailable" %}
{{ 'off' }}
{% else %}
{{ 'on' }}
{% endif %}
- sensor:
name: Solutronic Leistung AC
command: "python3 /config/solutronic.py"
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
icon: mdi:current-ac
json_attributes: true
value_template: "{{ value_json.PAC }}"
scan_interval: 120
- sensor:
name: Solutronic Power L1
command: "python3 /config/solutronic.py"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:solar-panel
json_attributes: true
value_template: "{{ value_json.PACL1 }}"
scan_interval: 30
- sensor:
name: Solutronic Power L2
command: "python3 /config/solutronic.py"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:solar-panel
json_attributes: true
value_template: "{{ value_json.PACL2 }}"
scan_interval: 30