[SOLVED] Alarm Status Update - Solved

Hi All.
Might be on the wrong Topic.

I want to create a string to report my alarm status. and not sure where to start.

my setup is as follows.
I have a raspberry pi ( OpenHAB-DB) that monitors my alarm via the alarm panel Output relays.
this is done with 4 GPIO of the PI.
pin 1 = Arm away
pin 2 = Arm Stay
pin 3 = Burglary ( Pulsed out 1s/1s)
pin 4 = Panic ( Pulsed out 1s/1s)
how I have it currently is as items and sitemap. and statuses is sent directly from node red. as links.

Alarm.items

Switch  Armed_1                "ARMED Away"                                                                (Alarm)                                         
Switch  Stay                   "ARMED Stay"                                                               (Alarm)                                      
Switch  Break_in               "Buglery"                                                                   (Alarm)                                                                              
Switch  Fire                   "Fire"                                                                      (Alarm)                                                                                
Switch  Panic                  "Panic / Duress" 

Sitemap

         Default item=Armed_1   label="ARMED Away" 
         Default item=Stay label="ARMED Stay"
         Default item= Break_in  label="Buglery" icon="lightbulb"
         Default item=Fire  label="Fire" icon="lightbulb"
         Default item=Panic label="Panic / Duress" icon="arduino"

And this gives me the following .

what I want to have on my site map is one item

String item=Alarm Status  label= "Alarm Status"

now I need to get the statuses to that item.(Armed Away / Armed Stay / Disarmed / Panic / Burglary )
what would you guys sagest I do.

  1. use node red direct ?
  2. use MQtt
  3. Write Rules to do it.

If openHAB runs on the RPi to have its GPIOs connected then just use the proper GPIO binding.
If it’s different devices use MQTT. Rules you don’t need for this simple mapping purpose.

it is a remote DB In the master bedroom Cabord where the alarm panel is situated. so I will then go for the MQTT way. thank you for the reply.

I thought you already had these Items in openHAB, and just needed to umm collate them. Rules are meant for that. I’m not sure how MQTT - which just shovels data from here to there - could help with that.

You didn’t say, but I guess you wouldn’t want this master status pulsing like some of the onputs do? So there will be some timing element to do.

I think I would create extra Items like Panic_static. A little rule would run if Panic changes to ON and the rule would update Panic_static to ON.
Panic_static would be set up with the expire binding so that it falls back to OFF state after say 3 seconds since the last update.
That will convert the pulsing inputs to a nice steady state.

Now we just need a rule triggered by a group member change, that group containing all of the steady-state conditions.
The rule can have a default string “disarmed”, and examine each input Item in ascending priority order to change the string if needed, finally updating your master status Item.

use to run openhab on the pi and hade them conected and used the gpio binding. but moved openhab over to my server in workshop.and created the remote DB.

I just want to be Abel to see what the alarm status is .

I have only started with writing rules. now. so I am still learning.
but I am getting there

I am going to spend some time on this , this weekend. and will past some configs here. for feedback. once done I can create a tutorial on haw to do it and will upload it.

ok so I have my signals from my pi coming through .on MQTT

Part 1:

so I get
/OpenHAB-DB/alarmstat/

  1. Armed-Away
  2. Armed-Stay
  3. Burglary
  4. Panic-Duress

Part 2 : DONE .

step 3 : DONE

ok so I did it all. but in a complete different way.
I used node red on the PI to do the most of the work.

so now I get the alarm status directly to my openhab. from mqtt.

all I need to do is create a rule that will broadcast status changes to my iOS app and then also have the information logged to a log file. something like Alarm.log.
to keep records of the alarm status changes.

hi guys. I have come to a point that I got stuck.
in my rule I want open had to broadcast the alarm status once it happens. it pushes it to the iOS app. but seems I am missing something. I am only starting with rules now. so I am a noob on them.

can you guys have a look and steer me in the right direction…

rule "Armed-Away"
when
	Item Alarm_Status changed from Disarmed to Armed-Away 
then
	// do something
   sendBroadcastNotification("Alarm Armed Away")	
end

rule "Burglary"
when
	Item Alarm_Status changed to Burglary 
then
	// do something
   sendBroadcastNotification("Break-IN")	
end

rule "Panic-Duress"
when
	Item Alarm_Status changed to Panic-Duress 
then
	// do something
   sendBroadcastNotification("Panic-Duress")	
end

rule "Disarmed"
when
	Item Alarm_Status changed  to Disarmed
    

then
	// do something
   sendBroadcastNotification("Alarm Disarmed")	
end

So are we. What doesn’t happen, or does happen that you don’t expect?

I do think there is a problem with your rule triggers. Is Alarm_Status a String type Item?

when
   someItem changed to "testString"

You could pretty much do the same thing with one rule

rule "alarm notify"
when
	Item Alarm_Status changed
then
	// do something
   sendBroadcastNotification("Alarm " + Alarm_Status.state.toString)	
end

Hi rossko57
sorry about the lacformation. here is some more .

my Alarm Item :

String  Alarm_Status            "Alarm Status"                                          {channel="mqtt:topic:mosquitto:Alarm_Stat:alarm_status"}

My Alarm Status on Sitemap :

 Default item=Alarm_Status label="Alarm Status"

I receive notifications on my iPhone . and want the alarm status to be sent to to my ios app . when the alarm status changes. ( I got the system monitoring to work that sends a online / offline when my remote db drops off. )
but can’t get the alarm one to work.

Thanks for the simple rule. will check using it.
thanks for the help

sorry all . one more question. can i add time to the notification sent to my iphone.

that the notification have a time assigned to when i received the notification ?

Well, that is just building a string from parts, so all you need is to add another part.
now is a convenient system variable.

sendBroadcastNotification("Alarm " + Alarm_Status.state.toString + now.toString)

thank you

Tip- the toString method of now can be given a format e.g.
now.toString("MM/dd HH:mm ")