Output:
batteryMap: [9053:[bType:USB, bDate:2024-11-23, dName:Back Door Keypad, bWarnLvl:30]]
ERROR: groovy.lang.MissingPropertyException: No such property: bType for class: java.lang.String Possible solutions: bytes on line 211 (method pageConfig)
When you save the device's map into state, "${deviceMap}" converts the device map into a long string. So the state is saved as Map<String,String> instead of Map<String,Map<String,String>>. That means upon read, tItem is just a String. Using put("${deviceId}", deviceMap) allows it to work.
I plan to release this ... hopefully soon. Working on the final feature: allowing users to choose the Device Data field names and then migrate current battery data from previous field names, while translating the formats (e.g. dates).
I'm like 1,500 lines away from fininshing my battery tracking app, but since 1) I don't know how to code at all, and 2) You are almost done; I'll set that project aside.
Ha! The release will support the reporting (as I pasted earlier) and also various kinds of tracking and notifications: low battery (%), new battery (%), old battery (based on average life expectancy), and dead battery (last activity). The device data will hold the battery type, battery change date, and battery age history (list of previous battery ages). If you have other suggestions, please share. My brain is all battery all the time right now
I wish I had goats...my wife has a friend who has them and the pictures and descriptions of the younger one's shenanigans are hilarious. I hope yours are equally entertaining.
My father had five to seven llamas for years...def not as fun as goats, and man did they poop a lot...
I track historical change dates to ID if I have devices w/worsening battery life over time. So some way to keep track of that data could be helpful. I do it this way now, listing multiple dates in the entry in Data:
BatteryChangeDate: 02-28-24 -- 03-15-23
Over time I can see if the change dates start getting closer together or not. I've had some older devices start to show their age by having shorter and shorter battery life w/same usage, leading me to replace them after a while so I'm not wasting batteries.
Could be accomplished by having a way to display a battery change date history. Seeing the actual dates is more helpful for me than having a showing calculated average number of days between changes, as I would likely not see a trend in that case. Make sense?
The app tracks this information, but in a slightly different way. Instead of maintaining a history of each battery change date, it keeps a history of each previous battery age at death. For instance, batteryLifeWks (or whatever you choose to name it) is a comma-separated field that holds the battery lives (in weeks): 50,52,48,etc. ... as many as you wish to keep. The app supports automatic (app-detected) or manual updates of this field upon battery changes.