Send Events to update state

I can't find any documentation of the API docs about this so sorry for all the post today.

I am wanting to push an updated to a custom state when cmds are run from the device page. I am surely missing something. The STT documentation uses Tiles which Drivers don't so I am having trouble finding the solution

Using

sendEvent(name: "LED status", value: "Notifications")

This works find but each time I send the event instead of updating it duplicates the event on the device page. I tried adding

sendEvent(name: "LED status", value: "Notifications", isStateChange: true)

and that didn't work anywhere? Am I missing DEV documentation somewhere or is it more trial and error?

The second one looks good to me. It might be a problem with your name being case sensitive.

So try "led status" to see if that works!

Cheers
Mike

No go

sendEvent(name: "led mode", value: "Normal",isStateChange: true)

stat

Have you tried using a camelCased variable name?

sendEvent(name: "ledStatus", value: "Notifications")
1 Like

camelCase for the win!

Is there documentation I am missing or is it all just trial and error? It appears allot of stuff from STT isn't supported in drivers (but probably apps)

1 Like

How did you define the attribue?

Yes a bit of trial and error!

I use these as reference point sometimes.

I didn't set an attribute is that needed?

I am pretty new at this myself so you got me thinking about your question, lol.

I think if you want to show this state on a dashboard it needs to be defined as an attribute. Someone can correct me if I am wrong.

I am wondering if that is why it doesn't show at load but does show after running the command to fire the event. I will wait on someone else to answer the proper process of

Getting current state on load of driver page

You have to define an attribute if you want to set a state and send an event for it. yes it will show on the page dynamically but it does not get stored in the database since it is an event for an attribute that does not exist.

2 Likes

Or you could just pop this into your driver code and see what happens!
Put it in the metadata somewhere below the commands.

	attribute	"ledStatus", "string"

Thanks again Chuck your my hero today!