If you have a 4-channel Namron switch, it is unnecessary to make 4-8 automation to use all the buttons. In Home Assistant, it actually holds with just one automation.
Note – this example uses a Namron Zigbee switch. It is integrated with the use of Zigbee2MQTT.
As usual, we need to define what is the trigger in the automation. The trick here is to define 8 triggers in the automation, and each trigger gets a trigger ID. Each button becomes a trigger, and then you insert a unique trigger ID for each button.
The next thing we need to do is choose which “action” each switch should perform. What is important now is that we set the action type to “Choice”. Then we get the opportunity to enter a condition for each action.
The condition will then trigger ID, and action becomes, e.g., turning the light on / off.
The following example uses the buttons to turn on / off lights in four different rooms.
alias: 4ch bryter 1etg
description: ''
trigger:
- platform: device
domain: mqtt
device_id: 8157822feed89eb844906119d2b99599
type: action
subtype: on_l1
discovery_id: 0x588e81fffe1ae02b action_on_l1
id: on1
- platform: device
domain: mqtt
device_id: 8157822feed89eb844906119d2b99599
type: action
subtype: off_l1
discovery_id: 0x588e81fffe1ae02b action_off_l1
id: off1
- platform: device
domain: mqtt
device_id: 8157822feed89eb844906119d2b99599
type: action
subtype: on_l2
discovery_id: 0x588e81fffe1ae02b action_on_l2
id: on2
- platform: device
domain: mqtt
device_id: 8157822feed89eb844906119d2b99599
type: action
subtype: off_l2
discovery_id: 0x588e81fffe1ae02b action_off_l2
id: off2
- platform: device
domain: mqtt
device_id: 8157822feed89eb844906119d2b99599
type: action
subtype: on_l3
discovery_id: 0x588e81fffe1ae02b action_on_l3
id: on3
- platform: device
domain: mqtt
device_id: 8157822feed89eb844906119d2b99599
type: action
subtype: off_l3
discovery_id: 0x588e81fffe1ae02b action_off_l3
id: off3
- platform: device
domain: mqtt
device_id: 8157822feed89eb844906119d2b99599
type: action
subtype: on_l4
discovery_id: 0x588e81fffe1ae02b action_on_l4
id: on4
- platform: device
domain: mqtt
device_id: 8157822feed89eb844906119d2b99599
type: action
subtype: off_l4
discovery_id: 0x588e81fffe1ae02b action_off_l4
id: off4
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: on1
sequence:
- type: turn_on
device_id: 57b76e048da53d4b03b25e3870eb14b5
entity_id: light.tvstua
domain: light
- conditions:
- condition: trigger
id: off1
sequence:
- type: turn_off
device_id: 57b76e048da53d4b03b25e3870eb14b5
entity_id: light.tvstua
domain: light
- conditions:
- condition: trigger
id: on2
sequence:
- type: turn_on
device_id: 9f2b136d686ed16073eae7b299a8e05b
entity_id: light.stuekroken
domain: light
- conditions:
- condition: trigger
id: off2
sequence:
- type: turn_off
device_id: 9f2b136d686ed16073eae7b299a8e05b
entity_id: light.stuekroken
domain: light
- conditions:
- condition: trigger
id: on3
sequence:
- type: turn_on
device_id: 4b894a4b7732fca312be94f9851ab999
entity_id: light.spisestue
domain: light
- conditions:
- condition: trigger
id: off3
sequence:
- type: turn_off
device_id: 4b894a4b7732fca312be94f9851ab999
entity_id: light.spisestue
domain: light
- conditions:
- condition: trigger
id: on4
sequence:
- type: turn_on
device_id: 7451880d85b35111b3c7d2e23afffc23
entity_id: light.kitchen_bench
domain: light
- type: turn_on
device_id: 59a18bab4888496580456a613d96b206
entity_id: light.0x000b57fffed9e150
domain: light
- conditions:
- condition: trigger
id: off4
sequence:
- type: turn_off
device_id: 7451880d85b35111b3c7d2e23afffc23
entity_id: light.kitchen_bench
domain: light
- type: turn_off
device_id: 59a18bab4888496580456a613d96b206
entity_id: light.0x000b57fffed9e150
domain: light
default: []
mode: single