• 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
when signal income run script

i am an absolute pilight beginner. just managed to successfully set it up and get it running (both sending and receiving).

but i am stuck. is there a way to trigger a (python) script whenever a certain uuid sends a signal? in this case, this is a wireless doorbell and i am trying to get notified via a custom script whenever somebody rings it.

while i do understand how i can automate sending signals (just put pilight-send -p protocol options in my script), i did not manage to figure out how to constantly wait for a certain incoming signal and then running my script.

(hope i have described this problem in an understandable way. not a native english speaker)

thanks in advance Smile
Have a look at the example pilight clients in the pilight repo here: https://github.com/pilight/pilight/tree/master/clients. The python example is written in python2, but the code is similar for python 3.

The relevant section is this one: https://github.com/pilight/pilight/blob/...py#L73-L80. In this part, the script enters an infinite loop and receives packets from the pilight daemon. These are then split into individual messages, which are then printed.
Instead of printing, you need to `json.loads()` the decoded data and check the returned dict for the id of your device.

See also the pilight documentation of the API, to avoid having hacks like calling "pilight-send -blabla" from scripts if there is a better solution: https://manual.pilight.org/en/api

Possibly Related Threads...
Thread Author Replies Views Last Post
  Problem with executing bash script via rule/program dYna 1 1,077 02-15-2018, 09:06 PM
Last Post: dYna

Forum Jump:

Browsing: 1 Guest(s)