HE state variables


#1

@E_Sch is it possible to access the device state variables in WC? I’m most interested in the battery info. The full device driver probably has the info but I’d like to stick to the lite driver if possible.

image


#2

He does not provide an api for this (from the outside of an app or device) to read their state.

If you control the device source, you can add your own attributes for these.


#3

I have never done that, any example?


#4

attributes are defined in a device handler with lines like:

attribute 'alert', 'string'

They are set to values via

sendEvent(name: 'alert', value:'somestring')

Likely where the state variable is set is where you would add the sendEvent to update the attribute

This page has more developer documentation or you can look at existing drivers to understand


#5

Thank you. I will take a stab at it.