Weather integration


1) Give a description of the problem
I am trying to define variables for the weather

2) What is the expected behaviour?
I want to define “CurrentlyHumid” variable as = ($twcweather.conditions.relativehumidity)

3) What is happening/not happening?
I test it by writing the piston to greater than 90 (should be false) and it stays true.

4) Post a Green Snapshot of the pistonimage

**5) Attach logs after turning logging level to Full**
11/17/2021, 2:48:01 PM +51ms
+1ms ╔Received event [Home].test = 1637182081050 with a delay of 0ms
+40ms ║RunTime Analysis CS > 20ms > PS > 6ms > PE > 14ms > CE
+42ms ║Runtime (36949 bytes) successfully initialized in 6ms (v0.3.110.20191009) (40ms)
+44ms ║╔Execution stage started
+326ms ║║Comparison (boolean) true is (boolean) true = true (2ms)
+328ms ║║Condition #2 evaluated true (279ms)
+329ms ║║Condition group #1 evaluated true (state did not change) (281ms)
+332ms ║║Cancelling statement #3's schedules...
+351ms ║║Executed physical command Switch 6].on() (13ms)
+353ms ║║Executed [Switch 6].on (15ms)
+358ms ║╚Execution stage complete. (314ms)
+359ms ╚Event processed successfully (359ms)`Preformatted text`


What is the output if you log to console…


Just a guess that the info you’re getting back is formatted string, so I’d suggest trying to wrap the output in int() before making the gt() comparisson.


Admittedly I’m a bit green with coding and may not be fully in the loop with terminology. So i’m not sure how to answer the output question or how to check.
I think i understand your int() point and will attempt now.


gt(int($twcweather.conditions.relativeHumidity), '90')

Edit: Also, I’m curious if you should remove the quotes from the 90 so it doesn’t get treated as a string.


It worked! Thank you! However, upon saving i receive this message.



Your piston does not have a trigger, it will only run if another piston calls it or if you subscribe to a device event that will cause the piston to run.

Some reading here…


If the defined variable “changes to” true…That is what i thought the trigger is.


If the defined variable “changes to” true…


What will trigger the variable’s value to update?


I suppose my assumption was it runs a check ever so often. Hmm? Back to the drawing board. Thanks for the help with the integer


In this case it won’t, but you can set a timer that will poll for changes to that particular data you want.