My very first Dzventz "script" please help
Moderator: leecollings
-
- Posts: 19
- Joined: Saturday 09 September 2017 16:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
My very first Dzventz "script" please help
Hi all
I am trying to make a very simple "script"
I want a specific wallswitch to turn on/off a light.
1436 is wallswitch idx and 1424 is light idx.
What have i done wrong ?
return {
on = {
devices = {
'1436'
}
},
execute = function(domoticz,'1424')
local Living room = domoticz.devices('1424')
domoticz.ToggleSwitch ()
end
end
}
I am trying to make a very simple "script"
I want a specific wallswitch to turn on/off a light.
1436 is wallswitch idx and 1424 is light idx.
What have i done wrong ?
return {
on = {
devices = {
'1436'
}
},
execute = function(domoticz,'1424')
local Living room = domoticz.devices('1424')
domoticz.ToggleSwitch ()
end
end
}
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: My very first Dzventz "script" please help
Something with quotes and syntax. Try it like this
Code: Select all
--[[ toggler.lua
]]--
return {
on = { devices = { 1436 }}, -- Trigger = Switch device IDX
execute = function(domoticz,trigger)
local livingRoom = domoticz.devices(1424) -- Light IDX
livingRoom.toggleSwitch()
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 19
- Joined: Saturday 09 September 2017 16:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: My very first Dzventz "script" please help
thx very appreciated.
But there seems to be a litle bug in it.
Light turn on 2 sec and then turns of.
But there seems to be a litle bug in it.
Light turn on 2 sec and then turns of.
-
- Posts: 19
- Joined: Saturday 09 September 2017 16:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: My very first Dzventz "script" please help
Hold on.
I believe that nothing is wrong with you script.
I believe that nothing is wrong with you script.
-
- Posts: 19
- Joined: Saturday 09 September 2017 16:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: My very first Dzventz "script" please help
Thx again waaren
But realized that my actual lightswitch is not a on/off switch.
It is a "digital switch" sending a ON signal when pressed ,and is in "off" state when not pressed.
which makes using the toggle function a bad idea.
So i guess it needs to be done in a complete different way.
Any ideas ?
But realized that my actual lightswitch is not a on/off switch.
It is a "digital switch" sending a ON signal when pressed ,and is in "off" state when not pressed.
which makes using the toggle function a bad idea.
So i guess it needs to be done in a complete different way.
Any ideas ?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: My very first Dzventz "script" please help
Not a COMPLETE different way. Just a check on the state of the "trigger state" should do it.
Code: Select all
--[[ Toggler.lua
]]--
return {
on = { devices = { 1436 }}, -- Trigger = Switch device IDX
logging = { level = domoticz.LOG_DEBUG,
marker = "Toggler" },
execute = function(domoticz,trigger)
local livingRoom = domoticz.devices(1424) -- Light IDX
if trigger.state == "On" then
livingRoom.toggleSwitch()
end
domoticz.log("Trigger state ==>> " .. trigger.state .. "; Light state ==>> " .. livingRoom.state ,domoticz.LOG_DEBUG)
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- McMelloW
- Posts: 434
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: My very first Dzventz "script" please help
Perhaps this video might be some help
viewtopic.php?f=59&t=18143
viewtopic.php?f=59&t=18143
Greetings McMelloW
-
- Posts: 19
- Joined: Saturday 09 September 2017 16:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: My very first Dzventz "script" please help
Thank you Mcmellow
Belive it or not ,but have seen that video at least 5 times.and read the manual ..
But with no coding experience ,and limited Domoticz skilled ,the first steps are just so much harder.
I have learned so much over the last year ,but are also spending much more time than ,the more experience person.
But thx for the help and hints...
Moving forward ,but very slowly.
Belive it or not ,but have seen that video at least 5 times.and read the manual ..
But with no coding experience ,and limited Domoticz skilled ,the first steps are just so much harder.
I have learned so much over the last year ,but are also spending much more time than ,the more experience person.
But thx for the help and hints...
Moving forward ,but very slowly.
-
- Posts: 19
- Joined: Saturday 09 September 2017 16:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: My very first Dzventz "script" please help
hi again
Shouldn't this work then : just turning on a gruop of lights instead of 1 light.
--[[ Toggler.lua
]]--
return {
on = { devices = { 1439 }}, -- Trigger = Switch device IDX
logging = { level = domoticz.LOG_DEBUG,
marker = "Toggler" },
execute = function(domoticz,trigger)
local livingRoom = domoticz.group(1) -- Light IDX
if trigger.state == "On" then
livingRoom.toggleGroup()
end
domoticz.log("Trigger state ==>> " .. trigger.state .. "; Light state ==>> " .. livingRoom.state ,domoticz.LOG_DEBUG)
end
}
Hopefully last ??
Thxalot for the help
Shouldn't this work then : just turning on a gruop of lights instead of 1 light.
--[[ Toggler.lua
]]--
return {
on = { devices = { 1439 }}, -- Trigger = Switch device IDX
logging = { level = domoticz.LOG_DEBUG,
marker = "Toggler" },
execute = function(domoticz,trigger)
local livingRoom = domoticz.group(1) -- Light IDX
if trigger.state == "On" then
livingRoom.toggleGroup()
end
domoticz.log("Trigger state ==>> " .. trigger.state .. "; Light state ==>> " .. livingRoom.state ,domoticz.LOG_DEBUG)
end
}
Hopefully last ??
Thxalot for the help
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: My very first Dzventz "script" please help
syntax is domoticz.groups ; You forgot the s
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 19
- Joined: Saturday 09 September 2017 16:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: My very first Dzventz "script" please help
Exelent
thank you Waaren. Help is really much apreciated.
thank you Waaren. Help is really much apreciated.
Who is online
Users browsing this forum: No registered users and 1 guest