Possible bugg OpenWeatherMap-Alerts ultravioletIndex

bug

#1

Im using the OpenWeatherMap-Alerts with the attribute ultravioletIndex
A typical value of ultravioletIndex could be 0.64.
In webcore all values of ultravioletIndex less than 1 is presented as 0, so 0.64 equals 0
If the value of ultravioletIndex is 1 ,it is presented as 1
In hubitat device, the value of attribute ultravioletIndex is presented with 2 decimals.
in rule machine it is presented with 2 decimal. and there is no problem to set a decimal variabel with the number of 0.64 from the attribute of OpenWeatherMap-Alerts ultravioletIndex


#2

You can try casting the data to decimal(OpenWeatherOutput)


#3

Hi
"ultravioletIndex = "decimal([OpenWeatherMap-Alerts : ultravioletIndex])
gives the result
ultravioletIndex = 1
so it is a numeric value

the value of the device in hubitat is
ultravioletIndex : 1.23


#4

I get the same, maybe @E_Sch can suggest workaround.


#5

Can I see the piston & full logs for this?

What do you get if you assign to a decimal value the device:attribute ?

I’ll try to look more at this tomorrow when my weather gives me something other than 0

Another choice while I look at this is using open weather integrated with webcore (webcore storage)

I think the field is called uvi

See: https://community.hubitat.com/t/webcore-for-hubitat-updates/11967/3


#6

execute
if
{[OpenWeatherMap-Alerts : ultravioletIndex]} changes{when true
Log info "{"ultravioletIndex = “[OpenWeatherMap-Alerts : ultravioletIndex]}”;
}
end if;
end execute;

10/8/2023, 1:31:26 PM +568ms
+5ms ╔Received event [OpenWeatherMap-Alerts].ultravioletIndex = 1.15 with a delay of 898ms, canQueue: true, calledMyself: false
+385ms ║RunTime initialize > 384 LockT > 2ms > r9T > 362ms > pistonT > 360ms (first state access 5 m:20 16 368)
+404ms ║Runtime (6386 bytes) initialized in 362ms (v0.3.114.20230828_HE)
+407ms ║╔Execution stage started
+550ms ║║Comparison (dynamic) 1 changes = false (1ms)
+552ms ║║Condition #2 evaluated false (131ms)
+554ms ║║Condition group #1 evaluated false (condition did not change) (134ms)
+572ms ║╚Execution stage complete. (164ms)
+659ms ╚Event processed successfully (655ms)

expression
[OpenWeatherMap-Alerts : ultravioletIndex]
gives
1
decimal([OpenWeatherMap-Alerts : ultravioletIndex])
gives
1
The trigger was that uvi changed from 1.31 to 1.15,


#7

It would be helpful to post a green snapshot and screen shots of the logs

See:

The reason for this is it is easier if I import your piston for testing. The problem could be many things including the piston code itself.


#8

10/8/2023, 2:31:25 PM +952ms
+4ms ╔Received event [OpenWeatherMap-Alerts].ultravioletIndex = 0.83 with a delay of 485ms, canQueue: true, calledMyself: false
+91ms ║RunTime initialize > 90 LockT > 1ms > r9T > 80ms > pistonT > 78ms (first state access 4 m:9 5 85)
+94ms ║Runtime (10191 bytes) initialized in 80ms (v0.3.114.20230828_HE)
+97ms ║╔Execution stage started
+166ms ║║Comparison (dynamic) 0 changes = true (0ms)
+185ms ║║Calculating (string)ultravioletIndex = + (string)0 >> (string)ultravioletIndex = 0
+188ms ║║ultravioletIndex = 0
+191ms ║║Executed virtual command log (3ms)
+221ms ║║0
+225ms ║║Executed virtual command log (5ms)
+228ms ║║Condition #2 evaluated true (126ms)
+231ms ║║Condition group #1 evaluated true (condition changed) (129ms)
+239ms ║║Calculating (string)ultravioletIndex = + (string)0 >> (string)ultravioletIndex = 0
+242ms ║║ultravioletIndex = 0
+244ms ║║Executed virtual command log (2ms)
+253ms ║║0
+256ms ║║Executed virtual command log (3ms)
+263ms ║╚Execution stage complete. (165ms)
+276ms ╚Event processed successfully (272ms)


#9

are you using the built-in version in hubitat or a user install?

I think I see the issue and will post an update later today


#10

I have posted an update for the user install

I have asked the HE folks to pickup this release for their next build for built-in


#11

Thanks, the Webcore update worked.

10/9/2023, 9:31:39 AM +848ms
+4ms ╔Received event [OpenWeatherMap-Alerts].ultravioletIndex = 0.57 with a delay of 391ms, canQueue: true, calledMyself: false
+778ms ║RunTime initialize > 776 LockT > 1ms > r9T > 764ms > pistonT > 747ms (first state access 7 m:11 5 771)
+781ms ║Runtime (10266 bytes) initialized in 764ms (v0.3.114.20231008_HE)
+783ms ║╔Execution stage started
+791ms ║║Comparison (decimal) 0.57 changes = true (0ms)
+800ms ║║Calculating (string)ultravioletIndex = + (string)0.57 >> (string)ultravioletIndex = 0.57
+803ms ║║ultravioletIndex = 0.57
+806ms ║║Executed virtual command log (3ms)
+813ms ║║0.57
+815ms ║║Executed virtual command log (2ms)
+817ms ║║Condition #2 evaluated true (29ms)
+820ms ║║Condition group #1 evaluated true (condition changed) (32ms)
+828ms ║║Calculating (string)ultravioletIndex = + (string)0.57 >> (string)ultravioletIndex = 0.57
+830ms ║║ultravioletIndex = 0.57
+833ms ║║Executed virtual command log (3ms)
+841ms ║║0.57
+843ms ║║Executed virtual command log (3ms)
+850ms ║╚Execution stage complete. (66ms)
+856ms ╚Event processed successfully (853ms)