-
Hello, I want to connect a tag reader on an ESP32 GPIO to arm/disarm my dsc alarm. I spent a lot of time to understand how but I don't find. Can you give me the right syntax with this example ?
Thanks :o) |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Yes, calling an internal function of a custom component is tricky because of the way esphome loads the components. You need to use a lambda function. You can look at the interval: section in the dscalarm.yaml for an example. I've cobbled up quickly what I think it should be in your example for the conditions. I have not tested it so it might need tweaking. I used the set_alarm_state command in this case. The function has 3 arguments. 1=alarm state which can be S=arm stay, A=armed away, N=armed night mode, D=disarm. For the disarm access code below, I used the global variable set in the yaml. You can also hard code any other code you want there.
Edit: I've modified my example. I have not tested but it validates |
Beta Was this translation helpful? Give feedback.
-
The syntax is correct but the command does nothing. I have tested with the tag reader at the beginning but there is the same result with a switch. I'm using the "new" branches.
|
Beta Was this translation helpful? Give feedback.
-
Whups my mistake, it should be "A" for away. Not W. I have corrected my initial post. |
Beta Was this translation helpful? Give feedback.
-
It's working ! Thank you. |
Beta Was this translation helpful? Give feedback.
Yes, calling an internal function of a custom component is tricky because of the way esphome loads the components. You need to use a lambda function. You can look at the interval: section in the dscalarm.yaml for an example. I've cobbled up quickly what I think it should be in your example for the conditions. I have not tested it so it might need tweaking. I used the set_alarm_state command in this case. The function has 3 arguments.
1=alarm state which can be S=arm stay, A=armed away, N=armed night mode, D=disarm.
2=access code if needed by the command such as for disarm or night mode
3=partition to send the command to.
For the disarm access code below, I used the global variable set in …