Page 1 of 1

How do I safeguard against receiver error (RFXtrx/Tellstick)

Posted: Tue Feb 10, 2015 8:52 am
by Mastiff
In both my home and cabin setup I sometimes (maybe once a month, maybe a bit less) have the receivers fail (maybe because I'm running a virtual machine). Yesterday it hapened just after we went to bed, and at the moment my home office (which should be a nice 20 degrees by 08) is around 17 degrees. Which made me decide that I really need a safeguard against this. It's fixed by restarting EG or in a worst case scenario to restart the VM. But of course restarting every hour or so is just dumb. I have a few sensors that fall out and then get back again every now and then, so I would like not to use "lost contact with sensor" for that. But maybe it would be possible to use the main script for heat control? I made one with good help a few weeks back. It takes the input from every temp sensor in the house, checks if the temp is within the parameters (set in a startup script) and then acts accordingly. Here's the full script:

Code: Select all

#Sjekke om det er en Viking-sensor
if (eg.eventString.split(' ')[1]) == "Viking":
    
    #Finne rommet sensoren kommer fra ved hjelp av tabellen i oppstartsskriptet
    Rom = eg.globals.Romkonvertering[int(eg.eventString.split(' ')[4])]
    
    #Skille ut temperatur og signal fra payload
    eg.globals.Romtemperatur[Rom] = float((eg.event.payload.split(' ')[2]))
    eg.globals.Signal[Rom] = (eg.event.payload.split(' ')[6])

#Skrive ut rommet i loggen for lettere å kunne se hvilke sensorer som er hva
#print (Rom)

#Skrive ut de utskilte verdiene for debugging når det trengs
#print (Romtemperatur,Romsignal)

#Hente inn og formatere tidspunkt og dato etter norsk system
eg.globals.Tid[Rom] = eg.Utils.time.strftime("Kl. %H:%M, den %d.%m.", eg.Utils.time.localtime())

#Skrive ut den formaterte tiden for debugging når det trengs
#print (eg.globals.Tid[Rom])

#Sjekke om det er dag, natt eller frostvakttemperatur og velge termostattemperatur ut fra det
#Avslutte sccript hvis modus er 0, altså av
if eg.globals.Termostatmodus[Rom]  == 0:
    eg.globals.Termostatemperatur[Rom] = 'Av'
    eg.globals.NettsideOvn[Rom] = 'av.jpg' #Vise ovn på for Nettsideserver
    print "%s.: Temperatur: %s, termostatmodus: %s, tidspunkt: %s\n"%(Rom,eg.globals.Romtemperatur[Rom],eg.globals.Termostatemperatur[Rom], eg.globals.Tid[Rom])
    eg.Exit()

if eg.globals.Termostatmodus[Rom]  == 1: eg.globals.Termostatemperatur[Rom] = eg.globals.Temp1[Rom]
if eg.globals.Termostatmodus[Rom]  == 2: eg.globals.Termostatemperatur[Rom] = eg.globals.Temp2[Rom]
if eg.globals.Termostatmodus[Rom]  == 3: eg.globals.Termostatemperatur[Rom] = eg.globals.Temp3[Rom]
if eg.globals.Termostatmodus[Rom]  == 4: eg.globals.Termostatemperatur[Rom] = eg.globals.Temp4[Rom]

#Printe rommet, modusen, termostatemperaturen og den aktuelle temperaturen i loggeren
print "%s.: Temperatur: %s, termostatmodus: %s, termostattemperatur: %s, tidspunkt: %s\n"%(Rom,eg.globals.Romtemperatur[Rom],eg.globals.Termostatmodus[Rom],eg.globals.Termostatemperatur[Rom], eg.globals.Tid[Rom])

if eg.globals.Romtemperatur[Rom] < (eg.globals.Termostatemperatur[Rom]-0.5): #Her sjekkes det om det er mer enn 0,5 grader under termostattemperaturen
    #print('Ovn på') #Printe om ovnen slås på for debugging
    (eg.globals.OvnPaa (Rom))
    eg.globals.NettsideOvn[Rom] = 'paa.jpg' #Vise ovn på for Nettsideserver
    
if eg.globals.Romtemperatur[Rom] > (eg.globals.Termostatemperatur[Rom]+0.5): #Her sjekkes det om det er mer enn 0,5 grader over termostattemperaturen
    #print('Ovn av') #Printe om ovnen slås av for debugging
    eg.globals.OvnAv (Rom)
    eg.globals.NettsideOvn[Rom] = 'av.jpg' #Vise ovn på for Nettsideserver
Can somebody please help me put in some kind of routine that restarts the VM when there has been no sensor input for maybe five minutes? I could do one minute, since they come in every ten seconds or so, but since they are split between the Tellstick and the RFX at the cabin, with only a few sensors for the Tellstick, I'd go for five minutes. In that time both the RFXtrx and TellStick always gets sensor input.

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 1:03 pm
by krambriw
That's maybe one way of doing it but I have another thought...

Why not define a 'dummy non-existing lamp' and send a command either via the TellStickDuo or the RFXtrx. The command should be captured by the other, then you now the loop is closed and everything is ok. If not, well, then something is wrong and you could perform some action.

- better send the commands with some retries
- you can set the timeout internally (after five retries with 30 seconds in between or whatever)
- maybe is not necessary to restart the VM, maybe is enough to disable/enable the plugins for the receivers

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 1:08 pm
by Mastiff
Smart idea, with event tennis! :D But the problem is that I run only the RFXtrx at home, so there it wouldn't work there. I may some day expand with an extra Tellstick (I have that option open), but for now I can cover everything with just the RFXtrx because it's in the attic in the middle of the house, with a shorter distance to everything even though the house is a lot bigger than the cabin.

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 1:16 pm
by krambriw
OK, I see,,,lets think about another idea...
What if there was an action that checks the status of the RFXtrx, if it responds correctly we would know it is alive and the connection is up?

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 1:20 pm
by Mastiff
That would be very, very nice, yes! :D Even the same on the NetHomeServer plug-in. Would it be possible to have one checking for received events as well? "If no events received in 5 minutes, then..."? That would also catch errors that doesn't show internally in the RFX. I remember I have had somehting like that last fall. I saw "connection lost" with all the sensors, one after one, but I was still able to send commands from the RFX.

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 1:59 pm
by krambriw
I think the best would be to add a self monitoring of the device into the plugin. There would then be an event generated if the device connection is lost that can be used to perform other actions (like reboot, disable/enable plugins etc)

- for the RFXtrx this is rather straight forward since I am communicating with it directly
- for the TellStickDuo (when used with the plugin) I can only communicate with Telldus Center so I cannot know the actual device status I think (unless there is support for something useful in the api)
- for NetHome with direct control of the TellStickDuo, similar as above, I have no direct communication with the device so I have to see if NetHome supports anything via the api that I can use
Would it be possible to have one checking for received events as well? "If no events received in 5 minutes, then..."?
This monitoring functionality is supported by both the TellStickDuo and the RFXtrx plugins. I assume you want this in the NetHome plugin as well?
I saw "connection lost" with all the sensors, one after one, but I was still able to send commands from the RFX.
Yes, even if you lost sensors does not block sending commands to devices...

Anyway, I think I will start with the RFXtrx plugin...

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 2:39 pm
by Mastiff
Well, sure. If you can make it self monitoring, please do. :D

But where in the RFX plugin is that monitoring functionality found? I can't see it, I'm afraid. And yes, I would like that in the NetHome as well, thanks!

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 4:00 pm
by krambriw
But where in the RFX plugin is that monitoring functionality found?
Once a sensor is recognized, a timer starts for that ID and if no event from the sensor is found during the next 10 minutes, you will get a 'Lost sensor' event in the log. You may try this by starting a sensor and once it is recognized, remove the battery and wait 10 minutes or so...

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 4:08 pm
by Mastiff
Oh, I know that one. I meant one that fired something if no event was received for any sensors at all for a while, not on a per sensor basis, like this function.

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 4:22 pm
by Aquila
Mastiff wrote:Oh, I know that one. I meant one that fired something if no event was received for any sensors at all for a while, not on a per sensor basis, like this function.
You can do this by letting all events from sensors restart the timer.

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 4:39 pm
by Mastiff
OK, so you mean starting/resetting a timer on every receive? I was thinking about that at the beginning, but I was wondering if there was a more elegant solution to it. :)

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 5:10 pm
by krambriw
OK, so you mean starting/resetting a timer on every receive?
Well, in principal but I am using the built eg.scheduler

What could be more elegant!?

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 5:17 pm
by Mastiff
Well, I thought he meant a macro with the timer in it, with all the sensors as triggers. That's what I was trying to avoid.

Re: How do I safeguard against receiver error (RFXtrx/Tellst

Posted: Tue Feb 10, 2015 5:52 pm
by krambriw
Got it

It's all built-in, no user action needed