Page 1 of 1

read SValues content and put in a local variable

Posted: Sunday 22 October 2017 22:09
by TheCondor
Hello, i want to implement a monitoring script for check the state of my xiaomi vacuum.
I've installed the plugin and it works, in the device 'VACUUM' the SValues is CLEANING-CHARGING-PAUSED and i want to insert this value in a local variable and compare the state later such:

FIRST:
local STATE == domoticz.devices('VACUUM').Svalues

LATER:
if domoticz.devices('VACUUM').Svalues =~ STATE then
domoticz.notify........


any help how to get the Svalues? I know how to read the .state (that is ON when cleaning but OFF when both is in pause or charging so it's not usefull)...
Thanks in advance, cheers

Re: read SValues content and put in a local variable

Posted: Monday 23 October 2017 8:51
by dannybloe
You can read the rawData attribute as that should hold all the values. But it is better to create a deviceAdapter for this kind of device eventually.
For now you can dump all the attributes known to dzVents: myDevice.dump(). It will dump it's attributes to the Domoticz log.

And... you don't have to use uservariables. I'd use dzVents persistent variable support (see docs).