Hi! Someone might have same post as this but can't find to get a yaml code to solve the issues I've encountered. It seems working but the issue is the relay is not responding despite status is already open in HA when touch switch is in on-state. Can anyone help me find out what's missing in my code? Any help is well appreciated.
switch:
- platform: gpio
pin: GPIO17
name: Relay C1
id: relay_c1
inverted: true
- platform: gpio
pin: GPIO18
name: Relay C2
id: relay_c2
inverted: true
- platform: gpio
pin: GPIO19
name: Relay C3
id: relay_c3
inverted: true
- platform: gpio
pin: GPIO21
name: Relay C4
id: relay_c4
inverted: true
- platform: gpio
pin: GPIO22
name: Relay C5
id: relay_c5
inverted: true
- platform: gpio
pin: GPIO23
name: Relay C6
id: relay_c6
inverted: true
- platform: gpio
pin: GPIO25
name: Relay C7
id: relay_c7
inverted: true
- platform: gpio
pin: GPIO26
name: Relay C8
id: relay_c8
inverted: true
binary_sensor:
- platform: gpio
pin:
number: 2
ignore_strapping_warning: true
mode:
input: true
pullup: true
internal: true
name: C1 TSwitch
id: c1_tswitch
filters:
- delayed_on: 50ms
- delayed_off: 50ms
on_state:
then:
- if:
condition:
lambda: return x;
then:
- switch.turn_on: relay_c1
else:
- switch.turn_off: relay_c1
- platform: gpio
pin: GPIO4
name: C2 TSwitch
id: c2_tswitch
filters:
- delayed_on: 50ms
- delayed_off: 50ms
on_state:
then:
- if:
condition:
lambda: return x;
then:
- switch.turn_on: relay_c2
else:
- switch.turn_off: relay_c2
- platform: gpio
pin:
number: 12
ignore_strapping_warning: true
name: C3 TSwitch
id: c3_tswitch
filters:
- delayed_on: 50ms
- delayed_off: 50ms
on_state:
then:
- if:
condition:
lambda: return x;
then:
- switch.turn_on: relay_c3
else:
- switch.turn_off: relay_c3
- platform: gpio
pin: GPIO13
name: C4 TSwitch
id: c4_tswitch
filters:
- delayed_on: 50ms
- delayed_off: 50ms
on_state:
then:
- if:
condition:
lambda: return x;
then:
- switch.turn_on: relay_c4
else:
- switch.turn_off: relay_c4
- platform: gpio
pin: GPIO14
name: C5 TSwitch
id: c5_tswitch
filters:
- delayed_on: 50ms
- delayed_off: 50ms
on_state:
then:
- if:
condition:
lambda: return x;
then:
- switch.turn_on: relay_c5
else:
- switch.turn_off: relay_c5
- platform: gpio
pin: GPIO27
name: C6 TSwitch
id: c6_tswitch
filters:
- delayed_on: 50ms
- delayed_off: 50ms
on_state:
then:
- if:
condition:
lambda: return x;
then:
- switch.turn_on: relay_c6
else:
- switch.turn_off: relay_c6
- platform: gpio
pin: GPIO32
name: C7 TSwitch
id: c7_tswitch
filters:
- delayed_on: 50ms
- delayed_off: 50ms
on_state:
then:
- if:
condition:
lambda: return x;
then:
- switch.turn_on: relay_c7
else:
- switch.turn_off: relay_c7
- platform: gpio
pin: GPIO33
name: C8 TSwitch
id: c8_tswitch
filters:
- delayed_on: 50ms
- delayed_off: 50ms
on_state:
then:
- if:
condition:
lambda: return x;
then:
- switch.turn_on: relay_c8
else:
- switch.turn_off: relay_c8`


