Multiple devices in "on" part

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

Moderator: leecollings

Post Reply
rizzah
Posts: 75
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Groningen
Contact:

Multiple devices in "on" part

Post by rizzah »

Hi,

I used this line (which works):

Code: Select all

    on      =   {   devices = {["Overloop_Sensor"] = {"on mon,tue,wed,thu,fri,sat,sun"}},
Now i got a second sensor so i tried this:

Code: Select all

    on      =   {   devices = {["Overloop_Sensor" or "Overloop2_Sensor"] = {"on mon,tue,wed,thu,fri,sat,sun"}},
But i'm not sure if this is the correct way of doing it, could someone help me with this?

Regards,
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Multiple devices in "on" part

Post by waaren »

rizzah wrote: Saturday 12 January 2019 19:30 Now i got a second sensor so i tried this:

Code: Select all

    on      =   {   devices = {["Overloop_Sensor" or "Overloop2_Sensor"] = {"on mon,tue,wed,thu,fri,sat,sun"}},
But i'm not sure if this is the correct way of doing it, could someone help me with this?
Try it like this.

Code: Select all

local timeTable = {'at 13:00-22:00 on sat','at 19:00-23:30 on mon,tue,wed,fri','at 19:00-02:30 on thu'}
return {
            on =    {  
                        devices =   { 
                                        ['Motion Kantine']           = timeTable,
                                        ['Status_Muziek']            = timeTable,
                                        ['Verlichting_Kantine_Mode'] = timeTable
                                    }
                    },

    logging =   {   level   =   domoticz.LOG_DEBUG,
                    marker  =   "helper"               },
     
    execute = function(dz, item)
        
        local function logWrite(str,level)
            dz.log(tostring(str),level or dz.LOG_DEBUG)
        end

        logWrite ("triggered by " .. item.name)
    end
}              

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest