Second Version of Smart Alarm Device /Type for a Status Dashboard

1 Like

Why would you assume that?

A Capability simply specifies what Attributes and Commands an arbitrary Device Type Handler that claims the Capability must implement. It does not specify the overall design or code of the DTH, nor give the DTH any default events or messages to parse(), etc. Messages to parse() come from specific hardware and may have to be configured with Z-Wave, ZigBee commands, and/or a Service Manager SmartApp, etc.

All the Capability says is that DTH’s must have a certain Command: “deviceNotification(string)”. How you implement the command is entirely up to you.

ya figured that out thanks… I had that function but it also for some reason need either the update or initialize function even though it did nothing to work… but now it is all fubared it was not working so I removed it and now I cannot create ANY CUSTOM DEVICE TYPE AT ALL I GET THIS ERROR

Oh No! Something Went Wrong!
Error:500: Internal Server ErrorURI:/device/saveReference Id:a0be5780-6535-4643-9266-81a0fb14051eDate:Tue Mar 22 01:51:07 UTC 2016

Unless I’m mistaken, updated() and initialize() are in no way required (or even, meaningful) in a Device Type.

Can you give me a better idea of what you are trying to do? Are you creating a Virtual Device Type that will display Notifications of some sort? If so, that’s a great idea, but it would be breaking new ground, as I don’t know of any device type examples for Capability Notification.

No, you are partially incorrect update and initialized do get called on creation and when you update something on the device type…it still may not be required… it may have been some other reason it started working suddenly maybe the database propagation issue (who knows)

I put comments in and initialize states in these procedures and they do get called.

Anyway, i got the first version of my smartalarm dashboard working…

You create a device with a custom device type I created that just gets notification messages from the smart alarm smart app.

You them create a room called alarm or whatever and add the single smart alarm device in the room.

You then make this device the default for the room.

Since it appears we will never get our old dashboards back I think this is the best we can do…

This is a pseudo dashboard with the fewest clicks like the shm dashboard.
It separates the status on top ie all ok, intrusion alert, water alert or fire/co2 alert (with differnent colors)

Underneath it has the current arming status, the last alert zone, and type. I also increased the reset time in smart alarm to 5 minutes from 3 and it appears to work ok. I tried to add the status message as a secondary control on the multi tile but with the current android version of the app it was so small on my sgs5 as to be unreadeable, so i changed it to tiles underneath.

Kinda weird to have a device type/device that is the reverse of normal operation. Instead of the smart app getting status etc. from the device it is sending info to the device.

Here are some screen shots let me know what you think.

1 Like

That’s good to know, but the API Documentation certainly does not say this in neither the example, nor in the API section of the Documentation. @jim?
http://docs.smartthings.com/en/latest/ref-docs/device-handler-ref.html

The API for SmartApps does include updated() method.

It may be unusual, but weird is a very good thing … I prefer the words creative or innovative. I think this is a great idea and I’m thinking of other uses.

Meanwhile, if you want to share code within the forum, please surround it with three single-back-quotes, as in:

Result:

metadata {
   definition (name: "Smart Alarm Notification Device", namespace: "lgkapps", author: "Larry Kahn kahn@lgk.com") {
   capability "Notification"
}

Or, or course, paste it into GitHub and paste the URL which will automatically create a preview here.

will submit to github tomorrow and post the code… Thanks for the triple quote I was wondering why my code looked fubared… Yes this feature is very powerful and can be used for many things and you can construct custom messages and pass anything to a device type for parsing from a smartapp.

1 Like

ok here is the source code for both the custom notification device type, and the modified smartapp…

if you want to look at line 1821 I cannot put in if (notificationDevice != null)
or if (settings.notificationDevice != null)
or even if (notificationDevice)

for some reason it thinks it is null even though I can print it out above and obviously it is not null and the code below works
any help would be appreciated… for now I’ve left it commented out…

1 Like

here is a new version with the capability to enable or disable siren for water, smoke or intrusion.
Also with a change to the alarm after delay.
Previously after the delay it would only alarm if the zone was still tripped. This is not like normal alarm systems.
Usually on entry once tripped it alarms if not disabled after the delay… I now mimic this behavior.

Also a little cleanup and a couple of typo/bug fixes…

Finally, There still is a bunch of debugging on to the logs that I will remove later once I am more sure it is working as desired.

1 Like

Major Problems with this version, but you are on the right track.

  1. You never put a remove button and it can’t be removed from IDE
  2. Push notifications are missing, so I didn’t get the alerts telling me arming away in 45 seconds etc.

Please modify code to include REMOVE button so we can remove it until the code is fully working. Thanks.

no you are wrong… mine works fine… there is some issue with either the system or your hub…
you can always remove from ide… and the remove button is not something you add it is a system function on every smart app you should know that ie

here is the push…

New version … version did not work if you did not have a hue selected (or it worked but a new one would not completely configure without a hue… there was an error). I made a change for that and also it would not work as I said without a notification device. I also added a Boolean to work around the issue were there was no notification device (because there is a bug in the notification device code and you cannot check for its existence as I mention). I now check for the Boolean you turn on when you have a notification device.

New version works great, and even has a remove button, once it is tested for a while up it goes to Github.

Installed Alarm status but for some reason it says Arming Status unknown. I am going to arm and see if status changes.

After arming the activity gear starting turning and it locked me out of the app until the device handler was removed. Never had that happen before. It does look good. But why it had no status as Off, armed etc, I have no idea. And why it crashed with nothing in the log

This might be a stupid question but here goes anyway. What is an Notification Device, please give an example. Thanks.

Check the github there is a device type I wrote for a notification device.

That is the one that I installed yesterday that said “Arming Status Unknown” I will try that again as I didn’t have the switch turned on in your modified SA. Now it makes sense why it didn’t work. Now I really feel stupid. I have been doing home automation for 32 years, but never had to work with device types as everything we did was controlled by wire run to an RS232 board that sent 1s & 0s for on and off and open/close for status. The first automation system was a 55 story building in NYC which had a computer made in Germany by ADT and it ran a paper tape with punched holes to signal when to turn a HVAC system on and off and control lighting. We had telephone cable run to each floor and terminated at 100 pair blocks and from there we went to the motor controllers and lighting ASCO switches. Actual temp control used local Thermostats that would control the starters if the ADT computer deemed it OK. It ran using temp readers and humidity sensors in many rooms on each floor. It took my crew 1 year to complete the project. All the plans were in German, but if you can read an electrical blueprint and know common electrical and electronics it was doable.

1 Like

Larry your device type for notification works fantastic. Would there be a way to silence the siren from that Device Type? As of now the only way to stop the siren is via the IRIS Keypad or going to “Things” - “Aeon Siren” - click off. A little hard when it is going off in the middle of the night… Maybe a future update?

I have been testing your notification Device type and everything seems Ok but how do I reset an alarm. I tested my Leak detectors and they triggered your device type saying intruder alert and the device name. but it wouldn’t reset until I armed the alarm from the keypad and then disarmed then the ALL OK appeared. I tried pulling down on the screen hoping it would refresh. But that doesn’t work. What am I doing wrong or is this the way it is supposed to function? There isn’t a reset for the Water detectors device type so I couldn’t reset to OK status.

Have you seen the same results?

It shouldn’t trigger intruder
That is a bug
… I will test further and try to fix. It should say water leak.

Second there currently is no way to dismiss in the device. Even if there was it would trigger again immediately for a leak. The only way is to change mode ie disarm. Currently the device communication for notification devices is one way. I will look into something Kinda kludga like give the device switch capabilities and turning a switch on when there us an alert, then you could turn it off and the smart alarm app could read the change state in the switch and reset/dismiss. But I cannot disarm as it supports multiple modes and disarm is associated with certain modes.