IsmartAlarm integration via IFTTT

Integrating IsmartAlarm in openHab was quiete tricky, especially if you want a bidirectional communication (keeping status synced indipendetly by the way the alarm is set, official app, openHab, ir remote and everything else)
IsmartAlarm is a basic (and cheap) alarm solution that offer sensors, sirens, cameras but unluckly it has no API (well it has API, since you can connect using IFTTT or its own app even from remote), but can be integrated in openHAB (even if i cant guarantee on reliability).
At the moment i only integrated basic function to Arm/Disarm/Set Home statuses from openHAB (i trigger it with switch, but it can be included in more complex scenarios lik ā€˜Arm when i leave the houseā€™ or ā€˜Disarm when i unlock the doorā€™ or ā€˜Set Home every night at midnight if im homeā€™ and so on). The stream of the camera cant be reached as far as i know (ill watch it deeper in future) and all notification are routed to the official app (they can be routed also to openHAB, but i kept this way because i wont uninstall the official app, just in case).
At the beginnig i was using the openHAB IFTTT channel, but it was very slow, so i moved to Maker Event Channel.

Beside openHAB running to start you need:

  • IFTTT account with configured IsmartAlarm, openHAB and maker Event channels
  • myhopenhab account linked to your local openHAB (openhubclud)

As someone suggested (thank you @rlkoshak)i coded this sample using a proxy items approach, so the switch on openHUB can be ā€˜remotelyā€™ without triggering any events (if this happens the system is going to loop: openHAB set the alarm, the alarm chang status and notify openHAB, openHAB change switch status and send the set alarm command againā€¦ and so on)

items:
I added two objects, one for programming purpose (Proxy) and one for interface (UI)

//ALARM
String Alarm_UI (AlarmCtrl)
String Alarm_Proxy (AlarmCtrl)

Sitemap:
i only addede the UI object as a Switch with the 3 status (theres also a panic status but i did not use it)

	Frame label="Alarm" {
		Switch item=Alarm_UI label="Alarm" icon="ismartalarm" mappings=["Arm"="Arm", "Disarm"="Disarm", "Home"="Home"]
	}

Now you have to expose to IFTTT (via openHAB Cloud configuration) the Alarm_Proxy and Alaram_UI objects (the proxy one is enough but i prefere to add both for structure).
Next you have to setup 6 applets on IFTTT (2 for every state)
ARM status:
if Maker Event event name ā€˜alarm_armā€™
then ismartalarm Set system to a mode: Arm

if ismartalarm System mode changes: Arm
openHAB Send a command Item: Alarm_Proxy value: Arm
(just repeat the rules for the other status)

Now for the rules:
Donā€™t forget to change you maker Event key in the file
basically this rules send a request to maker Event once the Alarm_UI switch is clicked and update Alarm_UI if the action is received by Alarm_Proxy (when the status is updated from the official app for example).
This file can host more logic based on both the Command (Arm/Disarm/Home) and the source (UI/Proxy); you can add more items to add more source and combine all for really complex actions


rule "Alarm control from IFTTT"
when
	Member of AlarmCtrl received command
then
	logInfo("alarm.rules", triggeringItem.name)	
	val source = triggeringItem.name.split("_").get(1)
	logInfo("alarm.rules", "command received: "+receivedCommand+" "+source)

	if (receivedCommand.toString == 'Disarm') {
		logInfo("alarm.rules", "Command Disarm, status: "+Alarm_Proxy.state+"-"+triggeringItem.name)
		Alarm_UI.postUpdate(receivedCommand)
		if (source == 'UI') {
			logInfo("alarm.rules", "Execute IFTTT")
			sendHttpGetRequest("https://maker.ifttt.com/trigger/alarm_disarm/with/key/your_key")
		}

	}
	else if (receivedCommand.toString == 'Arm') {
		logInfo("alarm.rules", "Command Arm, status: "+Alarm_Proxy.state+"-"+triggeringItem.name)
		Alarm_UI.postUpdate(receivedCommand)
		if (source == 'UI') {
			logInfo("alarm.rules", "Execute IFTTT")
			sendHttpGetRequest("https://maker.ifttt.com/trigger/alarm_arm/with/key/your_key")
		}	
	}
	else if (receivedCommand.toString == 'Home') {
		logInfo("alarm.rules", "Command Home, status: "+Alarm_Proxy.state+"-"+triggeringItem.name)
		Alarm_UI.postUpdate(receivedCommand)
		if (source == 'UI') {
			logInfo("alarm.rules", "Execute IFTTT")
			sendHttpGetRequest("https://maker.ifttt.com/trigger/alarm_home/with/key/your_key")
		}
	}
end

At the moment seems everything works well, setting the alarm status from openHAB trigger the ā€œrealā€ alarm in about 2 seconds, the reverse take a bit longer but its not a big problem since the only thing it does is at interface level (alarm status is immediate)
Hope this can be helpful

3 Likes

Hi, Iā€™m wondering now that IsmartAlarm network doesnā€™t work, are you able to use it with open hab?

hi @qtoop, unluckly since all the latest things from ismartalarm everything (especially ismartalarm) is messed up, so it no longer works, furthermore IFTTT, moved to a new plan model and you cant use it as before (unless you have a paid plan)

thanks for the info my friendā€¦