Blockly script not reacting to Hue dimmer switch

Moderator: leecollings

Post Reply
hscholing
Posts: 9
Joined: Tuesday 25 September 2018 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Blockly script not reacting to Hue dimmer switch

Post by hscholing »

I have in my living room a mixed setup of 3 Philips Hue bulbs and 3 IKEA bulbs. I'm now trying to let the IKEA bulbs react on a HUE bulb so my lights all can go on at the same time.

To do so I created 2 Blockly scripts and I grouped the IKEA bulbs in one group. My blockly states that when one of the Philips bulbs gets turned on the group of IKEA bulbs will also be turned on. Same way the other way around. When clicking in my Domoticz on the switch the Blockly scripts reacts and turns my IKEA group on or off. Great! But the problem is now the following:

I also use a Philips Hue dimmer and when using this remote to turn my lights on (so including the one that triggers the Blockly script) the Blockly script is not activated. I can see that the switch for this light is on in my dashboard, but no Blockly response. This is the same when turning the specific HUE light off. Can somebody telling my if I'm doing something wrong and how to fix this? My livingroom is now partly dark :)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Blockly script not reacting to Hue dimmer switch

Post by waaren »

hscholing wrote: Monday 29 July 2019 20:59 ..when using this remote to turn my lights on (so including the one that triggers the Blockly script) the Blockly script is not activated. I can see that the switch for this light is on in my dashboard, but no Blockly response. This is the same when turning the specific HUE light off. Can somebody telling my if I'm doing something wrong and how to fix this?
You don't do anything wrong but the way the Hue light state change is send to domoticz is not picked up by Blockly. If you do want this functionality you will have to switch to dzVents or classic domoticz Lua.

in dzVents it could look like

Code: Select all

local lights = { 'IKEA-1','IKEA-2','IKEA-3', 'Hue-1', 'Hue-2', 'Hue-3' } 

return
{
    on = 
    {
        devices = lights,
    },

    execute = function(dz, item)
        local IKEA_group = { 'IKEA-1','IKEA-2','IKEA-3' }
        local Hue_group = {'Hue-1', 'Hue-2', 'Hue-3' }

        dz.log('Device ' .. item.name .. ' was switched ' .. item.state , dz.LOG_INFO)
    
        local function inTable (table, key)
            for _, name in ipairs(table) do
                if name == key then return true end 
            end  
        end

        if item.active then 
            if inTable(IKEA_group, item.name) then
                for _, name in ipairs(Hue_group) do
                    dz.devices(name).switchOn().silent()
                end
            else
                for _, name in ipairs(IKEA_group) do
                    dz.devices(name).switchOn().silent()
                end
            end
        end
    end
}


When not yet familiar with dzVents please start with reading Get started Before implementing. Special attention please for
"In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents disabled' is not checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
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 0 guests