Need some help on how to make "if-else" eval of incoming signal, or if anyone have any better ideas they are of course welcome as well
Background:
Idea is to use a 1-wire RFID-reader and RFID keyfobs to keep track of family members coming home and leaving and use Automagically to enable "away" or "home" mode which includes power on/off for IP-cameras and recording, whether lightningschedules should be active or not. This works as of today with my setup but i have to use mobile phone to turn on/off and can not track who turned it on/off.
I have set up an 1-wire RFID-reader which emulates Dallas ibutton to a small openwrt-router in client-mode which works as owserver. For simplicity I used owfs to mount 1-wire units on my raspberry from remote owserver. When I hold keyfob in front of RFID-reader a folder with id-file is mounted on raspberry, when I remove it folder dissapears within 2 min. I then use datafetcher to read id from id-file and this shows in Automagically signal feed.
Since same RFID is supposed to both turn ON and OFF group devices and change variables my approach is to use Treshold function, below 5 and above 5 for instance so that if "away"-variable is set to 0 someone is home and if set at 10 everyone is away, this makes it possible for the same RFID to trigger ON/OFF when passing "5". This also works when i manually set signal parse-result to 0 or 10 !
So far so good! But now I need som help since I am not familiar with Python and not particularily skilled in coding in general: When parsing signal i simply go
Code: Select all
parse_away:1
Code: Select all
parse_away:10
However I would like to do
Code: Select all
parse_away: if GVaway>5 then 0 else 10
Help and comments are very much appreciated!