I have the following rule
rule "update locations"
when
Time cron "0/10 * * ? * * *"
then
blinds.members.forEach[item |
logInfo("Logger","Itemname laden: "+item.name)
logInfo("Logger","Itemname laden: "+item.state.toString)
logInfo("Logger","Itemname mapDB: "+item.previousState(false,"mapdb").state.toString)
if (item.state == NULL)
{
item.postUpdate(item.previousState(false,"mapdb").state)
}
]
end
which updates blinds with a number if they have a NULL value, (this happens after updating the items file)
This works fine, but after the values update, they no longer commit to mapdb.
other items and switches that are not in this rule commit fine.
Any idea why mapdb would not commit the update/change on these items, only after i run the rule?
it takes a restart of OH to fix, which in turn is also what i can do after upating items files to remove the null values.
Please help.
My items file
// This is the items file
Group mapDB
Group:Switch:OR(ON,OFF) OutdoorLighting "Outdoor Lights [%s]" <light>
Group:Switch:OR(ON,OFF) IndoorLighting "Indoor Lights [%s]" <light> (mapDB)
Group:Switch:OR(ON,OFF) gIrrigation "Irrigation [%s]" <faucet> (mapDB)
Group gIrrigationTimes (mapDB)
Group GNeato
Group gAlarm
Group:Switch:OR(ON,OFF) gPresence
Group:Dimmer:AVG blinds "Blinds are [SCALE(blinds.scale):%s]" (mapDB)
Group Garage (mapDB)
Group gTimepicker (mapDB)
//*********************************
//Time PIcker
//***********
String TransferItem "[%s]" (gTimepicker)
String SprinklerZone "[%s]"
//*********************************
//Lighting
//***********
Switch FrontDownlights "Front Downlights" <light> (OutdoorLighting) [ "Switchable" ] { mqtt="<[broker:stat/FrontDownlightsSonoff/POWER:state:default],>[broker:cmnd/FrontDownlightsSonoff/power:command:*:default]" }
Number FrontDownlight_RSSI "Front Downlight: RSSI [%d %%]" { mqtt="<[broker:tele/FrontDownlightsSonoff/STATE:state:JSONPATH($.Wifi.RSSI)]" }
String FrontDownlight_IP "Get Info" { mqtt=">[broker:cmnd/FrontDownlightsSonoff/IPAddress1:command:*:*]" }
String FrontDownlight_IP_String "Info [%s]" { mqtt="<[broker:stat/FrontDownlightsSonoff/RESULT:state:default]" }
String FrontDownlightStateString "Info" { mqtt="<[broker:tele/FrontDownlightsSonoff/STATE:state:default]" } //hidden string to be updated depending on status
Switch BackyardLights "Backyard lights" <light> (OutdoorLighting) [ "Switchable" ] { mqtt="<[broker:stat/BackyardLights/POWER:state:default],>[broker:cmnd/BackyardLights/power:command:*:default]" }
Number BackyardLights_RSSI "Backyard lights: RSSI [%d %%]" { mqtt="<[broker:tele/BackyardLights/STATE:state:JSONPATH($.Wifi.RSSI)]" }
String BackyardLights_IP "Get Info" { mqtt=">[broker:cmnd/BackyardLights/IPAddress1:command:*:*]" }
String BackyardLights_IP_String "Info [%s]" { mqtt="<[broker:stat/BackyardLights/RESULT:state:default]" }
String BackyardLightsStateString "Info" { mqtt="<[broker:tele/BackyardLights/STATE :state:default]" } //hidden string to be updated depending on status
Switch GarageLights "Garage lights" <light> (IndoorLighting) [ "Switchable" ] { mqtt="<[broker:stat/GarageLights/POWER:state:default],>[broker:cmnd/GarageLights/power:command:*:default]" }
Number GarageLights_RSSI "Garage lights: RSSI [%d %%]" { mqtt="<[broker:tele/GarageLights/STATE:state:JSONPATH($.Wifi.RSSI)]" }
String GarageLights_IP "Get Info" { mqtt=">[broker:cmnd/GarageLights/IPAddress1:command:*:*]" }
String GarageLights_IP_String "Info [%s]" { mqtt="<[broker:stat/GarageLights/RESULT:state:default]" }
String GarageLightsStateString "Info" { mqtt="<[broker:tele/GarageLights/STATE :state:default]" } //hidden string to be updated depending on status
Switch LoungeLight "Lounge room Light" <light> (IndoorLighting) [ "Switchable" ] { mqtt="<[broker:stat/LoungeLight/POWER:state:default],>[broker:cmnd/LoungeLight/power:command:*:default]" }
Number LoungeLight_RSSI "Lounge room Light: RSSI [%d %%]" { mqtt="<[broker:tele/LoungeLight/STATE:state:JSONPATH($.Wifi.RSSI)]" }
String LoungeLight_IP "Get Info" { mqtt=">[broker:cmnd/LoungeLight/IPAddress1:command:*:*]" }
String LoungeLight_IP_String "Info [%s]" { mqtt="<[broker:stat/LoungeLight/RESULT:state:default]" }
String LoungeLightStateString "Info" { mqtt="<[broker:tele/LoungeLight/STATE :state:default]" } //hidden string to be updated depending on status
//*********************************
//Blinds
//***********
Number MainBedBlindsSettings { mqtt=">[broker:MainBedBlinds/1:command:*:default]" }
Number MainBedBlindsLocation { mqtt=">[broker:MainBedBlinds/1:command:*:default]" }
Dimmer MainBedBlinds1 "Master Bedroom First Window [%d]" <none> (blinds) [ "Switchable" ] { mqtt="<[broker:MainBedBlinds/Location/1:state:default],>[broker:MainBedBlinds/1:command:*:default]" }
Dimmer MainBedBlinds2 "Master Bedroom Second Window [%d]" <none> (blinds) [ "Switchable" ] { mqtt="<[broker:MainBedBlinds/Location/2:state:default],>[broker:MainBedBlinds/2:command:*:default]" }
Dimmer MainBedBlinds3 "Master Bedroom Third Window [%d]" <none> (blinds) [ "Switchable" ] { mqtt="<[broker:MainBedBlinds/Location/3:state:default],>[broker:MainBedBlinds/3:command:*:default]" }
Dimmer AllMainBlinds "Master Bedroom Blinds" [ "Switchable" ]
String MainBlindStatus { mqtt="<[broker:MainBedBlinds/status/get:state:default]" } //hidden string to be updated depending on status
DateTime BedBlindsOnline "Last Online at [%1$tl:%1$tM%1$tp on %1$tA, %1$tB %1$te, %1$tY]"
Number LoungeBlindsSettings { mqtt=">[broker:LoungeBlinds/1:command:*:default]" }
Number LoungeBlindsLocation { mqtt=">[broker:LoungeBlinds/1:command:*:default]" }
Dimmer LoungeBlinds1 "Lounge First Window [%d]" <none> (blinds) [ "Switchable" ] { mqtt="<[broker:LoungeBlinds/Location/1:state:default],>[broker:LoungeBlinds/1:command:*:default]" }
Dimmer LoungeBlinds2 "Lounge Second Window [%d]" <none> (blinds) [ "Switchable" ] { mqtt="<[broker:LoungeBlinds/Location/2:state:default],>[broker:LoungeBlinds/2:command:*:default]" }
Dimmer LoungeBlinds3 "Lounge Third Window [%d]" <none> (blinds) [ "Switchable" ] { mqtt="<[broker:LoungeBlinds/Location/3:state:default],>[broker:LoungeBlinds/3:command:*:default]" }
Dimmer AllLoungeBlinds "All Lounge Blinds" [ "Switchable" ]
String LoungeBlindsStatus { mqtt="<[broker:LoungeBlinds/status/get:state:default]" } //hidden string to be updated depending on status
DateTime LoungeBlindsLastOnline "Last Online at [%1$tl:%1$tM%1$tp on %1$tA, %1$tB %1$te, %1$tY]"
Dimmer AllBlinds "All Blinds" [ "Switchable" ]
//*********************************
//Sprinkler System
//***********
String Irrigation_Zone1 (gIrrigationTimes)
String Irrigation_Zone2 (gIrrigationTimes)
String Irrigation_Zone3 (gIrrigationTimes)
String Irrigation_Zone4 (gIrrigationTimes)
Switch SprinklerSystemZone1 "Front Grass Sprinklers" (gIrrigation) [ "Switchable" ] { mqtt=">[broker:SprinklerSystem:command:ON:Z1ON],>[broker:SprinklerSystem:command:OFF:Z1OFF]" }
Switch SprinklerSystemZone2 "Front Garden Sprinklers" (gIrrigation) [ "Switchable" ] { mqtt=">[broker:SprinklerSystem:command:ON:Z2ON],>[broker:SprinklerSystem:command:OFF:Z2OFF]" }
Switch SprinklerSystemZone3 "Back Grass Sprinklers" (gIrrigation) [ "Switchable" ] { mqtt=">[broker:SprinklerSystem:command:ON:Z3ON],>[broker:SprinklerSystem:command:OFF:Z3OFF]" }
Switch SprinklerSystemZone4 "Back Garden Sprinklers" (gIrrigation) [ "Switchable" ] { mqtt=">[broker:SprinklerSystem:command:ON:Z4ON],>[broker:SprinklerSystem:command:OFF:Z4OFF]" }
Number Countdown_Zone1 "Minutes Remaining [%d]" (gIrrigationTimes)
Number Countdown_Zone2 "Minutes Remaining [%d]" (gIrrigationTimes)
Number Countdown_Zone3 "Minutes Remaining [%d]" (gIrrigationTimes)
Number Countdown_Zone4 "Minutes Remaining [%d]" (gIrrigationTimes)
Switch SprinklerSystemSchedule1 "Front Grass Schedule" (gIrrigationTimes)
Switch SprinklerSystemSchedule2 "Front Garden Schedule" (gIrrigationTimes)
Switch SprinklerSystemSchedule3 "Back Grass Schedule" (gIrrigationTimes)
Switch SprinklerSystemSchedule4 "Back Garden Schedule" (gIrrigationTimes)
DateTime Irrigation_StartTime1 "Zone 1 Last Watered [%1$ta %1$tR]" (gIrrigationTimes)
DateTime Irrigation_StartTime2 "Zone 2 Last Watered [%1$ta %1$tR]" (gIrrigationTimes)
DateTime Irrigation_StartTime3 "Zone 3 Last Watered [%1$ta %1$tR]" (gIrrigationTimes)
DateTime Irrigation_StartTime4 "Zone 4 Last Watered [%1$ta %1$tR]" (gIrrigationTimes)
Number onHours1 "Front Grass Sprinkler Minutes" (gIrrigationTimes)
Number onHours2 "Front Garden Sprinkler Minutes" (gIrrigationTimes)
Number onHours3 "Back Grass Sprinkler Minutes" (gIrrigationTimes)
Number onHours4 "Back Garden Sprinkler Minutes" (gIrrigationTimes)
String IFTTString "If this then that string" (All)
DateTime Sunset_Time "Sunset [%1$tH:%1$tM]" { channel="astro:sun:local:set#start" }
//*********************************
//alarm
//***********
String AlarmKeypad
Switch Unlocked
String KeypadString
Switch ARM "Arm" (gAlarm) [ "Switchable" ]
Switch DISARM "Disarm" (gAlarm) [ "Switchable" ]
Switch STAY "Stay" (gAlarm) [ "Switchable" ]
String AlarmString "Alarm" <alarm> (gAlarm) [ "Switchable" ]
String Alarm { mqtt=">[broker:AlarmSystem:command:*:Default]" }
//*********************************
//Garage Door
//***********
Switch GarageDoorSwitch "Garage Door" [ "Switchable" ] { mqtt=">[broker:cmnd/GarageDoorSonoff/POWER:command:*:default]" }
Rollershutter GarageDoor
String GarageDoorState
Switch GarageDoorClosed (Garage) { mqtt="<[broker:cmnd/GarageDoorSensors/POWER1:state:default]" }
Switch GarageDoorOpened (Garage) { mqtt="<[broker:cmnd/GarageDoorSensors/POWER2:state:default]" }
Number Garage_RSSI "Garage: RSSI [%d %%]" { mqtt="<[broker:tele/GarageDoorSonoff/STATE:state:JSONPATH($.Wifi.RSSI)]" }
String Garage_IP "Get Info" { mqtt=">[broker:cmnd/GarageDoorSonoff/IPAddress1:command:*:*]" }
String Garage_IP_String "Info [%s]" { mqtt="<[broker:stat/GarageDoorSonoff/RESULT:state:default]" }
Switch GarageDoorAuto "Garage Door auto close 9PM-5AM" (Garage)
Switch GarageDoorStateUpdate { mqtt=">[broker:cmnd/GarageDoorSonoff/STATUS:command:*:10]" } //hidden button to get update of garage door status. Runs every minute
String GarageDoorStateString { mqtt="<[broker:tele/GarageDoorSonoff/SENSOR:state:default]" } //hidden string to be updated depending on status
//*********************************
//Sonof Reboot Items
//***********
String Sonoff_Action "All Sonoff Devices" <sonoff_basic>
//*********************************
//Network Devices online
//***********
Switch ChrisPhone (gPresence) {channel="network:pingdevice:192_168_0_149:online"}
Switch AimeePhone (gPresence) {channel="network:pingdevice:192_168_0_187:online"}
//Switch LoungeBlindsPresence (gPresence) {channel="network:pingdevice:192_168_0_163:online"}
Number FrontGrassMoisture (gIrrigationTimes) { mqtt="<[broker:FrontGrassSensor/Stat:state:default]" }
DateTime FrontGrassMoistureTime "Last Updated [%1$ta %1$tR]" (gIrrigationTimes)
//************************************
and mapdb file
# the commit interval in seconds (optional, default to '5')
commitinterval=10
# issue a commit even if the state did not change (optional, defaults to 'false')
commitsamestate=false
Strategies {
default = everyUpdate
}
Items {
mapDB : strategy = everyChange, restoreOnStartup
mapDB*: strategy = everyChange, restoreOnStartup
}-++