• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
alarm system using pilight
#1
Hello,

I want to re-use existing PIR sensors from an old alarm system for a rasperry pi 2 based alarm system based on pilight.

As an example, from pilight-receive I get for one of the sensors:

{
"message": {
"id": "A0",
"unit": 1,
"state": "off"
},
"origin": "receiver",
"protocol": "clarus_switch",
"uuid": "0000-b8-27-eb-cdfed5",
"repeats": 1
}

Now I've got a little bid stuck on how to model the rules in the config.json in order to process events from the PIR sensors. The goal is that a pushover notification should be sent when I receive the above message from the PIR sensors. What I do not understand is the PIR sensor sends an "off" state so how can I make use of it to trigger the pushover notification.

The relevant, not working section of the config.json are pasted here:

{
"devices": {
"pir_entrance": {
"protocol": [ "clarus_switch" ],
"id": [{
"id": "A0",
"unit": 1
}],
"state": "off"
},
"pir_living": {
"protocol": [ "clarus_switch" ],
"id": [{
"id": "A0",
"unit": 2
}],
"state": "off"
}
},
"rules": {
"pir_entrance_makealarm": {
"rule": "IF pir_entrance.state IS off THEN pushover TITLE Alarm Eingang MESSAGE Alarm Eingang TOKEN xxx USER yyy@gmail.com
"active": 1
},
"pir_living_makealarm": {
"rule": "IF pir_living.state IS off THEN pushover TITLE Alarm Wohnzimmmer MESSAGE Alarm Wohnzimmer TOKEN xxx USER yyy@gmail.com
"active": 1
}

},
"gui": {
"pir_entrance": {
"name": "PIR Eingang",
"group": [ "Home" ],
"media": [ "all" ],
"readonly": 1
},
"pir_living": {
"name": "PIR Wohnzimmer",
"group": [ "Home" ],
"media": [ "all" ],
"readonly": 1
}
},

Appreciate if you can provide some guidance on to how to correctly model the config.json.

Thank you.
 
Reply
#2
Welcome to the forum.

We have some rules here and would appreciate to adhere to them.
1. Please read the Help files for how to format postings (in your case i am missing the usage of tags).
2. Have you checked the details of the eventing subsystem and checked the forum for details on how to implement monitoring tasks using rules (Crucial is to fully understand the handling and implementation of True or False conditions as described on the 2nd page of the manual for eventing) ?

A hint: You want to monitor an event, e.q. a status change (from ON to OFF) .... and not a status (OFF), and that's what the eventing subsystem supports.
 
Reply
#3
Sorry, wo_rasp, for not having been compliant with the forum rules. I will adhere to the rules next time. Promised. But I just was trying to find out how to set a tag when posting a new query? Advices appreciated.

I had thoroughly studied the manual, hoping to find a solution for my issue. Re your reply, I only receive the "off" state via the pilight-receive tool as I have listed in my initial post. So, there is a message actually coming in from the PIR sensors. However, it is not a status change, i.e. as you mentioned from something like "on" to "off" or vice versa, so perhaps not something I can use to trigger an event. It is just a simple "off" signal, so I was wondering if pilight is able to trigger an event just on that message being received.

Thanks again.
 
Reply
#4
Not next time, fix the post you already did...

There is a help page that has all information.
 
Reply
#5
@rbrueckner: you can trigger an action using any received signal, like this:
Code:
"rule1": {
            "rule": "IF elro_800_switch.state IS on AND elro_800_switch.systemcode == 19 AND elro_800_switch.unitcode == 2 THEN switch DEVICE switch1 TO on",
            "active": 1
        }
where the "elro_800_switch" is the protocol name and not a registered device.
Maybe this helps.
And yes, please do use code tags, this makes it ways simplier to read the code Smile
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  pilight service not starting vlatko.jordanov 2 647 05-26-2018, 01:42 PM
Last Post: vlatko.jordanov
  tabs on pilight SeLi 5 2,583 05-31-2017, 09:25 PM
Last Post: NormBot
  Dimlevel to set Alarm Clock Jonsibua 3 1,291 02-10-2017, 05:38 AM
Last Post: terrar
  Rules make pilight freeze koos147 5 2,062 05-04-2016, 08:11 PM
Last Post: curlymo
  Raspberry Freeze when starting pilight sunny20k17 2 1,349 03-18-2016, 12:29 PM
Last Post: sunny20k17
  pilight eventing rules terrar 94 40,053 02-18-2016, 10:21 PM
Last Post: brombeerwilli
  pilight after reboot SeLi 5 3,433 01-06-2016, 08:20 PM
Last Post: SeLi
  Confusion/possible bug in pilight tomza 3 2,112 11-06-2015, 05:40 PM
Last Post: pilino1234
  pilight eventing - sunset/sunrise/time Niek 14 11,108 04-27-2015, 05:20 PM
Last Post: troccolo
  Trigger a one-shot device from pilight Karel 5 3,285 03-12-2015, 03:54 PM
Last Post: martinr

Forum Jump:


Browsing: 1 Guest(s)