Page 1 of 1

dzVents switchOn Dummy Hardware not working

Posted: Tuesday 11 July 2017 23:50
by wizzard72
I have domoticz version 8072 and I'm trying to learn dzVents (I have a lot of lua scripts I want to convert to dzVents). My first script to switchOn a Dummy Switch is not working:

Code: Select all

return {
	active = true,

	on = {
		devices = {
			'dzVents'
		},

	},

	-- actual event code
	-- in case of a timer event or security event, device == nil
	execute = function(domoticz, device)
	    if (device.state == "On") then
			local test = domoticz.devices('Vakantie')
			test.switchOn()
		end


	end
}
The log gives me this error:
2017-07-11 23:43:44.980 User: Wizzard72 initiated a switch command (764/dzVents/On)
2017-07-11 23:43:45.443 dzVents: Info: Handling events for: "dzVents", value: "On"
2017-07-11 23:43:45.444 dzVents: Info: ------ Start internal script: dzVentsTest: Device: "dzVents (Domoticz Dummy Switches)", Index: 764
2017-07-11 23:43:45.444 Error: dzVents: Error: Method switchOn is not available for device "Vakantie" (deviceType=Lighting 1, deviceSubType=X10). If you believe this is not correct, please report.
2017-07-11 23:43:45.444 dzVents: Info: ------ Finished dzVentsTest

Re: dzVents switchOn Dummy Hardware not working

Posted: Wednesday 12 July 2017 8:22
by mivo
wizzard72 wrote: 2017-07-11 23:43:45.444 Error: dzVents: Error: Method switchOn is not available for device "Vakantie" (deviceType=Lighting 1, deviceSubType=X10). If you believe this is not correct, please report.
Hi,

problem is your deviceType / SubType (deviceType=Lighting 1, deviceSubType=X10) - not defined in dzVents device-adapters suitable for switchOn method. How do you create this virtual switch ? All my virtuals are Type: Light/Switch, SubType: Switch.

You can try generic method: setState(newState)

Code: Select all

test.setState("On")
Or create device-adapter script

Re: dzVents switchOn Dummy Hardware not working

Posted: Wednesday 12 July 2017 8:41
by dannybloe
Yes indeed. The trick is for the adapters to detect the proper device type and I didn't know about X10. There is so much hardware and types and subtypes that I cannot know them all. So indeed it is interesting to know how you created this device. We definitely have to adapt or create an adapter for this type of device.
In the mean time you can do this:

Code: Select all

domoticz.sendCommand('Vakantie', 'On')

Re: dzVents switchOn Dummy Hardware not working

Posted: Wednesday 12 July 2017 9:16
by wizzard72
I create Dummy switches in the "Switches" page. On the left there is a button "Manual Light/Switch".
Dummy-01.PNG
Dummy-01.PNG (87.09 KiB) Viewed 1568 times
Then I can make my switch:
Dummy-02.PNG
Dummy-02.PNG (31.05 KiB) Viewed 1568 times
There is no "Type" dummy, so I picked one. I thought this was the way to create dummy switches. But now I saw I can create a dummy switch from the "Hardware" page.

Re: dzVents switchOn Dummy Hardware not working

Posted: Wednesday 12 July 2017 9:23
by dannybloe
Ah yeah, this is also possible. Totally forgot about this option as I never ever use this. But I'll explore to see what more device types one can create.

Re: dzVents switchOn Dummy Hardware not working

Posted: Wednesday 12 July 2017 10:00
by wizzard72
I have replaced all my Dummy switches like mivo said. So no hurry for me :-)