Page 1 of 1

Dummy Device Attributes

Posted: Thursday 05 December 2019 9:29
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?

Re: Dummy Device Attributes

Posted: Thursday 05 December 2019 10:03
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

Re: Dummy Device Attributes

Posted: Thursday 05 December 2019 10:05
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 :)

Re: Dummy Device Attributes  [Solved]

Posted: Thursday 05 December 2019 13:32
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!

Re: Dummy Device Attributes

Posted: Thursday 05 December 2019 23:29
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 ?