Good companions. I’m new to Home Assistant and I get lost easily. I am trying to implement a python script to HA to change the value of a sensor on action of a button in lovelace. The script is this:
I have HA in a docker, and I have saved that script in this folder:
/usr/share/hassio/homeassistant/python_scripts
Then in configuration.yaml I insert this code to call it as a service:
Invalid config for [python_script]: expected dict for dictionary value @ data['python_script']. Got [OrderedDict([('service', 'python_script.set_state'), ('data', None), ('entity_id', 'sensor.sensor_log'), ('state', '')])]. (See /config/configuration.yaml, line 96).
What am I doing wrong? Thank you very much partners.
petro, it keeps giving me problems when making the indentation:
Invalid config for [python_script]: expected dict for dictionary value @ data['python_script']. Got [OrderedDict([('service', 'python_script.set_state'), ('data', OrderedDict([('entity_id', 'sensor.sensor_log'), ('state', '')]))])]. (See /config/configuration.yaml, line 96).