Setting variable from sensor attirbute and sending as push notification


(ilker Aktuna) #1

Hi,

I want to create a variable from a sensor attribute and then send it with a push notification.
my piston has 2 actions:

  1. “save attribute to variable” shows as:
    Save attribute ‘calling’ to variable {calling}
  2. “send push notification” shows as:
    Send Push notification ‘Test {calling}’

But all I receive as notification is ‘Test’

I don’t know if I have to define variable calling elsewhere.
Can anyone please tell me where am I doing wrong ?
what’s missing ?

thx


(Robin) #2

I think that your problem may be that CoRE calculates and queues up all actions at the same time, therefore at the time of building the notification, the variable is still null.

Can you post a screenshot of the whole piston (dashboard view) and the save attribute action setting page itself, so I can see where ‘calling’ is coming from / triggered.

You may need to do this in seperate Pistons using global variables. But I’ll advise further from the screenshots.


(Kurt Sanders) #3

I use a Basic CoRE Piston with a SmartThings contact switch that has a temperature attribute. The contact monitors the temperature of our hot tub mechanicals area, mostly in the winter time & when we travel, to ensure the hot tub is online and staying heated. I also grab the outside weather using the AccuWeather SmartApp for comparison.

One could either set a CoRE timer to fire every 5 minutes or use the condition of “changes” which will send a reading value at every different temperature level and then route the digital output as I do below to an email, notification or as a SMS text as below.

CoRE Piston

IF
● Hot Tub Temp temperature changes
THEN...
Using Hot Tub Temp...
► Save attribute 'temperature' to variable {temperature}'
Using AccuWeather (45385)...
► Save attribute 'temperature' to variable {outside_temp}'
Using location...
► Send SMS notification 'Hot Tub Inside Mechanicals temperature is {temperature}°F and outside temperature is {outside_temp}°F' to 555-555-5555

SMS Message Log

Hot Tub Inside Mechanicals temperature is 69°F and outside temperature is 37°F
Hot Tub Inside Mechanicals temperature is 68°F and outside temperature is 36°F
Hot Tub Inside Mechanicals temperature is 67°F and outside temperature is 36°F
Hot Tub Inside Mechanicals temperature is 66°F and outside temperature is 35°F
Hot Tub Inside Mechanicals temperature is 65°F and outside temperature is 33°F


(ilker Aktuna) #4

Thanks for your reply.

Actually when I entered “First” as the aggregate parameter , the notification became correct (shows the value of parameter)

Is this parameter , a mandatory one ?


(Kurt Sanders) #5

I use Last, which I think sends the LAST value read by the sensor!.


(Alan) #6

CoRE Example - Setting Variable From Sensor and Sending Push Notification

In this example, I use the ‘bulbEval’ variable to capture the true/false evaluation result of a bulb. It could easily be a sensor too.

Piston Mode: Basic

Requires:
1 device

And you set the variable ‘bulbEval’ to capture the state: