Closed benmprojects closed 4 years ago
I'll have a look and see what I can find.
I am thinking of using something like blink without delay
I have removed all delays and have updated the code and MQTT calls for the beep.
Have a look and let me know your thoughts.
These are some sample automations
- alias: hasp_alarm01_p7_AlarmDisarmed
trigger:
- platform: state
entity_id: alarm_control_panel.house
to: 'disarmed'
- platform: state
entity_id: 'binary_sensor.alarm01_connected'
to: 'on'
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: alarm_control_panel.house
state: 'disarmed'
action:
- service: mqtt.publish
data:
topic: 'hasp/alarm01/command/json'
payload: '["p[7].b[13].font=0","p[7].b[13].pco=63488","p[7].b[13].bco=65535","p[7].b[13].txt=\"DIS\\rARMED\"","p[7].b[15].font=1","p[7].b[15].pco=65535","p[7].b[15].bco=63488","p[7].b[15].txt=\"ARM\""]'
- service: mqtt.publish
data:
topic: 'hasp/alarm01/command/beep'
payload: '0,0,0'
- alias: hasp_alarm_p7_InvalidCode
trigger:
- platform: mqtt
topic: 'hasp/alarm01/state/p[7].b[15]'
payload: 'OFF'
action:
- delay:
seconds: 0.5
- condition: state
entity_id: alarm_control_panel.house
state: 'disarmed'
- service: mqtt.publish
data:
topic: 'hasp/alarm01/command/beep'
payload: '100,200,3'
- alias: hasp_alarm_p7_ValidCode
trigger:
- platform: mqtt
topic: 'hasp/alarm01/state/p[7].b[15]'
payload: 'OFF'
action:
- delay:
seconds: 0.5
- condition: state
entity_id: alarm_control_panel.house
state: 'pending'
- service: mqtt.publish
data:
topic: 'hasp/alarm01/command/beep'
payload: '1000,100,60'
Do you like this method?
Conflicted. I can see how it solves for your use case directly, and you have implemented this in a way that won't interfere with anything else. Based on that I'm inclined to merge this w/ master but it also makes me want to expand on the idea in a more general-purpose way, allowing access to the GPIOs via MQTT. What I might wind up doing here is merging into master, but leaving the commands out of the documentation for the moment. Then, you can continue your use of this while I take some time to work out a more general purpose approach. That will almost certainly wind up changing the MQTT commands in use, at which point I might wind up breaking your personal configuration (by changing the commands), but wouldn't be doing so without implementing equivalent functionality.
Does this sound reasonable? Your work here is great and I want to recognize your contribution ASAP.
Sounds great.. I look forward to your update.
Any update if you are going to include this merge into master?
You raise a good point, I've merged into dev, made some fixes, and your code should make it into the next release.
This pull request to to add a beep tone on screen press. This will help people to know that the button press was successful. I have also added a MQTT command to allow invalid code tried it will beep a pattern. Automation below.
Thanks
Ben