read SValues content and put in a local variable

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
TheCondor
Posts: 78
Joined: Thursday 18 June 2015 10:32
Target OS: Linux
Domoticz version:
Contact:

read SValues content and put in a local variable

Post 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
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: read SValues content and put in a local variable

Post 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).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest