How do I trigger the script?

Moderator: leecollings

Post Reply
Stefano1232
Posts: 6
Joined: Thursday 16 May 2019 5:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

How do I trigger the script?

Post by Stefano1232 »

Hi, Im new to this whole blocky thing, I am just wondering how i would go about triggering a script to begin with? When i switch the trigger to devices, how do i pick which device triggers the switch?

Basically i have a zwave Button which when i press I want it to execute the code. The code is just a simple "If light is off, then turn on, else if light on, then turn off"

I got it to turn on a light with using groups and scenes, but i want that button to both turn off AND on the light, and scripting/blocky seems like the right way? But im really confused as to how to trigger the script.

Thank you
dressie
Posts: 156
Joined: Monday 25 May 2015 22:44
Target OS: Raspberry Pi / ODroid
Domoticz version: V2020.2
Location: Netherlands
Contact:

Re: How do I trigger the script?

Post by dressie »

Welcome!

Make sure you check out the Wiki pages and the script forms, you'll find enough examples there to get an idea :)
My first scipt was:

IF hall-motion IS ON --(hall-motion is the trigger)
THEN turn on hall-light --(hall-light is the light bulb that goes on)

Good luck, and have fun making scripts!!
mrf68

Re: How do I trigger the script?

Post by mrf68 »

Hi Stefano1232,

in your case the logic is:

If zwave button is pressed AND the light is Off then turn the light On.

And a second script:

If zwave button is pressed AND the light is On then turn the light Off.

You can combine them with an else/if, but when it’s not working it is harder to troubleshoot, especially when you’re new to thing. Try to keep it simple and test every step. Have fun.
Stefano1232
Posts: 6
Joined: Thursday 16 May 2019 5:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How do I trigger the script?

Post by Stefano1232 »

HI, it doesn't seem to work, i have it at:

If button = on AND light = off
set light = on
else if button = on AND light = on
set light = off

but it doesn't work
mrf68

Re: How do I trigger the script?

Post by mrf68 »

I’m not able to troubleshoot this with only this information. Attach a screenshot of the blockly, tell us what the log is showing when you try to do the trick. Are all switches available in Domoticz? Is it an On/Off button or just a single click? What products do you use?
Stefano1232
Posts: 6
Joined: Thursday 16 May 2019 5:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How do I trigger the script?

Post by Stefano1232 »

Im at work at the moment, ill attach a screenshot later, but when i use group/scene (add button as the activation device, and the light as the thing that gets changed) it works fine. So it must all be there and working.

Im using the zwave aeotec wallmote (https://aeotec.com/z-wave-wireless-switch) and the Aeotec Z-Wave Dimmable LED RGBW Light Bulb (http://www.smartliving.com.au/aeotec-z- ... -bulb.html)

The wallmote two buttons work, but the sliding and long hold does not work with domoticz (Which isnt the problem, thats why i want to use the blocky code to get around that)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest