I think you should display the actual item.lastUpdate value, of the filtered-from-group item, and the one that you are expecting to change. Guessing there are no changes i.e. persistence not working.
Looks like persistence broke with my latest OH2 update. I have mapdb setup for All_Lights_switches but when using
All_Lights_switches?.allMembers.sortBy[lastUpdate("mapdb")].last as SwitchItem
All I get for my last switch member name is: null
My MapDB config has:
All_Lights_switches* : strategy = everyChange, everyDay, restoreOnStartup
I was always using lastUpdate with no specified persistence since I had rrd4j set as the default and just changed it now in my tests to “mapdb” to see if that would resolve my problem.
So although the persistence DB files for both rrd4j and mapdb have updated timestamps, it would seem that they are not getting updated automatically. I tried reinstalling both persistence methods through paperui and restarted OH2 but that made no difference.
Kind of wishing I didn’t perform this OH2 update…
Sounds so similar to this error
where only Group was persisted due to finger trouble - but you do appear to have the necessary *. Sure you have all stratagies defined OK?
Yes, I read that post too. I quoted the line directly from my config and it did work just fine before I performed the OH2 update. Since I can’t figure out why lastUpdate isn’t working for me anymore or why my persistence isn’t getting updated, it seems like I’m going to have to add an item to every switch to create my own persistence.
When the Group triggers the rule, I’ll have to loop through all my switches and compare current state to my saved switch persistence items. It’ll be crude, but besides doing a scratch installation to see if my problems magically disappear I don’t see I have much choice.
Btw, thanks very much for your support.
What’s your group and items definition (complete…)?
Group All
Group gMF (All)
Group gSF (All)
Group gB (All)
Group gG (All)
Group Outdoor (All)
Group gPersist (All)
Group:Dimmer All_Lights_dimmers (All)
Group:Switch All_Lights_switches (All)
Group:Number All_Lights_last (All)
Group:Dimmer SunRise_dimmers (All)
Group:Dimmer SunSet_dimmers (All)
Group MF_Living "Living Room" (gMF)
Group MF_Kitchen "Kitchen" (gMF)
Group MF_Guest "Guest" (gMF)
Group MF_Laundry "Laundry Room" (gMF)
/* Garage Lights */
Switch Light_Outdoor_Garage "Garage Flood light" (Outdoor,gG) {channel="zwave:device:82a03e13:node2:switch_binary"}
Dimmer Light_Garage_dimmer "Garage Light" (gG,All_Lights_dimmers)
Switch Light_Garage_switch "Garage Light" (gG,All_Lights_switches)
Number Light_Garage_last "Garage Light" (gG,All_Lights_last)
/* Outdoor Lights */
Dimmer Light_Outdoor_Sconces_dimmer "Outdoor Sconce Lights" (Outdoor,All_Lights_dimmers,SunSet_dimmers,SunRise_dimmers)
Switch Light_Outdoor_Sconces_switch "Outdoor Sconce Lights" (Outdoor,All_Lights_switches)
Number Light_Outdoor_Sconces_last "Outdoor Sconce Lights" (Outdoor,All_Lights_last)
Dimmer Light_Outdoor_Deck_Railing_dimmer "Deck Railing Lights" (Outdoor,All_Lights_dimmers)
Switch Light_Outdoor_Deck_Railing_switch "Deck Railing Lights" (Outdoor,All_Lights_switches)
Number Light_Outdoor_Deck_Railing_last "Deck Railing Lights" (Outdoor,All_Lights_last)
Dimmer Light_Outdoor_Deck_Sconce_dimmer "Deck Sconce Lights" (Outdoor,All_Lights_dimmers)
Switch Light_Outdoor_Deck_Sconce_switch "Deck Sconce Lights" (Outdoor,All_Lights_switches)
Number Light_Outdoor_Deck_Sconce_last "Deck Sconce Lights" (Outdoor,All_Lights_last)
/* Basement Lights */
Dimmer Light_Cellar_Door_dimmer "Basement Cellar Door Light" (gB,All_Lights_dimmers)
Switch Light_Cellar_Door_switch "Basement Cellar Door Light" (gB,All_Lights_switches)
Number Light_Cellar_Door_last "Basement Cellar Door Light" (gB,All_Lights_last)
Dimmer Light_Basement_shop_dimmer "Basement Shop" (gB,All_Lights_dimmers)
Switch Light_Basement_shop_switch "Basement Shop" (gB,All_Lights_switches)
Number Light_Basement_shop_last "Basement Shop" (gB,All_Lights_last)
Dimmer Light_Basement_Mech_dimmer "Basement Mechanical" (gB,All_Lights_dimmers)
Switch Light_Basement_Mech_switch "Basement Mechanical" (gB,All_Lights_switches)
Number Light_Basement_Mech_last "Basement Mechanical" (gB,All_Lights_last)
Dimmer Light_Basement_stairs_dimmer "Basement Stairs" (gB,All_Lights_dimmers)
Switch Light_Basement_stairs_switch "Basement Stairs" (gB,All_Lights_switches)
Number Light_Basement_stairs_last "Basement Stairs" (gB,All_Lights_last)
/* Main Floor Lights */
Dimmer Light_Livingroom_East_dimmer "Living Room Ceiling East" (MF_Living,All_Lights_dimmers)
Switch Light_Livingroom_East_switch "Living Room Ceiling East" (MF_Living,All_Lights_switches)
Number Light_Livingroom_East_last "Living Room Ceiling East" (MF_Living,All_Lights_last)
Dimmer Light_Livingroom_West_dimmer "Living Room Ceiling West" (MF_Living,All_Lights_dimmers)
Switch Light_Livingroom_West_switch "Living Room Ceiling West" (MF_Living,All_Lights_switches)
Number Light_Livingroom_West_last "Living Room Ceiling West" (MF_Living,All_Lights_last)
Dimmer Light_Kitchen_dimmer "Kitchen" (MF_Kitchen,All_Lights_dimmers,SunSet_dimmers)
Switch Light_Kitchen_switch "Kitchen" (MF_Kitchen,All_Lights_switches)
Number Light_Kitchen_last "Kitchen" (MF_Kitchen,All_Lights_last)
Dimmer Light_Dining_dimmer "Dining" (MF_Kitchen,All_Lights_dimmers)
Switch Light_Dining_switch "Dining" (MF_Kitchen,All_Lights_switches)
Number Light_Dining_last "Dining" (MF_Kitchen,All_Lights_last)
Dimmer Light_Guest_Bedroom_dimmer "Guest Bedroom" (MF_Guest,All_Lights_dimmers)
Switch Light_Guest_Bedroom_switch "Guest Bedroom" (MF_Guest,All_Lights_switches)
Number Light_Guest_Bedroom_last "Guest Bedroom" (MF_Guest,All_Lights_last)
Dimmer Light_Guest_Closet_dimmer "Guest Closet" (MF_Guest,All_Lights_dimmers)
Switch Light_Guest_Closet_switch "Guest Closet" (MF_Guest,All_Lights_switches)
Number Light_Guest_Closet_last "Guest Closet" (MF_Guest,All_Lights_last)
Dimmer Light_Guest_Bed_left_dimmer "Guest Bed Left Nightstand" (MF_Guest,All_Lights_dimmers)
Switch Light_Guest_Bed_left_switch "Guest Bed Left Nightstand" (MF_Guest,All_Lights_switches)
Number Light_Guest_Bed_left_last "Guest Bed Left Nightstand" (MF_Guest,All_Lights_last)
Dimmer Light_Guest_Bed_right_dimmer "Guest Bed Right Nightstand" (MF_Guest,All_Lights_dimmers)
Switch Light_Guest_Bed_right_switch "Guest Bed Right Nightstand" (MF_Guest,All_Lights_switches)
Number Light_Guest_Bed_right_last "Guest Bed Right Nightstand" (MF_Guest,All_Lights_last)
Dimmer Light_Guest_Bath_dimmer "Guest Bath" (MF_Guest,All_Lights_dimmers)
Switch Light_Guest_Bath_switch "Guest Bath" (MF_Guest,All_Lights_switches)
Number Light_Guest_Bath_last "Guest Bath" (MF_Guest,All_Lights_last)
Dimmer Light_Laundry_dimmer "Laundry Room" (MF_Guest,All_Lights_dimmers)
Switch Light_Laundry_switch "Laundry Room" (MF_Guest,All_Lights_switches)
Number Light_Laundry_last "Laundry Room" (MF_Guest,All_Lights_last)
Dimmer Light_Hallway_dimmer "Hallway" (gMF,All_Lights_dimmers)
Switch Light_Hallway_switch "Hallway" (gMF,All_Lights_switches)
Number Light_Hallway_last "Hallway" (gMF,All_Lights_last)
/* Second Floor Lights */
Dimmer Light_second_floor_stairs_dimmer "Second Floor Stairs" (gSF,All_Lights_dimmers)
Switch Light_second_floor_stairs_switch "Second Floor Stairs" (gSF,All_Lights_switches)
Number Light_second_floor_stairs_last "Second Floor Stairs" (gSF,All_Lights_last)
Dimmer Light_Master_bedroom_dimmer "Master Bedroom" (gSF,All_Lights_dimmers)
Switch Light_Master_bedroom_switch "Master Bedroom" (gSF,All_Lights_switches)
Number Light_Master_bedroom_last "Master Bedroom" (gSF,All_Lights_last)
Dimmer Light_Master_Closet_dimmer "Master Closet" (gSF,All_Lights_dimmers)
Switch Light_Master_Closet_switch "Master Closet" (gSF,All_Lights_switches)
Number Light_Master_Closet_last "Master Closet [%.0f]" (gSF,All_Lights_last)
Dimmer Light_Master_Bath_dimmer "Master Bath" (gSF,All_Lights_dimmers)
Switch Light_Master_Bath_switch "Master Bath" (gSF,All_Lights_switches)
Number Light_Master_Bath_last "Master Bath" (gSF,All_Lights_last)
Dimmer Light_Master_Bed_left_dimmer "Master Bed Left Nightstand" (gSF,All_Lights_dimmers)
Switch Light_Master_Bed_left_switch "Master Bed Left Nightstand" (gSF,All_Lights_switches)
Number Light_Master_Bed_left_last "Master Bed Left Nightstand" (gSF,All_Lights_last)
Dimmer Light_Master_Bed_right_dimmer "Master Bed Right Nightstand" (gSF,All_Lights_dimmers)
Switch Light_Master_Bed_right_switch "Master Bed Right Nightstand" (gSF,All_Lights_switches)
Number Light_Master_Bed_right_last "Master Bed Right Nightstand" (gSF,All_Lights_last)
Dimmer Light_desk_dimmer "Computer Desk" (gSF,All_Lights_dimmers)
Switch Light_desk_switch "Computer Desk" (gSF,All_Lights_switches)
Number Light_desk_last "Computer Desk" (gSF,All_Lights_last)
/* MQTT light status */
String mqtt_light_status "mqtt message [%s]" {mqtt="<[openhab:lumencache/status:state:REGEX(light\\:(.+))]"}
String lumencache_test "Test value [%s]"
Switch lumencache_test_button "Test Button"
Switch refresh_lights_switch "Refresh"
String send_lumencache_command "Send comand to Lumencache" {mqtt=">[openhab:lumencache/control:command:*:${command}]"}
/* MQTT voice control */
String mqtt_voice_command "mqtt voice message [%s]" {mqtt="<[openhab:voicecontrol:state:REGEX(voice\\:(.+))]"}
/* Heating */
Switch Heating_Guest_Bathroom "Guest Bathroom Heater" <heating> (MF_Guest) {channel="zwave:device:82a03e13:node3:switch_binary"}
Switch Heating_Master_Bathroom "Master Bathroom Heater" <heating> (gSF) {channel="zwave:device:82a03e13:node4:switch_binary"}
/* Indoor Thermostats */
Number Thermostat1_Temp "Current Temperature [%.2f °F]" <temperature> {channel="zwave:device:82a03e13:node5:sensor_temperature"}
Number Thermostat1_Humidity "Humidity [%.0f %%]" <humidity> {channel="zwave:device:82a03e13:node5:sensor_relhumidity"}
Number Thermostat2_Temp "Current Temperature [%.2f °F]" <temperature> {channel="zwave:device:82a03e13:node6:sensor_temperature"}
Number Thermostat2_Humidity "Humidity [%.0f %%]" <humidity> {channel="zwave:device:82a03e13:node6:sensor_relhumidity"}
Number Thermostat3_Temp "Current Temperature [%.2f °F]" <temperature> {channel="zwave:device:82a03e13:node7:sensor_temperature"}
Number Thermostat3_Humidity "Humidity [%.0f %%]" <humidity> {channel="zwave:device:82a03e13:node7:sensor_relhumidity"}
String Thermostat3_Running "Heating/Cooling [%s]" {channel="zwave:device:82a03e13:node7:sensor_general"}
Number Thermostat4_Temp "Current Temperature [%.2f °F]" <temperature> {channel="zwave:device:82a03e13:node8:sensor_temperature"}
Number Thermostat4_Humidity "Humidity [%.0f %%]" <humidity> {channel="zwave:device:82a03e13:node8:sensor_relhumidity"}
/* NTP binding demo item */
DateTime Date "Date [%1$tc]" <calendar> { channel="ntp:ntp:local:dateTime" }
/* Astro */
DateTime Sunrise_Time "Sunrise [%1$tH:%1$tM]" {channel="astro:sun:local:rise#start"}
DateTime Sunset_Time "Sunset [%1$tH:%1$tM]" {channel="astro:sun:local:set#start"}
/* Sonos */
Player Controller "Player" {channel="sonos:PLAY5:RINCON_5CAAFD0BF25801400:control"}
String Basement_Current_Title "Title [%s]" {channel="sonos:PLAY5:RINCON_B8E937F99A7801400:currenttitle"}
String Basement_Current_Track "Track [%s]" {channel="sonos:PLAY5:RINCON_B8E937F99A7801400:currentartist"}
String Basement_Current_Album "Album [%s]" {channel="sonos:PLAY5:RINCON_B8E937F99A7801400:currentalbum"}
Image Basement_Current_Album_Art "Album Art" {channel="sonos:PLAY5:RINCON_B8E937F99A7801400:currentalbumart"}
String Play_Linein "Radio" {channel="sonos:PLAY5:RINCON_5CAAFD0BF25801400:playlinein"}
Switch Linein "Linein" {channel="sonos:PLAY5:RINCON_5CAAFD0BF25801400:linein"}
Dimmer Basement_volume "Volume [%d %%]" <soundvolume-0> {channel="sonos:PLAY5:RINCON_5CAAFD0BF25801400:volume"}
String Current_Title "Title [%s]" {channel="sonos:PLAY5:RINCON_B8E937F99A7401400:currenttitle"}
String Current_Track "Track [%s]" {channel="sonos:PLAY5:RINCON_B8E937F99A7401400:currentartist"}
String Current_Album "Track [%s]" {channel="sonos:PLAY5:RINCON_B8E937F99A7401400:currentalbum"}
Image Current_Album_Art "Album Art" {channel="sonos:PLAY5:RINCON_B8E937F99A7401400:currentalbumart"}
Dimmer Living_volume "Volume [%d %%]" <soundvolume-0> {channel="sonos:PLAY5:RINCON_B8E937F99A7401400:volume"}
Player Playbar_Controller "PlayBar Control" {channel="sonos:PLAYBAR:RINCON_5CAAFD1545F101400:control"}
Dimmer Playbar_volume "TV Volume [%d %%]" <soundvolume-0> {channel="sonos:PLAYBAR:RINCON_5CAAFD1545F101400:volume"}
/* Radio piradio: KZMT:101.1:Classic Rock */
String Radio_stat "mqtt message [%s]" {mqtt="<[openhab:piradio/status:state:REGEX(piradio\\:(.+))]"}
String Radio_Station {mqtt=">[openhab:piradio/control:command:*:${command}]"}
Switch Radio_Station_On "Radio On"
/* MQTT TV control */
String send_tv_ir_command {mqtt=">[openhab:pitv/control:command:*:${command}]"}
/* Alarm */
Switch Alarm_Enable "Alarm Enable"
Number Alarm_Hour "Hour [%02d]"
Number Alarm_Minute "Minute [%02d]"
Dimmer Alarm_Volume "Volume"
/* Weather */
Number Current_Temp "Current Temperature [%.2f °F]" <temperature> {weather="locationId=MyHome, type=temperature, property=current, scale=1, unit=fahrenheit"}
/* DateTime Weather_LastUpdate "Lastupdate time [%1$tc]" {weather="locationId=MyHome, type=condition, property=lastUpdate"} */
/* Number Current_Humidity "Humidity [%d %%]" <humidity> {weather="locationId=Myhome, type=atmosphere, property=humidity"} */
Number Forecast0_Temp_Min "Today Temperature min [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=0, type=temperature, property=min, scale=1, unit=fahrenheit"}
Number Forecast0_Temp_Max "Today Temperature max [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=0, type=temperature, property=max, scale=1, unit=fahrenheit"}
DateTime Forecast0_Day "Observation time [%1$ta]" {weather="locationId=MyHome, forecast=0, type=condition, property=observationTime"}
String Forecast0_condition "[%s]" {weather="locationId=MyHome, forecast=0, type=condition, property=text"}
Number Forecast0_Rain_Inches "Rain [%.2f in]" <rain> {weather="locationId=MyHome, forecast=0, type=precipitation, property=rain, unit=inches"}
Number Forecast0_Snow_Inches "Snow [%.2f in]" <climate-on> {weather="locationId=MyHome, forecast=0, type=precipitation, property=snow, unit=inches"}
Number Forecast0_Precip_Probability "Precip probability [%d %%]" <rain> {weather="locationId=MyHome, forecast=0, type=precipitation, property=probability"}
Number Forecast0_Wind_Speed_Mph "Windspeed [%.2f mph]" <wind> {weather="locationId=MyHome, forecast=0, type=wind, property=speed, unit=mph"}
Number Forecast1_Temp_Min "Tomorrow Temperature min [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=1, type=temperature, property=min, scale=1, unit=fahrenheit"}
Number Forecast1_Temp_Max "Tomorrow Temperature max [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=1, type=temperature, property=max, scale=1, unit=fahrenheit"}
DateTime Forecast1_Day "Observation time [%1$ta]" {weather="locationId=MyHome, forecast=1, type=condition, property=observationTime"}
String Forecast1_condition "[%s]" {weather="locationId=MyHome, forecast=1, type=condition, property=text"}
Number Forecast1_Rain_Inches "Rain [%.2f in]" <rain> {weather="locationId=MyHome, forecast=1, type=precipitation, property=rain, unit=inches"}
Number Forecast1_Snow_Inches "Snow [%.2f in]" <climate-on> {weather="locationId=MyHome, forecast=1, type=precipitation, property=snow, unit=inches"}
Number Forecast1_Precip_Probability "Precip probability [%d %%]" <rain> {weather="locationId=MyHome, forecast=1, type=precipitation, property=probability"}
Number Forecast1_Wind_Speed_Mph "Windspeed [%.2f mph]" <wind> {weather="locationId=MyHome, forecast=1, type=wind, property=speed, unit=mph"}
Number Forecast2_Temp_Min "Temperature min [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=2, type=temperature, property=min, scale=1, unit=fahrenheit"}
Number Forecast2_Temp_Max "Temperature max [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=2, type=temperature, property=max, scale=1, unit=fahrenheit"}
DateTime Forecast2_Day "Observation time [%1$ta]" {weather="locationId=MyHome, forecast=2, type=condition, property=observationTime"}
String Forecast2_condition "[%s]" {weather="locationId=MyHome, forecast=2, type=condition, property=text"}
Number Forecast2_Rain_Inches "Rain [%.2f in]" <rain> {weather="locationId=MyHome, forecast=2, type=precipitation, property=rain, unit=inches"}
Number Forecast2_Snow_Inches "Snow [%.2f in]" <climate-on> {weather="locationId=MyHome, forecast=2, type=precipitation, property=snow, unit=inches"}
Number Forecast2_Precip_Probability "Precip probability [%d %%]" <rain> {weather="locationId=MyHome, forecast=2, type=precipitation, property=probability"}
Number Forecast2_Wind_Speed_Mph "Windspeed [%.2f mph]" <wind> {weather="locationId=MyHome, forecast=2, type=wind, property=speed, unit=mph"}
Number Forecast3_Temp_Min "Temperature min [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=3, type=temperature, property=min, scale=1, unit=fahrenheit"}
Number Forecast3_Temp_Max "Temperature max [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=3, type=temperature, property=max, scale=1, unit=fahrenheit"}
DateTime Forecast3_Day "Observation time [%1$ta]" {weather="locationId=MyHome, forecast=3, type=condition, property=observationTime"}
String Forecast3_condition "[%s]" {weather="locationId=MyHome, forecast=3, type=condition, property=text"}
Number Forecast3_Rain_Inches "Rain [%.2f in]" <rain> {weather="locationId=MyHome, forecast=3, type=precipitation, property=rain, unit=inches"}
Number Forecast3_Snow_Inches "Snow [%.2f in]" <climate-on> {weather="locationId=MyHome, forecast=3, type=precipitation, property=snow, unit=inches"}
Number Forecast3_Precip_Probability "Precip probability [%d %%]" <rain> {weather="locationId=MyHome, forecast=3, type=precipitation, property=probability"}
Number Forecast3_Wind_Speed_Mph "Windspeed [%.2f mph]" <wind> {weather="locationId=MyHome, forecast=3, type=wind, property=speed, unit=mph"}
Number Forecast4_Temp_Min "Temperature min [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=4, type=temperature, property=min, scale=1, unit=fahrenheit"}
Number Forecast4_Temp_Max "Temperature max [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=4, type=temperature, property=max, scale=1, unit=fahrenheit"}
DateTime Forecast4_Day "Observation time [%1$ta]" {weather="locationId=MyHome, forecast=4, type=condition, property=observationTime"}
String Forecast4_condition "[%s]" {weather="locationId=MyHome, forecast=4, type=condition, property=text"}
Number Forecast4_Rain_Inches "Rain [%.2f in]" <rain> {weather="locationId=MyHome, forecast=4, type=precipitation, property=rain, unit=inches"}
Number Forecast4_Snow_Inches "Snow [%.2f in]" <climate-on> {weather="locationId=MyHome, forecast=4, type=precipitation, property=snow, unit=inches"}
Number Forecast4_Precip_Probability "Precip probability [%d %%]" <rain> {weather="locationId=MyHome, forecast=4, type=precipitation, property=probability"}
Number Forecast4_Wind_Speed_Mph "Windspeed [%.2f mph]" <wind> {weather="locationId=MyHome, forecast=4, type=wind, property=speed, unit=mph"}
Number Forecast5_Temp_Min "Temperature min [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=5, type=temperature, property=min, scale=1, unit=fahrenheit"}
Number Forecast5_Temp_Max "Temperature max [%.2f °F]" <temperature> {weather="locationId=MyHome, forecast=5, type=temperature, property=max, scale=1, unit=fahrenheit"}
DateTime Forecast5_Day "Observation time [%1$ta]" {weather="locationId=MyHome, forecast=5, type=condition, property=observationTime"}
String Forecast5_condition "[%s]" {weather="locationId=MyHome, forecast=5, type=condition, property=text"}
Number Forecast5_Rain_Inches "Rain [%.2f in]" <rain> {weather="locationId=MyHome, forecast=5, type=precipitation, property=rain, unit=inches"}
Number Forecast5_Snow_Inches "Snow [%.2f in]" <climate-on> {weather="locationId=MyHome, forecast=5, type=precipitation, property=snow, unit=inches"}
Number Forecast5_Precip_Probability "Precip probability [%d %%]" <rain> {weather="locationId=MyHome, forecast=5, type=precipitation, property=probability"}
Number Forecast5_Wind_Speed_Mph "Windspeed [%.2f mph]" <wind> {weather="locationId=MyHome, forecast=5, type=wind, property=speed, unit=mph"}
If you are using gPersist in your .persist file to determine which ones get saved that might be the problem. The way I understand the changes to Groups, if you don’t provide a Type the Group never gets a state nor does it ever get updated. If (that is a big if because I don’t know if this is for sure how it work) Persistence depends on those updates to know what to save and when, when using gPersist* in your .persist file that may be broken.
I’d love to know if others are experiencing this because if so I need to update the Group Based Persistence Design Pattern.
This is my mapdb.persist file:
// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
// if no strategy is specified for an item entry below, the default list will be used
default = everyChange
}
/*
* Each line in this section defines for which item(s) which strategy(ies) should be applied.
* You can list single items, use "*" for all items or "groupitem*" for all members of a group
* item (excl. the group item itself).
*/
Items {
// persist all items once a day and on every change and restore them from the db at startup
All_Lights_switches* : strategy = everyChange, everyDay, restoreOnStartup
All_Lights_dimmers* : strategy = everyChange, everyDay, restoreOnStartup
All_Lights_last* : strategy = everyChange, everyDay, restoreOnStartup
Sunrise_Time : strategy = everyChange, everyDay, restoreOnStartup
Sunset_Time : strategy = everyChange, everyDay, restoreOnStartup
Radio_stat : strategy = everyChange, restoreOnStartup
Radio_Station : strategy = everyChange, restoreOnStartup
Alarm_Enable : strategy = everyChange, restoreOnStartup
Alarm_Hour : strategy = everyChange, restoreOnStartup
Alarm_Minute : strategy = everyChange, restoreOnStartup
Alarm_Volume : strategy = everyChange, restoreOnStartup
// additionally, persist all temperature and weather values every hour
// Temperature*, Weather* : strategy = everyHour
}
I’m replying to myself here to add some info and keep separate from the previous post.
I just reinstalled mapdb persistence and turned on debugging for persistence. This is what I get in the log:
22:44:06.079 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for Date
22:44:06.088 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'Date' with state '2017-07-10T22:44:06' in mapdb database
22:44:06.102 [INFO ] [marthome.event.ItemStateChangedEvent] - Date changed from 2017-07-10T22:43:06.068-0600 to 2017-07-10T22:44:06.068-0600
22:44:18.690 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Light_Master_Closet_switch' received command ON
22:44:18.697 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for Light_Master_Closet_switch
22:44:18.702 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'Light_Master_Closet_switch' with state 'ON' in mapdb database
22:44:18.710 [INFO ] [marthome.event.ItemStateChangedEvent] - Light_Master_Closet_switch changed from OFF to ON
22:44:18.740 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch:Starting
22:44:19.118 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Test_All_Lights_switches': null
22:44:42.279 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Light_Master_bedroom_switch' received command OFF
22:44:42.289 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for Light_Master_bedroom_switch
22:44:42.292 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'Light_Master_bedroom_switch' with state 'OFF' in mapdb database
22:44:42.298 [INFO ] [marthome.event.ItemStateChangedEvent] - Light_Master_bedroom_switch changed from ON to OFF
22:44:42.312 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch:Starting
22:44:42.672 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Test_All_Lights_switches': null
So it looks like mapdb is performing the persistence update. As you can see in the log, my Test rule is still firing but returning “null”. As a reminder, this is the Test rule:
rule "Test_All_Lights_switches"
when
Item All_Lights_switches received update
then
logDebug("LUMENCACHE", "Rule: UI Light Test Switch:Starting")
Thread::sleep(300)
val ChangedSwitch = All_Lights_switches?.allMembers.sortBy[lastUpdate("mapdb")].last as SwitchItem
logDebug("LUMENCACHE", "Rule: UI Light Test Switch ChangedSwitch: " + ChangedSwitch)
end
Obviously, something is still not right with lastUpdate.
Edit: Apologies to @rlkoshak. I seem to have hijacked your thread. I can open a new one if you want me too.
So that’s changed behaviour from where you started, with an ancient history result. It’d be interesting to see the result of a simple Light_Master_bedroom_switch.lastUpdate(“mapdb”) without all the group fiddly bits.
I updated the test rule as follows:
rule "Test_All_Lights_switches"
when
Item All_Lights_switches received update
then
logDebug("LUMENCACHE", "Rule: UI Light Test Switch:Starting")
Thread::sleep(300)
logDebug("LUMENCACHE", "State of Light_Master_bedroom_switch: " + Light_Master_bedroom_switch.lastUpdate("mapdb"))
val ChangedSwitch = All_Lights_switches?.allMembers.sortBy[lastUpdate("mapdb")].last as SwitchItem
logDebug("LUMENCACHE", "Rule: UI Light Test Switch ChangedSwitch: " + ChangedSwitch)
end
This results in the following log entries:
2017-07-11 10:34:12.902 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch:Starting
2017-07-11 10:34:13.272 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - State of Light_Master_bedroom_switch: 2017-07-11T10:34:11.948-06:00
2017-07-11 10:34:13.328 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Test_All_Lights_switches': null
2017-07-11 10:34:32.459 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: UI Light Test Switch:Starting
2017-07-11 10:34:32.767 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - State of Light_Master_bedroom_switch: 2017-07-11T10:34:32.442-06:00
2017-07-11 10:34:32.824 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Test_All_Lights_switches': null
So it seems that the correct last update time is reported.
The change in behavior from where I started is because I have been experimenting trying to resolve the problem. When I started with this issue, lastUpdate was checking rrd4j not mapdb since this is how my system was working before I performed the update. That is when I was always getting the same switch name.
I have since completely uninstalled rrd4j and am trying to get it to work with mapdb instead since I had mapdb set up anyway for restoreOnStartup. To try and work around the issue with Groups I have also changed my mapdb.persist file to something much simpler:
// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
// if no strategy is specified for an item entry below, the default list will be used
default = everyChange
}
/*
* Each line in this section defines for which item(s) which strategy(ies) should be applied.
* You can list single items, use "*" for all items or "groupitem*" for all members of a group
* item (excl. the group item itself).
*/
Items {
// persist all items once a day and on every change and restore them from the db at startup
* : strategy = everyChange, everyDay, restoreOnStartup
}
I’m sure you understand I can’t just sit around hoping the problem will go away, I have to try things.
Replying to myself again with a progress report. I updated my test rule to look like this:
// Test case to debug issue with new Group functionality where member updates are handled differently
rule "Test_All_Lights_switches"
when
Item All_Lights_switches received update
then
logDebug("LUMENCACHE", "Rule: UI Light Test Switch:Starting")
Thread::sleep(300)
logDebug("LUMENCACHE", "State of Light_Master_bedroom_switch: " + Light_Master_bedroom_switch.lastUpdate("mapdb"))
All_Lights_switches.allMembers.forEach[ light_name |
logDebug("LUMENCACHE", "Rule: Test all Group member: " + light_name.name + " " + light_name.lastUpdate("mapdb"))]
val ChangedSwitch = All_Lights_switches?.allMembers.sortBy[lastUpdate("mapdb")].last as SwitchItem
logDebug("LUMENCACHE", "Rule: UI Light Test Switch ChangedSwitch: " + ChangedSwitch)
end
This will show all the light switches in the Group whenever a switch in the group is toggled.
This showed me in the log that one of the switches had a “null” timestamp. This is the relevant section:
2017-07-11 12:02:58.636 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: Test all Group member: Light_Garage_switch 2017-07-11T00:00:00.104-06:00
2017-07-11 12:02:58.642 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: Test all Group member: Light_Outdoor_Deck_Railing_switch null
2017-07-11 12:02:58.647 [DEBUG] [se.smarthome.model.script.LUMENCACHE] - Rule: Test all Group member: Light_Kitchen_switch 2017-07-11T12:02:57.322-06:00
In the UI, I toggled that specific switch and it got a timestamp in mapdb so now it isn’t null.
Now the test correctly reports the last switch toggled correctly!
It seems that the “null” value caused the lastUpdate to abort when it saw that null value.
I have no idea how this could have happened or how performing the OH2 update suddenly caused this to crop up. Perhaps that switch (which is seldom used), always had a “null” timestamp and some fix in the latest OH2 doesn’t let that go by unhandled anymore.
Anyway, I’ll re-enable all my rules and see if the issue is resolved.
Thanks to all who have assisted me, in the process of debugging this I learned lots of stuff too.
Often this sort of thing happens because when you wrote the rule all of your switches had a state. But when you upgraded that Switch no longer had a state. One thing that could explain that is that in 2.x, rrd4j no longer supports storing Switch Items. So perhaps you were relying on a restoreOnStartup from rrd4j which no longer works in 2.x to make sure that Item had a value.
To filter the null Items out you can do a line like the following:
val ChangedSwitch = All_Lights_switches?.members.filter[s|s.lastUpdate("mapdb") != null].sortBy[lastUpdate("mapdb")].last as SwitchItem
I’m gald you got it working!
Thanks Rich. My previous version was 2.1 (something from Feb-2017) that worked with no issues with rrd4j.
Anyway after understanding that I don’t really need rrd4j and my current mapdb setup is enough, I have now transitioned to just mapdb.
Thanks for the tip on detecting “null” timestamps.
sorry for bumping here.
I upgraded to OH 2.1 and hoped, that the group problem was solved.
In OH 2.0 the group membership for items very often was not updated. Should be fixed in OH2.1. But not at all. There are some szenarios where there is no update to the group membership of items. The only way is to restart OH. Is there an additional way just to recreate group memberships for items?
The problem you are describing is not the same as the problem primarily described in the thread.
The thread is about a change made to how the state of a Group is calculated which was necessary but which now requires the users to provide a type in their Group definitions for those Groups to receive updates. And this change is implemented and deployed, I think in 2.1, definitely in 2.2.
You are describing a completely different problem, if I understand correctly, the membership in your Groups is not being updated when you make changes to your Items.
I’ve seen this in the past and I think there is an issue open for it.
As far as I know there is still no solution for that. You must still restart OH to refresh group memberships. I know it adds an extra step but hopefully it’s not too painful for you. I know that’s one of the reasons I upgraded my platform from a Raspberry Pi 3 to an Intel i3 PC running Ubuntu. The speed difference is very appreciable.
On another note, I did some experimenting after updating to OH2.1 and found that if you create a group with mixed item types (Dimmers and Switches) it’s best to create the group as a Dimmer type. Since dimmer inherits the OnOffType base type (which is what a switch is) the system will not be confused by the inclusion of Switches in the group. This way whenever any of the items in the group receive updates the group will as well.
That way you can use the group in a rule that reacts to “received update”.
when
Item gRoomGroup received update
then
Do Stuff Here
end
An added benefit is that the system will not attempt to set invalid values on a Switch Group item when it gets a Dimmer command. Thus clearing up unnecessary errors in your log files.
Just thought some might be interested to know.
According to this: https://github.com/eclipse/smarthome/issues/3622
Group:Switch myGroup
should work for mixed item groups. I tested it but for me this does not work, only item type native groups are working.
Yes, according to the documentation that does work. And if you use it that does work. BUT, when you do that and one of the Dimmer items changes in the group you will always get an error that says an invalid value was set on the group item. However, if you make the group item Dimmer instead of a switch you will not get that error AND the received update trigger still works. My advice is there in order to reduce errors in your log. On top of which I don’t know what other issues those errors could be causing. This way you avoid the errors altogether.