Hi
Can I ask you a question about rules, data from HTTP and calculations?
In
openremote I have some rules with using data and making calculations.
Als some rules about retreiving data via an HTTP API request and putting
it in a log. The rules with calculations are working with data from my
Velbus system. Now I want to make a new other rule to use data from an
API request. But there is a problem
I have trouble with the rule below. Everything works, except for the last two rules.
With this request command :
$.daily.data[0].precipIntensity
I get 0.0686 from this api file:
---- section from JSON api request---
daily |
|
summary | "De hele week lichte regen met temperaturen stijgend tot 11°C op zaterdag." |
icon | "rain" |
data |
|
0 |
|
time | 1549234800 |
summary | "Zwaar bewolkt gedurende de dag." |
icon | "cloudy" |
sunriseTime | 1549264639 |
sunsetTime | 1549298135 |
moonPhase | 0.99 |
precipIntensity | 0.0686 |
------
With a Custon state sensor I get that number, and put that number in other virtual memories with %s format. That works.
But when I try to sum up these numbers, it does nothing.
There is no error in boot.log, velbus.log or drools.log.
Just a zero as a result for this new virtual value.
Any suggestions on how i can calculate with these numbers in a rule?
Any help is welcome,
Thank you
Richard
Names with EC are a virtual input command
Names with (E)SE are a (virtual) sensor
rule "B2 Bewatering – doorschuiven gevallen regen per dag en invullen vandaag"
timer (cron:2 31 3 * * ?)
when
Event( source == "035_04_EST_SE_WATERSYSMETHTTPSW", value == "on" )
CustomState (source == "035_04_ESE_REGENA", $tKB01 : value);
CustomState (source == "035_04_ESE_REGENB", $tKB03 : value);
CustomState (source == "035_04_ESE_HTTP_VANDAAGREGEN", $tKB05 : value);
then
double correctedValueKB04 = Double.parseDouble($tKB03.toString());
execute.command("035_04_EC_REGENC",String.format("%s",correctedValueKB04));
double correctedValueKB02 = Double.parseDouble($tKB01.toString());
execute.command("035_04_EC_REGENB",String.format("%s",correctedValueKB02));
double correctedValueKB06 = Double.parseDouble($tKB05.toString());
execute.command("035_04_EC_REGENA",String.format("%s",correctedValueKB06));
double correctedValueKB07 = (correctedValueKB02 + correctedValueKB04 + correctedValueKB06);
execute.command("035_04_EC_REGENSOM",String.format("%s",correctedValueKB07));
end