Hi @rodpayne
I’m trying to dynamically update thermostat (climate) away_temp value using your script with no luck so far
Nothing is happening
How to troubleshoot this and know what is wrong in my code?
Here is my automation:
##### When changing the value of input_number.away_temp, then thermostat away_temp is changed as well
- id: updating_thermostat_salon_when_away_temp_changed
alias: Updating Thermostat Salon away_temp value when input "Temp Absent" is changed
trigger:
- platform: state
entity_id: input_number.away_temp
action:
- service: python_script.set_state
data_template:
entity_id: climate.thermostat_salon
away_temp: "{{ states('input_number.away_temp') }}"
input_number.away_temp is a switch that I can modify in lovelace.
The goal is to be able to dynamically change a climate: away_temp value by changing the value of this input…
Right now I can only initialize it at startup but cannot change it.
Here is my Climate initialization:
The python script you use is for setting the state of a sensor, not the state of an attribute of a climate entity. This is not going to work.
I think even if you would be able to set this attribute,it would be overwritten by the system automatically with the value configured in the climate integration that you use.
This was a very useful thread. I discovered how to use set_state to stuff values into a broken sensor from an independent Node Red source, and I also discovered that I could use set_state to set the entity_picture of a badge.
I’m not worried about the original component code overwriting my values because it’s broken, but I made sure to disable it in its sensor.py file anyway.
Hi. I’m trying to get the set_state script working with the speedtest sensors, 'cause I would like to have them resetted before starting a new test, but I’m failing…
I’ve tried in the developers tool services tab but nothing happens. What could I do?
Rodpayne, after a whole day of trying to unsuccessfully pass an argument to a python script to manage a sensor, I’m desperate so your help would be much appreciated.
My python script is
Copy to clipboard
name = data.get("nombre")
logger.warning("Hello %s", name)
hass.bus.fire(name, {"wow": "from a Python script!"})
hi mate, I think im missing someting, can you please tell me what to add it to conf yml to enable the py script? may be an example of your one.
It does not change the state…
Basically doing a door bell out of my onvif feed and ikea button
Managed to get push notification and snapshots with them when button is pressed but notification come silently if iphone is not in use :[ so i try to change state of mock motion sensor based on mock light . This in turn will trigger native ios notification from homekit…
Not sure if there is a better way to get solid notification to iphone even if is not in use … trigger when a mock light is on…. Hope it shed some light on my project
I’m a bit stukc with this. I created a folder called python_scripts
inside that I put the text file set_state.py
I installed PYScript from HACS
I restarted
Added the line to configuration.yaml:
# python
python_script: set_state.py
But when I do check configuration I get this:
Invalid config for [python_script]: expected dict for dictionary value @ data[‘python_script’]. Got ‘set_state.py’. (See ?, line ?).
I tried it in the configuration.yaml without the .py but it still is no good.
Any ideas what I’ve missed? the documentation around putting the line into configutation.yaml isn’t very helpful