-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Hello pilotak,
Thanks a lot for your compont that extracts the attributes of an entity. I works perfect.
Unfortunately the HA Team decides to change the systax of the command line sensor from:
sensor:
- platform: command_line
name: xxxx
to:
command_line:
- sensor:
name: xxxx
Maybe, it is possible to improve your component to ensure it will work with the new syntax in future too.
It would be great if we can use your component also in future.
If I understand correctly the new syntax for your component would be:
attribute:
- sensor:
friendly_name: xxxx
Best regards,
Harald
Please, allow me to tell the background story - Maybe you find it helpful as a different example for using your component:
I use a python script to read the status of my openevse wallbox.
The script uses TCP socket and returns different values by printing a JSON formatted string.
{"WS": " Laden ", "T": 17.7 , "CS": 12 , "CA": 10.78 }
# generate Sensor with JSON attributes from JSON data generated with a python file
command_line:
- sensor:
name: wbdata
command: "python3 /config/custom_components/evse_rapi/EVSE_status.py"
scan_interval: 15
json_attributes:
- CA
- CS
- T
- WS
value_template: "{{ value_json | tojson }}"
This command line sensor reads the output from my python file and makes the attributes visible in HA, together with your component I can generate different sensors out of one execution of the script.
sensor:
# Sensors generated from Wallbox status attributes - Custom component attributes found on HACS
- platform: attributes
friendly_name: "Wallbox Temperatur"
attribute: "T"
icon: 'mdi:temperature-celsius'
unit_of_measurement: "°C"
entities:
- sensor.wbdata
- platform: attributes
friendly_name: "Wallbox Status"
attribute: "WS"
icon: 'mdi:temperature-celsius'
entities:
- sensor.wbdata
- platform: attributes
friendly_name: "Ladestrom Vorgabe"
attribute: "CS"
icon: 'mdi:temperature-celsius'
unit_of_measurement: "A"
entities:
- sensor.wbdata
- platform: attributes
friendly_name: "Ladestrom aktuell"
attribute: "CA"
icon: 'mdi:temperature-celsius'
unit_of_measurement: "A"
entities:
- sensor.wbdata
It works perfect and is easy to configure, but it took me some time to find your solution... ;-)