Smartapp settings value

I created a smartapp in lambda. There are some settings that can be updated outside the smartapp. I would like to display the value from the actual device vs the last used value in the smartapp. I can send defaultValue for a setting, but do not see value. How can I update the config after the app is installed?

1 Like

I believe @nayelyz can assist you

Thanks, @Andremain!

You could use the paragraphSetting and use .text() to change the displayed value, eg.

//This setting is used to show the remaining time (calculated inside the SmartApp) to turn off a device

I want it to be configurable from within the app. Looks like I need to create a device.

Using a variable placed in .text() will help you display its value every time you open the SmartApp and you can change it from within.
You can also share more details of your Use Case to see if there’s a better option.

I am making a smart app that can be used to configure z-wave devices. It would use a json file specific to the manufacturer, product id and product type id to present info on the device and allow configuration based on the parameters. I am able to use a custom capability to retrieve the current device state. My plan was have the user create 1 instance of the app per device to present the available configurations with valid options. The main challenge right now is the UI state can be different from the actual device state. I do plan to make a device to support automation, trying to figure out how to make the device dynamic based on what the device supports.

A SmartApp cannot be used to send Z-Wave commands, they’re generally used to:

  • Create subscriptions to capability events
  • Interact with devices that use HTTP or Third-Party APIs

Up to now, only the DTHs can interact with this kind of device (receive/parse events, configure parameters, etc.). See the guide to build a Z-Wave Handler.
Use the preferences tiles to set the configuration options available for the user and send those values to the config parameter of your device. You can take reference from a Device handler in the SmartThingsPublic repository, a good sample is Z-Wave Siren.

How are you retrieving the status in the custom capability?
Do you have an existing DTH to include your Z-Wave device in the network?

I have already built a DTH for some devices which includes the preferences. The problem is existing handlers do not have the preferences for a specific device. I wanted to create something more dynamic which would allow configuration of any z-wave device. The preferences also do not allow automation which could be used for some interesting cases. For example a dimmer may have a configuration to set the initial level when activated via the switch. Being able to automate that would allow maybe a different value for early mornings or after bedtime. It could all be done on a 1 off but cooler to be robust. I was thinking to make a capability which had some commands and states for parameter[1-255]. Then generate a device profile specific to the capabilities available on a given device. I need to try it out manually a bit and see how possible that would be. Still trying to understand the logistics between the app and device which would connect the real z-wave device and the “capability control device”. I think the app can be used to bind them to exchange info based on state updates received by the local dth.

1 thing that is confusing is how the ‘components’ are used. I see the old documentation talked about child devices, but that caused me issues with alexa and google assistants.

Sorry let me clarify, I dont expect to send z-wave commands from the smart app. I exposed a command and attribute on the dth that allow me to execute the configure command and get the current value. This way its easier to add the capability to multiple DTH without needed device specific info. In the lambda function I can dynamically display content for any zwave device.

Ok, let me see if I understand you correctly:

  • You want to change a configuration parameter based on a capability event
  • From the SmartApp you want to trigger an event in the DTH that would send that parameter to the device (this would be through the Custom Capability)

This structure is recommended for devices that have several components (generally with the same capabilities) that must be controlled independently, eg. the Smart Light Strips.

If my understanding is correct, this sample could help you understand the flow you can follow:

  1. I modified an existing DTH for a Z-Wave device to include a custom capability:
    • The capability uses the List Display type that provides 3 options but its command can be called from the mobile app, the API, and the SmartApp.
  2. In the DTH, the capability command it’s defined to assign a value based on the option selected and save it in state
  3. As the device I worked with is a sleepy device, I send the config parameter when the WakeUp Notification event is acknowledged
  4. In the SmartApp, I subscribe to a device’s Switch capability “ON” event and select the Z-Wave device to authorize the ability to send commands.
  5. I send a command to the custom capability when the “ON” event is received.