Convert blocky script to dzVents

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

Moderator: leecollings

Post Reply
User avatar
raymond1972
Posts: 32
Joined: Wednesday 28 February 2018 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Convert blocky script to dzVents

Post by raymond1972 »

Hi all,

Recently I upgraded my Domoticz installation to Domoticz 2020.2
I would like one of my blocky scripts to be converted to dzVentz.

Can anyone help me to get this done properly?

Please find my attached screenshot of the blocky script I want to convert.
Schermafbeelding 2020-07-29 om 11.20.27.png
Schermafbeelding 2020-07-29 om 11.20.27.png (40.12 KiB) Viewed 523 times

Kind Regards,
Raymond
HW:Raspberry Pi 3 B, Raspian stretch, Nano, Aeon Labs Aeotec Gen 5 Z-Wave USB
Raspberry Pi 4, Raspian buster, Nano, Aeon Labs Aeotec Gen 5 Z-Wave USB
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Convert blocky script to dzVents

Post by waaren »

raymond1972 wrote: Wednesday 29 July 2020 11:24 I would like one of my blocky scripts to be converted to dzVentz.
What are the types / subtypes of "Hal verlichting" and "Hal Schemer" as shown on the devices tab ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
raymond1972
Posts: 32
Joined: Wednesday 28 February 2018 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Convert blocky script to dzVents

Post by raymond1972 »

Hi @Waaren,

Thank you for your quick response.
the device types are:

Hal verlichting : script device - light switch - selector switch
Hal schemer : zwave device - lux - lux
Sensor - Voordeur : zwave device - light switch - switch
Hal Beweging : zwave device - light switch - switch

set group Hal aan ECO : group

Kind Regards,
Raymond
HW:Raspberry Pi 3 B, Raspian stretch, Nano, Aeon Labs Aeotec Gen 5 Z-Wave USB
Raspberry Pi 4, Raspian buster, Nano, Aeon Labs Aeotec Gen 5 Z-Wave USB
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Convert blocky script to dzVents

Post by waaren »

raymond1972 wrote: Wednesday 29 July 2020 13:13 The device types are:
Please check spelling (case etc.. ) before saving

Could look like something below

Code: Select all

return
{
    on =
    {
        devices =
        {
            'Hal verlichting',
            'Sensor - Voordeur',
            'Hal Beweging',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- change to domoticz.LOG_ERROR when all is OK
        marker = 'Hal beweging',
    },

    execute = function(dz, item)
        local halLight = dz.devices('Hal verlichting')
        local halTwilight = dz.devices('Hal Schemer')
        local frontDoor= dz.devices('Sensor - Voordeur')
        local halMotion = dz.devices('Hal Beweging')

        local halECOGroup = dz.groups('Hal aan ECO')

        if halLight.levelName == 'Beweging' and halTwilight.lux < 75 and frontDoor.state == 'Open' and halMotion.active then
            halECOGroup.switchOn()
        else
            halECOGroup.switchOff()
        end

    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
raymond1972
Posts: 32
Joined: Wednesday 28 February 2018 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Convert blocky script to dzVents

Post by raymond1972 »

Hi Waaren,

Thanx for setting me up.
I will definitely try this.

Thanx
HW:Raspberry Pi 3 B, Raspian stretch, Nano, Aeon Labs Aeotec Gen 5 Z-Wave USB
Raspberry Pi 4, Raspian buster, Nano, Aeon Labs Aeotec Gen 5 Z-Wave USB
Post Reply

Who is online

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