webCoRE - Sensor unavailable status


(Florin Angelescu) #1

Hi there,

I am trying to create a piston that will warn me whenever a sensor changes it’s status to “unavailable” in order to fix these kind of issue quickly.
I am not sure how to use this attribute and what exactly its code should be.

Does someone has experience with this?

Thank you in advance,
Florin


( I hate Mondays) #2

Yeah, there is a pseudo attribute in webCoRE called $status - just be aware that there is no way right now to get events when the values change, like you would with regular attributes. So you’d need a timer

define
   device devs;
end define;

every 5 minutes do
   if
      any of (add many devices here)’s $status is not ‘ONLINE’ (save matching list to variable devs)
   then
      Send notification “{devs} are offline”
   end if;
end every;

This is a very basic solution - you probably want a notification when the list changes, not every five minutes, but that’s good enough to get you started.

Mult succes


(Florin Angelescu) #3

Hello,

Thank you for the quick reply. The example you sent is very useful.

Multumesc mult!


(Bartek) #4

Hey @ady624

I tried your example but it is not always working fine as some of devices doesn’t use “ONLINE” status, but “ACTIVE”

Is that modification correct:

$status is not any of 'ONLINE|ACTIVE'

Basically or should it be "is not any of ‘ONLINE&ACTIVE’ " ??


( I hate Mondays) #5

You need to use a comma separated list. 'ONLINE,ACTIVE'


(Bartek) #6

Thanks man.