[RELEASE] Custom Device Note App

Should populate on the first click, but what happens occassionally is that the input field hasn’t been completely saved. To work around that, enter your note and name, and then click off to the side somewhere before clicking the add button. (If you have the device page open you may need to refresh it also.) As to the order, unfortunately not under my control - would expect it to be added to the top or bottom, or appear alphabetically, but when look under the covers it appears to be a random placement.

BEST post I've read in a while! Ha! :rofl: :rofl: :rofl:

7 Likes

I have only used the app once so far to add a date change note to two devices.

If I later want to add additional devices, as I change more batteries, I will need one instance for each time I change a device?

So I could delete the app and then next time, create a new instance for a new set of devices. The notes already added will not be deleted if I remove the app instance?

If I want to change a date later, as long as I use the same naming convention I could change the value with a new instance?

You can change target devices inside the app at will, but some have a number of "groups" that they wanted to mass update on a regular basis so by allowing multiple instances of the app they can preserve the groups to update again later. Any instance of the app can be used to update any entry in the Data section of a device by using the name of the data item to be changed. Notes become part of the device database entry so removing the app has no effect on the data retention.

3 Likes

So I could have a battery date instance. Each time I open it I can just change the devices I want to edit and the custom note text, i.e. date, and it will only update those devices. The notes created in other devices in previous executions will not be effected?

Correct, only updates the devices currently selected.

2 Likes

It looks like the devices I have set notes on are not maintaining them. So far it's only two devices. They are both Zooz ZSE11 Q sensors. I added a BatteryDate and BatteryType note. If I update the note app and refresh the device page the notes appear. If I come back 10 or 15 minutes later the notes are gone. I guess it could be a device specific thing. Anyone else see this?

I guess I will add a note to another type device and see if it will maintain it.

Once it's been inserted it should stay until removed. I have seen where the data section order will change, or where a browser cache may not show it until it refreshes, but it becomes part of the device's database entry. I'll look and see if I can add some additional verification of success.

I added a battery type note to a Aeotec multisensor and waited about 5 minutes went back and the note was gone from it as well.

Another thing that may be an issue. I have a main rules hub. It has all my rules and apps. So my plan was to install your app on there and add the notes to the the hub mesh shared devices. So maybe it's an issue using hub mesh. I just put your app on one of my device hubs and added notes to the Zooz and Aeotec sensors. I will check them again in a bit and see if the notes are still there.

[Edit]it's been about 5 minutes and the notes are still there. I will wait about and hour and check again. Maybe it is a Hub Mesh issue. I didn't think it would work and figured I would need to put the app on the hub with the actual device. I thought I would test it though and it seemed to work, but apparently it only works temporarily.

If you're adding the note to the Hub Mesh shared device I believe it will be overwritten the next time the mesh sync's the device, will need to add the note from the device's paired hub. Not sure if there is a way around this or not.

3 Likes

Yeah that makes sense.

Adding the note from the hub with the device seems to have done it.

1 Like

I'm going to add a message display for any Hub Mesh devices that a note is attached to. (v1.0.1)

1 Like

I swear on my first 10 speed bike (WTF, 10 speeds!! OMG!!!) that I did exactly what you say above yesterday and it wasn't working for me, including repeatedly opening/closing device pages, refreshing the device pages, etc.

Of course now that your app knows you're watching it is behaving and works exactly as expected. I was able to remove the customNote entry this morning w/out issue.

So to avoid having to admit any potential user error on my part, I vote that we chalk this up to "overnight hub maintenance" clearing up some unknown issue that was blocking the removal. :wink:

2 Likes

Overnight maintenance can be a miracle worker :sunglasses:

2 Likes

The way I'm using this app is I have set up instances for "groups" of devices w/the same battery type, defined by battery type, e.g., all sensors w/CR2032, all sensors w/CR20, etc.

Then I have one instance that is my "single device update" instance that I use to select and update an individual device, e.g., put in the date in when I change a battery.

image

Works well for me this way. I like having the info in HE so it's all in one place (don't need to maintain a separate battery doc).

One thing I was wondering, is would it be possible to create a small app in HE that would allow you to choose devices and then display the Device name/battery date info in it. Presumably this would require that a consistent note name be used for the battery date (i.e., batteryDate) so the app could pick the right device note to display.

Not asking you to create this, @thebearmay, just wondering how feasible it would be and if it seems like a difficult coding task or not, and then I'll start pestering some other unsuspecting HE dev. :wink: As I noted earlier, this is always all about me. :smiley:

Thanks again for this app!

Would be a fairly simple app.

  1. Capability.* select to determine devices
  2. Accept a list of values to search for
  3. deviceList.each
    a) searchList.each
    a-i) getDataValue()
    a-ii) add to display

Cool...now I just need to find someone who is interested in making my life easier. :slight_smile: Hubitat devs...now is probably a good time to block me. :smiley:

2 Likes

Another anomaly, but probably expected. This doesn't seem to work on the old Iris V1 sensors I have. They probably use a different protocol than standard.

I have quite a few of the things. I don't use them in my house but I do use quite a few in my shop, and they work pretty well.

Let me look, I may have grabbed the wrong property to test against.

@danabw try this code:

Data Item Display
/*
 * Device Data Display
 *
 *  Licensed Virtual the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 *  Change History:
 *
 *    Date        Who           What
 *    ----        ---           ----
 */
import java.text.SimpleDateFormat
static String version()	{  return '2.0.3'  }


definition (
	name: 			"Device Data Display", 
	namespace: 		"thebearmay", 
	author: 		"Jean P. May, Jr.",
	description: 	"Display the capabilities, attributes, commands and device data for devices selected.",
	category: 		"Utility",
	importUrl: "https://raw.githubusercontent.com/thebearmay/hubitat/main/apps/xxxxx.groovy",
	oauth: 			false,
    iconUrl:        "",
    iconX2Url:      ""
) 

preferences {
   page name: "mainPage"
   page name: "deviceData"

}

def installed() {
//	log.trace "installed()"
    state?.isInstalled = true
    initialize()
}

def updated(){
//	log.trace "updated()"
    if(!state?.isInstalled) { state?.isInstalled = true }
	if(debugEnable) runIn(1800,logsOff)
}

def initialize(){
}

void logsOff(){
     app.updateSetting("debugEnable",[value:"false",type:"bool"])
}

def mainPage(){
    dynamicPage (name: "mainPage", title: "", install: true, uninstall: true) {
      	if (app.getInstallationState() == 'COMPLETE') {   
	    	section("Main")
		    {
                input "qryDevice", "capability.*", title: "Devices of Interest:", multiple: true, required: true, submitOnChange: true
                if (qryDevice != null) {
                    dataList = buildDataList()
                    input "varList", "enum", title: "Select data items to display", options: dataList, multiple: true, required: false, submitOnChange: true
                    if(varList !=null)
                        href "deviceData", title: "Display Data", required: false
                }
		    }
	    } else {
		    section("") {
			    paragraph title: "Click Done", "Please click Done to install app before continuing"
		    }
	    }
    }
}

def buildDataList(){
    List dataList = []
    qryDevice.each {
        it.properties.data.each {
            dataList.add(it.key)
        }
    }
    dataList = dataList.sort().unique()
    return dataList
}

def deviceData(){
    dynamicPage (name: "deviceData", title: "", install: false, uninstall: false) {
	  section("Device Data"){
          qryDevice.each{ x->
              paragraph "<p style='font-weight:bold;text-decoration:underline'>$x.displayName</p>"
              varOut = ""
              varList.each {
                  if(x.properties.data["$it"]) varOut+= "$it: ${x.properties.data["$it"]}<br>"
              }
              paragraph varOut
          }
       }
    }
}


def appButtonHandler(btn) {
    switch(btn) {
          default: 
              log.error "Undefined button $btn pushed"
              break
      }
}

def intialize() {

}