Closed KonTiki1957 closed 3 years ago
I'm afraid your code is not correct.
There's no need of the service_data
level.
Just put action
, entity_id
and state
below data:
.
This should work:
prova_python_script:
alias: prova python script
sequence:
- service: python_script.hass_entities
data:
action: set_state
entity_id: sensor.temperatura_piano_sopra
state: 30
log_enabled: true
mode: single
Let me know if that helps.
@pmazz I used your code, but it returns to old state after few seconds.
My code: `monitor_4k_state_off: sequence:
data: action: set_state entity_id: switch.monitor_4k_power state: 'off' service: python_script.hass_entities`
It set monitor_4k_power to 'off', however it set to 'on' lone.
@vicentecandido Your script seems to only alter the switch state.
Since you're not actually "switching off" the switch, its state is reverted back by home assistant after few seconds.
This is not a proper use of the script.
You should use the switch.turn_off
service instead.
https://www.home-assistant.io/integrations/switch/#use-the-services
@pmazz Thanks to help me. I need of a script alter only state without executing the action.
I'm interested in using this script but I'm not succeeding, I always get the following error: [homeassistant.components.python_script.hass_entities.py] Required parameter 'action' is missing. with following HA script configuration. Can you give me a hint? Thank you.
YAML configuration
Screenshots If applicable, add your screenshots here.
Version latest Additional information Add any other relevant additional information here.