dzVents switchOn Dummy Hardware not working

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

Moderator: leecollings

Post Reply
wizzard72
Posts: 116
Joined: Friday 20 December 2013 7:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

dzVents switchOn Dummy Hardware not working

Post 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
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: dzVents switchOn Dummy Hardware not working

Post 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
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents switchOn Dummy Hardware not working

Post 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')
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
wizzard72
Posts: 116
Joined: Friday 20 December 2013 7:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents switchOn Dummy Hardware not working

Post 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 1560 times
Then I can make my switch:
Dummy-02.PNG
Dummy-02.PNG (31.05 KiB) Viewed 1560 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.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents switchOn Dummy Hardware not working

Post 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.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
wizzard72
Posts: 116
Joined: Friday 20 December 2013 7:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents switchOn Dummy Hardware not working

Post by wizzard72 »

I have replaced all my Dummy switches like mivo said. So no hurry for me :-)
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest