Initial state of toggle switch

Is it possible to use for initial state state of binary sensor (or switch state) or only true or false is accepteble?

alias: Togle switch Automation
description: ''
initial_state: binary_sensor.my_sensor_state2 # or switch.my_switch or only true
trigger:
  - platform: state
    entity_id: binary_sensor.my_sensor_state
condition: []
action:
  - service: switch.toggle
    target:
      entity_id: switch.my_switch
mode: single

Welcome to the forum. Good job on formatting your first post :+1:

No, sorry that is not possible. true or false only.

EDIT:

You can use the sate of binary_sensor.my_sensor_state2 in a condition to determine if the actions run or not.

Sorry for that. I am newbie :slight_smile:
But how its possible in automation to switch on or off depending of switch state? something like this:

alias: notTogle switch Automation
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.my_sensor_state
condition: []
action:
  - service: switch.turn_on
    target:
      entity_id: switch.my_switch
  - service: switch.turn_off
    target:
      entity_id: switch.my_switch
mode: single

No need to apologise. I was complimenting you on a job well done (I saw the intitial attempt with the asterisks, that was creative :slight_smile: ).

Something like this:

alias: notTogle switch Automation
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.my_sensor_state
condition: []
action:
  - service: >
      switch.turn_{{ trigger.to_state.state }}
    target:
      entity_id: switch.my_switch
mode: single

Its works!
Thank you very much!!!