Dummy Device Attributes  [Solved]

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

Moderator: leecollings

Post Reply
mash47
Posts: 13
Joined: Wednesday 04 December 2019 13:25
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.10717
Location: Sheffield, UK
Contact:

Dummy Device Attributes

Post by mash47 »

I've set up a virtual device of type 'Dummy (Does nothing, use for virtual switched only'. Data is inserted by @MikeF 's 'Another sun position calculator'. When I run this DzVents script ...

Code: Select all

return {
	on = {
		devices = {
			'Sun azimuth'
		}
	},
	execute = function(domoticz, device)
	end
}
I see this in the log file ...
2019-12-04 21:02:03.043 Status: dzVents: Info: Handling events for: "Sun azimuth", value: "296.4"

I cannot find a way to grab the device value. device.name returns the device name, but device.data returns nil. device.Data doesn't work either.

What are the Dummy device attributes?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Dummy Device Attributes

Post by waaren »

mash47 wrote: Thursday 05 December 2019 9:29 I've set up a virtual device of type 'Dummy (Does nothing, use for virtual switched only'. Data is inserted by @MikeF 's 'Another sun position calculator'.
I cannot find a way to grab the device value. device.name returns the device name, but device.data returns nil. device.Data doesn't work either.
What are the Dummy device attributes?
The Dummy (Does nothing, use for virtual switched only) is actually your "hardware" You probably defined a virtual device connected to this dummy.
The device attributes in dzVents depend on the type of device you defined.

you can get all attributes and methods for this device by using the generic dump() method.

Try this

Code: Select all

return {
	on = {
		devices = {
			'Sun azimuth'
		}
	},
	execute = function(domoticz, device)
		device.dump()
	end
}
and check your log to see what the attributes are
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
boum
Posts: 135
Joined: Friday 18 January 2019 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: France
Contact:

Re: Dummy Device Attributes

Post by boum »

Hi, if you used a custom sensor attribute, you can get the value in device.state (and change it with device.updateCustomSensor(value))

But yes, when in doubt, use Waaren method and dump() to inspect the device innards :)
mash47
Posts: 13
Joined: Wednesday 04 December 2019 13:25
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.10717
Location: Sheffield, UK
Contact:

Re: Dummy Device Attributes  [Solved]

Post by mash47 »

Thanks guys, I just have to work out the rest of the DzVents syntax! I've been using Lua on a mios vera box for the last 8 years, DzVents is a steep learning curve at my age!
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Dummy Device Attributes

Post by waaren »

mash47 wrote: Thursday 05 December 2019 13:32 Thanks guys, I just have to work out the rest of the DzVents syntax! I've been using Lua on a mios vera box for the last 8 years, DzVents is a steep learning curve at my age!
Maybe the wiki and the youtube will help ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest