How to create a settings option in DTH?

(Jack) #1

I am building a ZigBee DTH for a light switch. However, the status of the light switch does not correctly resemble the actual state of the lights. So I have added a feature to “reverse” the status. It looks like this:


However, I don’t want people to accidentally press the “reverse” button since they only need to set this option once. So I want to move this feature to the settings option so that it looks like the the circled area below:


How can I make this settings option in my DTH?

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

In a DTH, these are called Preferences (not Settings).

The input types are specified here:

(Jack) #3

@tgauchat When I change the preference to “true” or “false”, how do I add functions that will handle these actions?

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #4

Read the manual?

(Jack) #5

@tgauchat Yes, but what do I name the “someCommandMethod”. And how is it called when the user changes the value?

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #6

Preference inputs do not call methods.

Please read the entire development manual.

It has plenty of examples.

(Jack) #9

@tgauchat So, I am also able to invert the status on the app directly from my device. Is it possible for the preference to be updated too?

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #10

I don’t think so.