Hi All,
I’ve been playing with HA for a week now, what a great Application!!
I currently use an M1 Gold home alarm/automation system for security and control of my CBUS lighting system via a CBUS interface on the M1 Gold (known as Elk in other parts of the world).
My initial use of HA is to use Siri to control lights in my house by interfacing HA on a Pi3 with my M1 Gold using the Pi3 GPIO outputs and M1 Gold alarm inputs.
I have 4 outputs on the GPIO pins feeding 4 sensor inputs on the M1 Gold, treating the 4 inputs as binary so that I can control 15 devices connected to the M1 Gold (rather than just 4). The M1 Gold can apply rules such that I can create actions based on the various input states of the 4 inputs, 15 in total.
I can use Siri to control the 4 GPIO outputs individually by saying ‘Switch One ON’ or ‘Switch Two OFF’, but this only gives me control of 4 devices.
In order to switch 15 devices via Siri, I have created 15 script entries that configure the GPIO outputs based on binary 1 - 15 (0001 - 1111, 0000 is all devices off).
Now, Siri expects an ON or OFF after the device name, for eg ‘Hey Siri, Device One OFF’. As mentioned earlier this works fine for up to 4 devices/switches (by saying ‘Hey Siri Switch One ON’. ) , Switch One OFF etc.
Beyond 4 devices, since based on a script, from what i can workout I need to parse just the name of the device from Homekit/Siri, without the ON/OFF. ie. ‘Hey Siri Device One’. Im unable to switch back OFF by saying ‘Hey Siry Device One OFF’.
With my current config copied below I can turn the lights on by saying ‘Hey SIri Device One’ and the light comes on. I need to say ‘Hey Siri Device One’ two times for it to switch off. I need to say ‘Hey Siri Device One’ twice again for the light to switch back on.
I’ve tried with various combinations of if/else statements, conditions and triggers to no avail, my scripts and config is below.
Any ideas or pointers on how to make this work?
Many thanks.
configuration.yaml
homekit:
filter:
include_domains:
- switch
include_entities:
- script.m1device1
entity_config:
switch.gpiocontrol:
type: switch
switch:
- platform: rpi_gpio
ports:
17: Switch1
18: Switch2
27: Switch3
22: Switch4
script
# Device 2 --> 0001 --> sw1
m1device1:
alias: Device One
sequence:
- service: switch.toggle
entity_id:
- switch.switch2
I’ve also tried the below script with no success…
# Device 1 --> 0001 --> sw1
m1device1:
alias: Device One
sequence:
- service: script.turn_on
data_template:
entity_id: >
{% if is_state('switch.switch1', 'on') %}
script.m1device2off
{% else %}
script.m1device2on
{% endif %}