home-alarm icon indicating copy to clipboard operation
home-alarm copied to clipboard

Announce Sensor that Triggered Alarm

Open andjones132 opened this issue 1 year ago • 0 comments

Announce Sensor that Triggered Alarm

Is your feature request related to a problem? No

If so, then add a clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution/feature you'd like

When the Alarm is triggered, announce what sensor triggered the alarm. This can be more helpful in the middle of the night than just a loud noise. Plus in the case that someone does break it would be rather disturbing that the system announces the location intruder based on what sensor was triggered.

As an example, I currently have my alarm Konnected system set up in NR and a function that derives the announcement that will be sent to all my google home speakers based on the event that triggered the alarm. It would be nice if this AD addin could do something similar. I have been thinking about tackling this myself, but my AD coding skills are not on par with yours. For example, I have yet to understand how to use async and await functions effectively, but see you use them quite extensively. I assume this is to basically setup a separate "thread" for each entity. Anyway, I thought I would make the suggestion here in case you would be willing to do the changes necessary to get it working as described.

var ghmsgPending='A-Pending-Alarm-has-been-triggered-by-the-' + msg.sensorName + '.';
var ghmsgTriggered='The-Security-Alarm-has-been-triggered-by-the-' + msg.sensorName + '.';
var ghmsgDisarmed='The-Security-Alarm-has-been-Disarmed.';

flow.set('textMessage', null);
var textMessage
if (msg.payload == 'pending') {
	textMessage = ghmsgPending;
    } 
if (msg.payload == 'triggered') {
	textMessage = ghmsgTriggered;
    } 
if (msg.payload == 'disarmed'){
	textMessage = ghmsgDisarmed;
    }


flow.set('textMessage', textMessage);
msg.textMessage=flow.get('textMessage');
return msg;

Describe alternatives you've considered

Node-Red

A clear and concise description of any alternative solutions or features you've considered.

Node-Red Flows, but I would prefer migrating this to AD so that I could have test cases that I could run after each HA update just to make sure nothing is broken by the latest release. I recently discovered that my alarm hadn't been working since May when apparently there was some breaking change related to tts.google_say.

Additional context

Add any other context or screenshots about the feature request here.

andjones132 avatar Oct 16 '22 20:10 andjones132