- Platform information:
- Hardware: RPi 3
- OS: Raspbian
- Java Runtime Environment:
- openHAB version: 2.5.2
Hi,
Apologies in advance as I think this is probably a very obvious one, but I can’t get this to work.
I have two very simple rules that should trigger when the rain volume collected by a weather station changes (open weather binding) to indicate that’s it’s either started to rain, or stopped raining.
The actual Item value changes when it should (I have this persisting to a db each time it changes and I see this getting updated as expected) but the rules don’t fire when I would expect them to.There are no errors in the logs.
If I alter the rule such that is triggered by :-
Item localCurrentRainVolume changed
instead of:-
Item localCurrentRainVolume changed from 0
then the rule fires (but I then can’t tell if it’s just started, or stopped raining, as the change could be from some non-zero value to another non-zero value)
Any thoughts? Is there an obvious synax error?
Thanks
Steve
Thing:-
Bridge openweathermap:weather-api:api "OpenWeatherMap Account" [apikey="<MY-KEY>", refreshInterval=30, language="en"] {
Thing weather-and-forecast local "Local Weather And Forecast" [location="51.348850,-0.512330", forecastHours=0, forecastDays=7]
}
Item:-
Number:Length localCurrentRainVolume "Current rain volume [%.1f %unit%]" <rain> { channel="openweathermap:weather-and-forecast:api:local:current#rain" }
Rules:-
// If it's started to rain and it's at a humane time, tell us
rule "rain started warning"
when
Item localCurrentRainVolume changed from 0
then
logInfo("org.openhab","localCurrentRainVolume changed from 0")
// if we're in
if ( Life360_IsSomeoneHome.state == ON ) {
// Is it a humane time? (9:00am to 22:30)
if( now.millis >= now.withTimeAtStartOfDay.plusHours(9).millis && now.millis < now.withTimeAtStartOfDay.plusHours(22).plusMinutes(30).millis) {
// It's started to rain!
Echo_BigLounge_TTS.sendCommand("It's just started to rain!")
Echo_Kitchen_TTS.sendCommand("It's just started to rain!")
Echo_Bedroom_TTS.sendCommand("It's just started to rain!")
sendBroadcastNotification("It's just started to rain at home")
}
}
end
// If it's started to rain and it's at a humane time, tell us
rule "rain stopped warning"
when
Item localCurrentRainVolume changed to 0
then
logInfo("org.openhab","localCurrentRainVolume changed to 0")
// if we're in
if ( Life360_IsSomeoneHome.state == ON ) {
// Is it a humane time? (9:00am to 22:30)
if( now.millis >= now.withTimeAtStartOfDay.plusHours(9).millis && now.millis < now.withTimeAtStartOfDay.plusHours(22).plusMinutes(30).millis) {
Echo_BigLounge_TTS.sendCommand("It's just stopped raining")
Echo_Kitchen_TTS.sendCommand("It's just stopped raining")
Echo_Bedroom_TTS.sendCommand("It's just stopped raining")
sendBroadcastNotification("It's just stopped raining at home")
}
}
end