I am new so hopefully just a lack of comprehension.
I have an electronic gate with two relays controlled and a sensor for closed by ESPHOME nodemcu.
I have two buttons in home assistant, one for open and one for close.
The above works.
I want one button that will toggle the gate either closed or open so i can add it to single push button.
I read that what i think i want is a template. I wrote this
# Example configuration.yaml entry
switch:
- platform: template
switches:
GateToggle:
value_template: "{{ is_state('binary_sensor.driveway_gate_2', 'on') }}"
turn_on:
service: switch.turn_on
target:
entity_id: switch.gate_open_2
turn_off:
service: switch.turn_on
target:
entity_id: switch.gate_close_2
But when i paste this into my confgiuration.yaml
# Loads default set of integrations. Do not remove.
default_config:
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# custom toggle template for the garage
switch:
- platform: template
switches:
GateToggle:
value_template: "{{ is_state('binary_sensor.driveway_gate_2', 'on') }}"
turn_on:
service: switch.turn_on
target:
entity_id: switch.gate_open_2
turn_off:
service: switch.turn_on
target:
entity_id: switch.gate_close_2
and then go to developer tools, YAML, Check configuration i get this:
Invalid config for [switch.template]: invalid slug GateToggle (try gatetoggle) for dictionary value @ data[âswitchesâ]. Got OrderedDict([(âGateToggleâ, OrderedDict([(âvalue_templateâ, â{{ is_state(âbinary_sensor.driveway_gate_2â, âonâ) }}â), (âturn_onâ, OrderedDict([(âserviceâ, âswitch.turn_onâ), (âtargetâ, OrderedDict([(âentity_idâ, âswitch.gate_open_2â)]))])), (âturn_offâ, OrderedDict([(âserviceâ, âswitch.turn_onâ), (âtargetâ, OrderedDict([(âentity_idâ, âswitch.gate_close_2â)]))]))]))]). (See ?, line ?).
The see ? line? isnât helpful to me.
I know that switch.gate_open_2 and switch.gate_close_2 and binary_sensor.driveway_gate_2 are all valid entities(?) iâm ote sure what GateToggle is, thatâs what iâd like this new âswitchâ to be called.
Am i making sense?