I was creating a package to test and communicate some issues I am having.
I wanted something self contain that I could post and you guy could implement and test easily.
I thought I would create a input_select for the user to control some settings. Then a input_boolean for a virtual switch. A sensor based on the value of the input_boolean.
This is the test something that is not working in my automation calling python scripts (hello_world.py).
Right now, the switch and sensor works as expected, but the automation of just controlling the switch based on the input_select is not working. I think it is in my action. When I try and test in the developer tool-call service, it does not work. I need to get past this to demo my real world issue.
I just am not seeing it.
Here is how I am calling devloper->service
Here is the entity
I can show it
FYI Current Package
input_select:
test_hello_world_mode:
name: Hello World Mode
options:
- "Off"
- "Mode 2"
- "Mode 3"
- "Mode 4"
icon: mdi:target
input_boolean:
test_hello_world_switch:
name: Hello World Switch
initial: off
icon: mdi:flashlight
group:
test_hello_world_views:
view: yes
name: Test Hello World Script
entities:
- group.test_hello_world_script
test_hello_world_script:
name: Test Script
entities:
- input_select.test_hello_world_mode
- input_boolean.test_hello_world_switch
- sensor.hello_world_flashlight
sensor:
- platform: template
sensors:
hello_world_flashlight:
friendly_name: "Hello World Flashlight"
value_template: >-
{{ states.input_boolean.test_hello_world_switch.state }}
automation:
- alias: test hello world script off
trigger:
- platform: template
value_template: "{% if is_state('test_hello_world_mode', 'off') %}true{% endif %}"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.test_hello_world_switch
- alias: test hello world script on
trigger:
- platform: template
value_template: "{% if not is_state('test_hello_world_mode', 'off') %}true{% endif %}"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.test_hello_world_switch
# - alias: test hello world script off
# trigger:
# - platform: template
# value_template: "{% if is_state('test_hello_world_mode', 'off') %}true{% endif %}"
# action:
# - service: python_script.hello_world
# data_template:
# name: "{{ trigger.to_state.state }}"