Using Webcore with $twcweather.conditions.cloudCoverPhrase


#1

New to webcore. I can not get $twcweather.conditions.cloudCoverPhrase to work as expected.

When the switch gets turned on the speaker will say “Please consider opening the curtains to save electricity” once a day only if it is clear/partly cloudy and if it is between sunrise and sunset.

I want this action to only happen when it it clear or partly cloudy out but everything comes back as false. Yes i do try this on clear/partly cloudy days lol.

7/20/2020, 2:15:51 PM +545ms
+1ms ╔Received event [Delilah's Room Main Lights].switch = on with a delay of 51ms
+37ms ║RunTime Analysis CS > 16ms > PS > 4ms > PE > 16ms > CE
+39ms ║Runtime (40765 bytes) successfully initialized in 4ms (v0.3.110.20191009) (38ms)
+40ms ║╔Execution stage started
+69ms ║║Comparison (time) 51351589 is_between (time) 1595240520000 .. (time) 1595294280000 = true (8ms)
+70ms ║║Time restriction check passed
+72ms ║║Condition #5 evaluated true (28ms)
+78ms ║║Comparison (integer) 20 is_different_than (integer) 1 = true (1ms)
+79ms ║║Condition #13 evaluated true (6ms)
+80ms ║║Cancelling condition #1's schedules...
+81ms ║║Condition group #1 evaluated true (state changed) (37ms)
+86ms ║║Comparison (enum) on is (string) on = true (1ms)
+87ms ║║Cancelling condition #10's schedules...
+88ms ║║Condition #10 evaluated true (6ms)
+89ms ║║Condition group #1 evaluated true (state did not change) (7ms)
+213ms ║║Calculating (string) Partly Cloudy + (string) Clear >> (string) Partly CloudyClear
+215ms ║║Comparison (dynamic) null is (string) Partly CloudyClear = false (1ms)
+217ms ║║Condition #11 evaluated false (126ms)
+222ms ║║Calculating (string) Partly Cloudy + (string) Partly Cloudy >> (string) Partly CloudyPartly Cloudy
+226ms ║║Comparison (dynamic) conditions:cloudCeiling:null, cloudCoverPhrase:Partly Cloudy, dayOfWeek:Monday, dayOrNight:D, expirationTimeUtc:1595269268, iconCode:30, iconCodeExtend:3000, obsQualifierCode:null, obsQualifierSeverity:null, precip1Hour:0.00, precip24Hour:0.00, precip6Hour:0.00, pressureAltimeter:29.98, pressureChange:0.02, pressureMeanSeaLevel:1016.1, pressureTendencyCode:1, pressureTendencyTrend:Rising, relativeHumidity:50, snow1Hour:0.0, snow24Hour:0.0, snow6Hour:0.0, sunriseTimeLocal:2020-07-20T06:21:28-0400, sunriseTimeUtc:1595240488, sunsetTimeLocal:2020-07-20T21:18:53-0400, sunsetTimeUtc:1595294333, temperature:78, temperatureChange24Hour:-2, temperatureDewPoint:58, temperatureFeelsLike:80, temperatureHeatIndex:80, temperatureMax24Hour:81, temperatureMaxSince7Am:78, temperatureMin24Hour:64, temperatureWindChill:78, uvDescription:Very High, uvIndex:8, validTimeLocal:2020-07-20T14:11:08-0400, validTimeUtc:1595268668, visibility:10.000, windDirection:290, windDirectionCardinal:WNW, windGust:null, w...[TRUNCATED]
+227ms ║║Condition #12 evaluated false (10ms)
+228ms ║║Condition group #6 evaluated false (state did not change) (138ms)
+230ms ║║Cancelling statement #8's schedules...
+233ms ║║Executed virtual command setVariable (0ms)
+236ms ║╚Execution stage complete. (195ms)
+237ms ╚Event processed successfully (236ms)

#2

Use this with ‘Partly Cloudy’ and ‘Clear’

image


#3

image


#4

I agree with @Pantheon… I am not a fan of using ONLY WHEN…

Here is how I would do it:

It grabs the cloud data each time the switch turns on… (and logs to console, for record keeping), but will only continue if the time is right, and only once a day. I also used an extra variable, so you can always see exactly what webCoRE saw at the last execution, and so we only have to make that TWC query once.


#5

I agree with @WCmore. I too am not a fan of ONLY WHEN. I only included the ONLY WHEN example to avoid confusion with the original posted code.


#6

Thanks for the help! much appreciated!