[ST Edge] Device Preferences

Erick (or anyone!)-

Can you elaborate a bit further on how you envision things to work where you would have a driver you are distributing via a channel, but your driver also implements device preferences. If the driver package is installed directly onto the hub via the channel, then how would a user tweak any device preferences? Doesn’t the tweaking have to be done on a computer with the package source files? So maybe implementing device preferences precludes distribution of the driver via channels?

Is there any way to download a package FROM a hub to your computer that has been installed via a channel? I haven’t seen a CLI command to do that so I think the answer may be ‘no’.

1 Like

I think I am missing something. ‘Device Preferences’ are the same concept as ‘preferences’ in a DTH - the ‘Settings’ in app speak - so why would a user want to mess with them any more than any other part of the source? Or are we talking about preferences in another sense?

Sounds like (settings)device preferences, I have devices, greenwave single power node , fibaro rgbw that have multiple configurable preferences at present using the old dth’s , these are configurable via the device page in the ST app (settings), sounds like @TAustin is asking about those in app device specific preferences

1 Like

Yes, that is what I was saying. ‘Device Preferences’ in the device profiles are like preferences metadata in a DTH. Users set the values in the app Settings.

1 Like

Well I guess I’m not understanding how Device Preferences work then. I had mistakenly believed that the preferences themselves were captured in the device profile, but that’s just the metadata. The documentation is silent about how a user actually sets the preferences, and it’s that part I’m still fuzzy on. Is the only way with a SmartApp or is there some other mechanism in the mobile app to do that that I’m missing?

That’s a SmartApp, right? I want to avoid that until SmartThings comes up with a way to run SmartApps without requiring your own cloud server.

You should be able to go the device details page in the mobile app and select Settings from the three dot menu, as you can with other devices.

1 Like

Do you mean ‘Edit’ ? So you’re saying any preferences I define for a device will show up on that Edit device page (along with Location and Room)? Would be nice if the documentation would just say that!

Thanks for the clarification.

Device Preferences act as parameters where you can enter a value (from the app) and use it in your Driver eg. to send configuration commands to your device. When you change a preference, the infoChanged lifecycle is called.

If we have this preference:

 - name: "garageSensor"
    title: "Use on garage door"
    required: false
    preferenceType: enumeration
    definition:
      options:
        "Yes" : "Yes"
        "No"  : "No"
      default: "No"

We can access its value using: device.preferences.useOnGarageDoor

Why do you want to include Room and Location?

Do you mean this documentation?
https://developer-preview.smartthings.com/docs/devices/preferences/preferences

Thanks - I understand what they are and how they can be used by the driver, and how you define the metadata for them. But I wasn’t clear where and how the end-user actually sets their values. Yes, that documentation doesn’t say anything about that.

Can you confirm that it is supposed to be on the device edit page in the mobile app? So any preferences the driver defines for a device will be included on the device edit page?

It’s in Device details > Settings as Graham said. Here’s a example, if you don’t have any preferences in your device, this option is not shown.

Hello @nayelyz ,

I am going to bring here the topic of preferences that affect the configuration of the report intervals of temperature, battery … of zigbee devices, that we talked about yesterday, so that it is together in this thread of the device preferences topic.
As I mentioned to you, I don’t see a way to do it in driver as if it could be done in DTH.

I have copied post, if you can or want to move it from the other thread, I delete it.
Thanks

Thanks, i will wait.

The use of default configuration values ​​of the devices greatly facilitates the writing of drivers, but if they cannot be overwritten it will limit the options for using the devices.

To change the settings of the temperature report intervals for the smartthings multisensor is not a whim, it is a matter of excessive battery consumption.
These have a CR2450 battery and with the default values:

  • minimum interval: 30 sec
  • Maximum interval: 300 sec
  • Reportable change: 0.1º
    In practice, it sends a report for every 0.1º change or every 5 minutes, whichever occurs first if temperature change.
    Whoever designed this device with this battery, I don’t think they thought it was going to be used by default with a precision of 0.1º. Temperature sensors on doors and windows are not suitable for use as thermostats. They do not give usable and reliable information unless they are posted on interior doors of the house.

I use the modified dth to save battery with values since 9 month:

  • minimum interval: 30 sec
  • Maximum interval: 3600 sec
  • Reportable change: 1º
    With these values, it sends a report every 1º change or every 1 hour, whichever occurs first if temperature change.
    The battery has consumed 17% from the end of Nov 2020 until yesterday August 30, 2021, when I installed the edge driver.

When I installed the edge driver the battery showed the same level as with the DTH, 83%.
In just 24 hours with the default values ​​it has consumed 4% (79%)

UPDATED:

In 3 days the battery has already consumed 15%, it shows 68%

I have three smartthings sensors, now aeotec, and I use them for door and automation control and the temperature only as statistical information. If they can’t be modified I’ll have to throw them away when groovy disappears. I do not plan to change batteries every 20 days or put a glob of AA batteries attached to the sensor, hahaha …

On the other hand, another “Health poll” seems to be another default value, which is seen in the logcat every 30 sec. I don’t know what impact this will have on the devices with battery. With DTH I am not aware of this being the case on all devices.

1 Like

Thanks - I don’t have any devices that show the Settings option. Can you post an example image of the settings screen itself please?

Thank you.

You said you had a multipurpose smartthings, right?
That one has temperature and garage door use preferences.

3 Likes

Ahhhhh you are right! THANK YOU!!

2 Likes

Please, take a look at my post here:

Nayely - I would recommend that in that documentation, there needs to be some clarification to this sentence:

Users are then able to change the Preference to customize their Device.

You should add further clarification like:

Users are then able to change the Preference to customize their Device by selecting the Settings option from the device details menu.

This will avoid others having the same confusion that I had.

2 Likes

Thank you for the feedback, @TAustin. I’ll share it with the corresponding team :smiley:

A bit more feedback after I’ve gotten the preferences (Embedded directly into the Device Profile of the Device) mostly working:

Following is observed on iOS version of mobile app…

  1. The order of the preferences displayed on the settings screen is not what I put in my profile. They’re not in alphabetical order either, so seems kind of random. I’d much prefer them in the order I put them in the preferences section of the device profile.
  2. For string fields , it seems to want to capitalize the first letter of the value displayed (not necessarily desired). However when you tap on the field to edit it, the first letter is not capitalized.
  3. For string fields of type=password, I expected the display and input to be ‘*****’ to hide it, but that is not the case. So what is the purpose of defining a field as type=password?
  4. It seems there is no way to delete the contents of a field that has a default value defined for it. If you edit the field and delete all the characters and hit ‘done’, and then go back in again, the default value is back in there. Any recommendations here? If you want the user to optionally provide an empty field - and have that passed back to the driver, does that mean you can’t have a default value?
  5. The changes made in the Settings screen invoke immediate lifecycle updates to the driver as soon as the user presses the done button on a field. So if a user is going back and forth and changing various fields multiple times, it results in multiple lifecycle calls to the driver. (This is a warning to anyone writing a driver that handles these!) I think I would prefer not to get the lifecycle update until the user exits the settings screen after they’re satisfied with their changes. Getting them realtime can cause an awful lot of (possibly harmful) churn in the driver. Think of an IP address field that gets rapidly edited multiple times for whatever reason (people are funny…): every time you receive that lifecycle update you’re going to go try and reconnect to the device at that IP address. You can see where this could cause trouble…

EDIT regarding #5 above. I think the most logical thing to do if possible, is change the ‘Save’ button for each individual field to ‘OK’, and put a new Save button on settings screen.

Thanks for listening!

6 Likes

I have an integer type field defined with a 5-digit maximum but the settings screen in the (iOS) app only lets you tap ‘Save’ if you enter 3 digits or less. You can type more than 3 digits, but as soon as you do, the ‘Save’ button disappears as if it’s an invalid value. Even the default value can’t be saved!

Here the profile definition:

- title: "Port Number"
    name: portNumber
    description: "Port number of Envisalink"
    required: true
    preferenceType: integer
    definition:
      minimum: 1
      maximum: 65535
      default: 4025

Please let me know if I’ve done something wrong!

p.s. Any comments on my prior post??

1 Like