give philips hue light a color

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

Moderator: leecollings

Post Reply
Frankseijts
Posts: 7
Joined: Friday 18 October 2019 20:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

give philips hue light a color

Post by Frankseijts »

Hello,

this is my first day of dzVents script and after some ours i did get my lamp on and of but now i want color to
this is my script

Code: Select all

return {
    active = true,
    on = { 
        timer = { 
            'at 15:00-15:01',
          },
    },
    execute = function(domoticz, dummy)
        domoticz.devices('Hue color lamp 3').toggleSwitch()
          
        domoticz.myLight('Hue color lamp 3').setRGB(124, 233, 11)
        
        

	end
}
can some one help me
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: give philips hue light a color

Post by waaren »

Frankseijts wrote: Sunday 20 October 2019 15:11 I did get my lamp on and of but now i want color to
can some one help me
I don't understand why you used myLight but maybe this is what you intended ?

Code: Select all

return {
    active = true,
    on = { 
        timer = { 
            'at 15:00-15:01',
          },
    },
    
    execute = function(domoticz)
          myHueLamp = .devices('Hue color lamp 3')
    	
          myHueLamp.toggleSwitch()
          myHueLamp.setRGB(124, 233, 11)
    end
}

If you start with a new script and it is not working as expected it can help to switch on debug loggging in the script and look at the log what happens during execiuion.

It would then look like

Code: Select all

return {
    active = true,
    on = { 
        timer = { 
            'at 15:00-15:01',
          },
    },
    	
logging =
    {   
        level = domoticz.LOG_DEBUG,
        marker = "Hue light test",
    },

    execute = function(domoticz)
          myHueLamp = .devices('Hue color lamp 3')
    	
          myHueLamp.toggleSwitch()
          myHueLamp.setRGB(124, 233, 11)
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Frankseijts
Posts: 7
Joined: Friday 18 October 2019 20:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: give philips hue light a color

Post by Frankseijts »

Thank jou very much,

I did chose mylight because wen i was seaching the web to find out how i can get color to my lamp.
i was reading that in a new update of dzVents mylight was the trigger to set collor
but i wil look at the log wat happend wit the logging in the script
Frankseijts
Posts: 7
Joined: Friday 18 October 2019 20:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: give philips hue light a color

Post by Frankseijts »

i did use the script

but this is the error what i get

2019-10-21 21:01:00.492 Error: dzVents: Error: (2.4.29) Hue light test: ...omoticz/scripts/dzVents/generated_scripts/Hal - Hue3.lua:16: attempt to call global 'devices' (a nil value)

i attempt to find the problem but i didnt find it
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: give philips hue light a color

Post by waaren »

Frankseijts wrote: Monday 21 October 2019 21:04 i did use the script

but this is the error what i get

2019-10-21 21:01:00.492 Error: dzVents: Error: (2.4.29) Hue light test: ...omoticz/scripts/dzVents/generated_scripts/Hal - Hue3.lua:16: attempt to call global 'devices' (a nil value)

i attempt to find the problem but i didnt find it
:oops: My bad. domoticz fell off in my Copy/paste action. new one with domoticz included :)

Code: Select all

return {
    active = true,
    on = { 
        timer = { 
            'at 15:00-15:01',
          },
    },
    	
logging =
    {   
        level = domoticz.LOG_DEBUG,
        marker = "Hue light test",
    },

    execute = function(domoticz)
          myHueLamp = domoticz.devices('Hue color lamp 3')
    	
          myHueLamp.toggleSwitch()
          myHueLamp.setRGB(124, 233, 11)
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Frankseijts
Posts: 7
Joined: Friday 18 October 2019 20:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: give philips hue light a color

Post by Frankseijts »

Thanks waaren

this was good

but now i was thinken lets turn on a group
so i replaced devices into groups and Hue collor lamp 3 into Hal ( the hue color lamp 3 is in the group hal)
but the i did get this massage

Hue3.lua:18: attempt to call field 'toggleSwitch
so do i have to do something with toggleSwitch

on the wiki page i read this
groups = { ...}
A list of one or more group-names or indexes. The same rules as devices apply.

so i was thinking how hard can i be :0)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: give philips hue light a color

Post by waaren »

Frankseijts wrote: Tuesday 22 October 2019 21:10 on the wiki page i read this
groups = { ...}
A list of one or more group-names or indexes. The same rules as devices apply.
so i was thinking how hard can i be :0)
I guess you need to read a bit further on the wiki page. You will find which methods are available for group objects.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Frankseijts
Posts: 7
Joined: Friday 18 October 2019 20:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: give philips hue light a color

Post by Frankseijts »

Thanks waaren

i had to change Domoticz.Groups('hal') into Domoticz.groups('hal')
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest