10-07-2024, 01:02 AM
for example: INPUT1 button TOGGLE switch01
- platform: gpio
name: A32 Pro Switch01
id: "a32_pro_switch01"
pin:
xl9535: xl9535_hub_out1
number: 0
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: A32 Pro Switch01 Tuya
dp_id: 101
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "a32_pro_switch01"
# ----------------------------------------------------------------
binary_sensor:
- platform: gpio
name: A32 Pro DI01
on_press:
then:
- switch.toggle: a32_pro_switch01
id: "a32_pro_di01"
pin:
xl9535: xl9535_hub_in1
number: 0
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: A32 Pro DI01 Tuya
dp_id: 133
bind_binary_sensor_id: a32_pro_di01
internal: true
--------------------------------------
so it's very easy, only add these command to your binary_sensor:
on_press:
then:
- switch.toggle: a32_pro_switch01
if you want INPUT2 TOGGLE switch2, just add:
on_press:
then:
- switch.toggle: a32_pro_switch02
understand now?
- platform: gpio
name: A32 Pro Switch01
id: "a32_pro_switch01"
pin:
xl9535: xl9535_hub_out1
number: 0
mode: OUTPUT
inverted: true
- platform: tuya_wifi_mcu
name: A32 Pro Switch01 Tuya
dp_id: 101
# hide from homeassistant ui
internal: true
# bind other switch, sync state
bind_switch_id: "a32_pro_switch01"
# ----------------------------------------------------------------
binary_sensor:
- platform: gpio
name: A32 Pro DI01
on_press:
then:
- switch.toggle: a32_pro_switch01
id: "a32_pro_di01"
pin:
xl9535: xl9535_hub_in1
number: 0
mode: INPUT
inverted: true
- platform: tuya_wifi_mcu
name: A32 Pro DI01 Tuya
dp_id: 133
bind_binary_sensor_id: a32_pro_di01
internal: true
--------------------------------------
so it's very easy, only add these command to your binary_sensor:
on_press:
then:
- switch.toggle: a32_pro_switch01
if you want INPUT2 TOGGLE switch2, just add:
on_press:
then:
- switch.toggle: a32_pro_switch02
understand now?