Posts: 25
Threads: 2
Joined: Mar 2020
Reputation:
0
(31.07.2020, 07:53)Erwin van der Zwart Wrote: Hi,
I checked and line 21 is handling the response of the function getHueLights() that is located in the user.hue, so i guess you use a older version of the user lib.
Can you try to replace your user.hue with this version? A restart might be required.
BR,
Erwin Thank you, it's working now
BR
Magnus
Posts: 44
Threads: 1
Joined: Mar 2019
Reputation:
1
Hi Ervin,
since i update the user.hue to V4 i get this error message every time:
Code: Resident script:62: attempt to perform arithmetic on a nil value
stack traceback:
this is my resident script:
Code: -- Set name (Lookup in HUE app under light configuration) and feedback adresses (don't change statevalue, brivalue and colorvalue as they are used as memoryfield)
addressmapping = {
-- Name -- On/Off FB -- Bright FB -- Color FB
['Schlafzimmer'] = {state = '10/1/27', bri = '10/1/15', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Laura Wand Links'] = {state = '32/1/7', bri = '32/1/9', rgb = '32/1/16', statevalue = '', brivalue = '', colorvalue = ''},
['Laura Wand Rechts'] = {state = '32/1/8', bri = '32/1/10', rgb = '', statevalue = '', brivalue = '', colorvalue = ''},
['Küche Led'] = {state = '32/1/11', bri = '32/1/13', rgb = '10/1/5', statevalue = '', brivalue = '', colorvalue = ''},
['Küche indirekt'] = {state = '32/1/12', bri = '10/1/3', rgb = '32/1/14', statevalue = '', brivalue = '', colorvalue = ''},
['Esstisch'] = {state = '10/1/157', bri = '10/1/159', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Laura Zelt'] = {state = '10/1/25', bri = 'x/x/x', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Wohnzimmer Links'] = {state = '32/1/3', bri = '32/1/5', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Wohnzimmer Rechts'] = {state = '32/1/4', bri = '32/1/6', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Kinderzimmer Links'] = {state = '32/1/17', bri = '32/1/19', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Kinderzimmer Rechts'] = {state = '32/1/18', bri = '32/1/20', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Küche Theke'] = {state = '10/1/161', bri = '10/1/163', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''}
}
-- Set polling interval in seconds
interval = 1
-- Use logging
logging = true
require('user.hue')
require('json')
-- loop indefenitly
while true do
reply = getHueLights()
mylamps = json.decode(reply)
for _, item in pairs(mylamps) do
-- Check if lamp is found by bridge otherwise it make no sense to send commands
if item.state.reachable == true then
-- On/Off
name = addressmapping[item.name]
if name then
addr = addressmapping[item.name]['state']
if addr and addr ~= '' then
currentvalue = addressmapping[item.name]['statevalue']
if currentvalue ~= item.state.on then
grp.write(addr, item.state.on)
addressmapping[item.name]['statevalue'] = item.state.on
if logging == true then
log('lamp ' .. item.name .. ' state is: ' .. tostring(item.state.on))
end
end
end
end
-- Brightness
name = addressmapping[item.name]
if name then
addr = addressmapping[item.name]['bri']
if addr and addr ~= '' then
-- Check if lamp is on otherwise overrule BRI value to 0
if item.state.on == false then
item.state.bri = 0
end
currentvalue = addressmapping[item.name]['brivalue']
if currentvalue ~= item.state.bri then
grp.write(addr, math.floor((tonumber(item.state.bri)/2.55) + 0.5))
addressmapping[item.name]['brivalue'] = item.state.bri
if logging == true then
log('lamp ' .. item.name .. ' brightness is: ' .. math.floor((tonumber(item.state.bri)/2.55) + 0.5) .. ' %')
end
end
end
end
-- Color
name = addressmapping[item.name]
if name then
addr = addressmapping[item.name]['rgb']
if addr and addr ~= '' then
-- Check if lamp is on otherwise overrule color value to 0
if item.state.on == false then
colorvalue = 0
end
if item.state.colormode == 'xy' then
currentvalue = addressmapping[item.name]['colorvalue']
colorvalue = xy_to_rgb(item.state.xy[1],item.state.xy[2],item.state.bri)
--colorvalue = xyz_to_rgb((item.state.xy[1] * 100), (item.state.xy[2] * 100))
if currentvalue ~= colorvalue then
grp.write(addr, colorvalue)
addressmapping[item.name]['colorvalue'] = colorvalue
if logging == true then
log('lamp ' .. item.name .. ' color is: ' .. colorvalue)
end
end
elseif item.state.colormode == 'ct' then
currentvalue = addressmapping[item.name]['colorvalue']
--colortemp = math.floor((item.state.ct / 0.0769) + 0.5) --0.0769230769230769
colortemp = math.abs((item.state.ct - 500) / 2)
colortemp = math.floor(colortemp + 0.5)
colortemp = 80 + colortemp
if colortemp > 255 then
colortemp = 255
end
r = lmcore.inttohex(255, 1)
g = lmcore.inttohex(255, 1)
b = lmcore.inttohex(colortemp, 1)
rgb = r .. g .. b
colortemp = lmcore.hextoint(rgb,3)
if currentvalue ~= colortemp then
--colortempconverted = ct_to_rgb(colortemp)
grp.write(addr, colortemp)
addressmapping[item.name]['colorvalue'] = colortemp
if logging == true then
log('lamp ' .. item.name .. ' color is: ' .. colortemp)
end
end
end
end
end
end
--log('manufacturername = ' .. item.manufacturername)
--log('swversion = ' .. item.swversion)
--log('type = ' .. item.type)
--log('ct = ' .. item.state.ct)
--log('reachable = ' .. item.state.reachable)
--log('alert = ' .. item.state.alert)
--log('on = ' .. item.state.on)
--log('bri = ' .. item.state.bri)
--log('colormode = ' .. item.state.colormode)
--log('hue = ' .. item.state.hue)
--log('sat = ' .. item.state.sat)
--log('effect = ' .. item.state.effect)
--log('x = ' .. item.state.xy[1])
--log('y = ' .. item.state.xy[2])
--log('uniqueid = ' .. item.uniqueid)
--log('modelid = ' .. item.modelid)
--log('name = ' .. item.name)
end
-- Delay loop
os.sleep(interval)
end
line 62 is the grp.write, before i used your script in V3.
HW is an HL V1 running LM Firmware 202007 RC2.
BR
Lars
Posts: 1760
Threads: 6
Joined: Jul 2015
Reputation:
117
Hi,
Try this: (I added a check to be sure the device supports BR, CT or XY)
Code: -- Set name (Lookup in HUE app under light configuration) and feedback adresses (don't change statevalue, brivalue and colorvalue as they are used as memoryfield)
addressmapping = {
-- Name -- On/Off FB -- Bright FB -- Color FB
['Schlafzimmer'] = {state = '10/1/27', bri = '10/1/15', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Laura Wand Links'] = {state = '32/1/7', bri = '32/1/9', rgb = '32/1/16', statevalue = '', brivalue = '', colorvalue = ''},
['Laura Wand Rechts'] = {state = '32/1/8', bri = '32/1/10', rgb = '', statevalue = '', brivalue = '', colorvalue = ''},
['Küche Led'] = {state = '32/1/11', bri = '32/1/13', rgb = '10/1/5', statevalue = '', brivalue = '', colorvalue = ''},
['Küche indirekt'] = {state = '32/1/12', bri = '10/1/3', rgb = '32/1/14', statevalue = '', brivalue = '', colorvalue = ''},
['Esstisch'] = {state = '10/1/157', bri = '10/1/159', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Laura Zelt'] = {state = '10/1/25', bri = 'x/x/x', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Wohnzimmer Links'] = {state = '32/1/3', bri = '32/1/5', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Wohnzimmer Rechts'] = {state = '32/1/4', bri = '32/1/6', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Kinderzimmer Links'] = {state = '32/1/17', bri = '32/1/19', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Kinderzimmer Rechts'] = {state = '32/1/18', bri = '32/1/20', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''},
['Küche Theke'] = {state = '10/1/161', bri = '10/1/163', rgb = 'x/x/x', statevalue = '', brivalue = '', colorvalue = ''}
}
-- Set polling interval in seconds
interval = 1
-- Use logging
logging = false
-- Load needed lib's
require('user.hue')
require('json')
-- loop indefenitly
while true do
reply = getHueLights()
mylamps = json.decode(reply)
for _, item in pairs(mylamps) do
-- Check if lamp is found by bridge otherwise it make no sense to send commands
if item.state.reachable == true then
-- On/Off
name = addressmapping[item.name]
if name then
addr = addressmapping[item.name]['state']
if addr and addr ~= '' then
currentvalue = addressmapping[item.name]['statevalue']
if currentvalue ~= item.state.on then
grp.checkwrite(addr, item.state.on)
addressmapping[item.name]['statevalue'] = item.state.on
if logging == true then
log('lamp ' .. item.name .. ' state is: ' .. tostring(item.state.on))
end
end
end
end
--Brightness
if item.state.bri then
name = addressmapping[item.name]
if name then
addr = addressmapping[item.name]['bri']
if addr and addr ~= '' then
-- Check if lamp is on otherwise overrule BRI value to 0
if item.state.on == false then
item.state.bri = 0
end
currentvalue = addressmapping[item.name]['brivalue'] or 0
if currentvalue ~= item.state.bri then
grp.checkwrite(addr, math.floor((tonumber(item.state.bri)/2.55) + 0.5))
addressmapping[item.name]['brivalue'] = item.state.bri
if logging == true then
log('lamp ' .. item.name .. ' brightness is: ' .. math.floor((tonumber(item.state.bri)/2.55) + 0.5) .. ' %')
end
end
end
end
end
--Color
if item.state.ct or item.state.xy then
name = addressmapping[item.name]
if name then
addr = addressmapping[item.name]['rgb']
if addr and addr ~= '' then
-- Check if lamp is on otherwise overrule color value to 0
if item.state.on == false then
colorvalue = 0
end
if item.state.colormode == 'xy' then
currentvalue = addressmapping[item.name]['colorvalue']
colorvalue = xy_to_rgb(item.state.xy[1],item.state.xy[2],item.state.bri)
--colorvalue = xyz_to_rgb((item.state.xy[1] * 100), (item.state.xy[2] * 100))
if currentvalue ~= colorvalue then
grp.checkwrite(addr, colorvalue)
addressmapping[item.name]['colorvalue'] = colorvalue
if logging == true then
log('lamp ' .. item.name .. ' color is: ' .. colorvalue)
end
end
elseif item.state.colormode == 'ct' then
currentvalue = addressmapping[item.name]['colorvalue']
--colortemp = math.floor((item.state.ct / 0.0769) + 0.5) --0.0769230769230769
colortemp = math.abs((item.state.ct - 500) / 2)
colortemp = math.floor(colortemp + 0.5)
colortemp = 80 + colortemp
if colortemp > 255 then
colortemp = 255
end
r = lmcore.inttohex(255, 1)
g = lmcore.inttohex(255, 1)
b = lmcore.inttohex(colortemp, 1)
rgb = r .. g .. b
colortemp = lmcore.hextoint(rgb,3)
if currentvalue ~= colortemp then
--colortempconverted = ct_to_rgb(colortemp)
grp.checkwrite(addr, colortemp)
addressmapping[item.name]['colorvalue'] = colortemp
if logging == true then
log('lamp ' .. item.name .. ' color is: ' .. colortemp)
end
end
end
end
end
end
end
end
-- Delay loop
os.sleep(interval)
end
BR,
Erwin
Posts: 44
Threads: 1
Joined: Mar 2019
Reputation:
1
Thank you Erwin. No more errors.
I saw in the user.hue an Line send to Group. Have you any scripts to controll an entire Hue Group ?
At the moment i control a Group that each Light has an own event based script wich is triggerd by the same tag behind the KNX Group adress.
Posts: 1760
Threads: 6
Joined: Jul 2015
Reputation:
117
10.08.2020, 12:48
(This post was last modified: 10.08.2020, 12:54 by Erwin van der Zwart.)
Hi,
Yes you can do that, in the user.hue there are already 2 functions to use for group commands, getHueGroups() and sendToGroup()
First you have to get the groups by this command:
Code: --Get all group information
require('user.hue')
-- get all lights from bridge
result = getHueGroups()
log(result)
When you know the group ID you can control it with:
Code: require('user.hue')
value = event.getvalue()
group_id = 1 -- change this ID to your actual group, see getHueGroups() result
if value == true then
body_msg = '{"on":true}'
sendToGroup(group_id,body_msg)
else
body_msg = '{"on":false}'
sendToGroup(group_id,body_msg)
end
BR,
Erwin
Posts: 44
Threads: 1
Joined: Mar 2019
Reputation:
1
Hi Ervin,
thank you for your help. The Script for group switching works perfect. I tried the same with brigtness but had no luck. Just change the script from lampID to GroupID didn´t work.
Do you have any scripts for controlling the Brightness, RGB an CT for Group´s with Feedback ?
Is there a chance that upcomming releases of W4K Firmware have an nativ integration of Philips HUE ?
BR,
Lars
Posts: 1760
Threads: 6
Joined: Jul 2015
Reputation:
117
05.09.2020, 15:57
(This post was last modified: 05.09.2020, 16:07 by Erwin van der Zwart.)
Did you also called the function sendToGroup?
No I don’t think so, i have not seen any development in that direction, they work on speech control and new mobile app at this moment. Maybe i will start a new project to build a app for HUE this winter, but I don’t have time until November this year..
BR,
Erwin
Posts: 44
Threads: 1
Joined: Mar 2019
Reputation:
1
I Tried this with no effect
Code: --Control HUE from byte object (brightness) (use as event based script)
require('user.hue')
value = event.getvalue() -- 1 byte unsigned integer scale 0 - 100
group_id = 1 -- change this ID to your actual light, see getHueLights() result for lamps or use your app to resolve them
setBrightness(group_id,value)
then i added a function in user.hue with also no luck.
Code: function setBrightness(Group_id,brightness)
if brightness == 0 then
body_msg = '{"on":false}'
response = sendToGroup(group_id,body_msg)
return response
else
brightness = math.floor((brightness / 1) + 0.5)
brightness = math.floor((brightness * 2.54) + 0.5)
--HTTP request send
body_msg = '{"on":true,"bri":'..brightness..'}'
response = sendToGroup(Group_num,body_msg)
return response
end
end
Posts: 1760
Threads: 6
Joined: Jul 2015
Reputation:
117
05.09.2020, 20:24
(This post was last modified: 05.09.2020, 20:26 by Erwin van der Zwart.)
Hi,
You have 2 mistakes in your script:
Code: response = sendToGroup(group_id,body_msg)
should be
response = sendToGroup(Group_id,body_msg)
and
response = sendToGroup(Group_num,body_msg)
should be
response = sendToGroup(Group_id,body_msg)
I just tested with my latest user lib and this command and works perfect
Code: require('user.hue')
require('json')
--log(json.pdecode(getHueGroups())) -- enable to check group number
--setBrightnessGroup(1,100) -- Group, brightness in %
setBrightnessCTGroup(1,60,2000) -- Group, brightness in %, CT in Kelvin
BR,
Erwin
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
Hi Erwin,
I just configured a group and i can control the group via the group-script. However i can not get the status of this group to update.
Code: -- Set name (Lookup in HUE app under light configuration) and feedback adresses (don't change statevalue, brivalue and colorvalue as they are used as memoryfield)
addressmapping = {
-- Name -- On/Off FB -- Bright FB -- Color FB
['Led terras'] = {state = '20/0/1', bri = '20/1/1', rgb = '20/2/1', ct = '20/3/1', statevalue = '', brivalue = '', colorvalue = ''},
['Keuken Eiland'] = {state = '20/0/2', bri = '20/1/2', rgb = '20/2/2', statevalue = '', brivalue = '', colorvalue = ''},
['Keuken Werkblad R'] = {state = '20/0/3', bri = '20/1/3', rgb = '20/2/3', statevalue = '', brivalue = '', colorvalue = ''},
['Keuken Werkblad L'] = {state = '20/0/4', bri = '20/1/4', rgb = '20/2/4', statevalue = '', brivalue = '', colorvalue = ''},
['Douche L'] = {state = '20/0/5', bri = '20/1/5', rgb = '20/2/5', statevalue = '', brivalue = '', colorvalue = ''},
['Douche R'] = {state = '20/0/6', bri = '20/1/6', rgb = '20/2/6', statevalue = '', brivalue = '', colorvalue = ''},
['Keuken Werkblad'] = {state = '20/0/7', bri = '20/1/7', rgb = '20/2/7', statevalue = '', brivalue = '', colorvalue = ''},
}
It's the last line in the code "Keuken Werkblad" The individual lamps "Keuken Werkblad L" & "Keuken Werkblad R" get updated in both "state", "bri" and "rgb"
Can you help me out?
Novice DIY with a HL and KNX basics trying to ...
Posts: 7733
Threads: 42
Joined: Jun 2015
Reputation:
446
Erwin's script uses getHueLights() which does not include groups. Try this to get info for both lights and groups together (replace the relevant script part with this):
Code: -- loop indefenitly
while true do
reply = getHueLights()
mylamps = json.decode(reply)
-- get groups start
reply = getHueGroups()
groups = json.pdecode(reply)
if type(groups) == 'table' then
for k, v in pairs(groups) do
mylamps[ k ] = v
end
end
-- get groups end
for _, item in pairs(mylamps) do
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
09.11.2020, 15:17
(This post was last modified: 09.11.2020, 15:21 by Firechief.)
Dear Admin,
I've added these lines to the resident Hue script. Now none of the Hue lamp statusses are updated, neither the brightness nor the rgb. These worked before i added the lines. I do not get log's when switching lamps on or off. No error logs as well. I'm using the v5 user.hue library.
Code: -- Set name (Lookup in HUE app under light configuration) and feedback adresses (don't change statevalue, brivalue and colorvalue as they are used as memoryfield)
addressmapping = {
-- Name -- On/Off FB -- Bright FB -- Color FB
['Led terras'] = {state = '20/0/1', bri = '20/1/1', rgb = '20/2/1', ct = '20/3/1', statevalue = '', brivalue = '', colorvalue = ''},
['Keuken Eiland'] = {state = '20/0/2', bri = '20/1/2', rgb = '20/2/2', statevalue = '', brivalue = '', colorvalue = ''},
['Keuken Werkblad R'] = {state = '20/0/3', bri = '20/1/3', rgb = '20/2/3', statevalue = '', brivalue = '', colorvalue = ''},
['Keuken Werkblad L'] = {state = '20/0/4', bri = '20/1/4', rgb = '20/2/4', statevalue = '', brivalue = '', colorvalue = ''},
['Douche L'] = {state = '20/0/5', bri = '20/1/5', rgb = '20/2/5', statevalue = '', brivalue = '', colorvalue = ''},
['Douche R'] = {state = '20/0/6', bri = '20/1/6', rgb = '20/2/6', statevalue = '', brivalue = '', colorvalue = ''},
['Keuken Werkblad'] = {state = '20/0/7', bri = '20/1/7', rgb = '20/2/7', statevalue = '', brivalue = '', colorvalue = ''},
}
-- Set polling interval in seconds
interval = 1
-- Use logging
logging = true
require('user.hue')
require('json')
-- loop indefenitly
while true do
reply = getHueLights()
mylamps = json.decode(reply)
-- get groups start
reply = getHueGroups()
groups = json.pdecode(reply)
if type(groups) == 'table' then
for k, v in pairs(groups) do
mylamps[ k ] = v
end
end
-- get groups end
for _, item in pairs(mylamps) do
-- Check if lamp is found by bridge otherwise it make no sense to send commands
if item.state.reachable == true then
-- On/Off
name = addressmapping[item.name]
if name then
addr = addressmapping[item.name]['state']
if addr and addr ~= '' then
currentvalue = addressmapping[item.name]['statevalue']
if currentvalue ~= item.state.on then
grp.update(addr, item.state.on)
addressmapping[item.name]['statevalue'] = item.state.on
if logging == true then
log('lamp ' .. item.name .. ' state is: ' .. tostring(item.state.on))
end
end
end
end
-- Brightness
name = addressmapping[item.name]
if name then
addr = addressmapping[item.name]['bri']
if addr and addr ~= '' then
-- Check if lamp is on otherwise overrule BRI value to 0
if item.state.on == false then
item.state.bri = 0
end
currentvalue = addressmapping[item.name]['brivalue']
if currentvalue ~= item.state.bri then
grp.update(addr, math.floor((tonumber(item.state.bri)/2.55) + 0.5))
addressmapping[item.name]['brivalue'] = item.state.bri
if logging == true then
log('lamp ' .. item.name .. ' brightness is: ' .. math.floor((tonumber(item.state.bri)/2.55) + 0.5) .. ' %')
end
end
end
end
-- Color
name = addressmapping[item.name]
if name then
addr = addressmapping[item.name]['rgb']
if addr and addr ~= '' then
-- Check if lamp is on otherwise overrule color value to 0
if item.state.on == false then
colorvalue = 0
end
if item.state.colormode == 'xy' then
currentvalue = addressmapping[item.name]['colorvalue']
colorvalue = xy_to_rgb(item.state.xy[1],item.state.xy[2],item.state.bri)
--colorvalue = xyz_to_rgb((item.state.xy[1] * 100), (item.state.xy[2] * 100))
if currentvalue ~= colorvalue then
grp.update(addr, colorvalue)
addressmapping[item.name]['colorvalue'] = colorvalue
if logging == true then
log('lamp ' .. item.name .. ' color is: ' .. colorvalue)
end
end
elseif item.state.colormode == 'ct' then
currentvalue = addressmapping[item.name]['colorvalue']
--colortemp = math.floor((item.state.ct / 0.0769) + 0.5) --0.0769230769230769
colortemp = math.abs((item.state.ct - 500) / 2)
colortemp = math.floor(colortemp + 0.5)
colortemp = 80 + colortemp
if colortemp > 255 then
colortemp = 255
end
r = lmcore.inttohex(255, 1)
g = lmcore.inttohex(255, 1)
b = lmcore.inttohex(colortemp, 1)
rgb = r .. g .. b
colortemp = lmcore.hextoint(rgb,3)
if currentvalue ~= colortemp then
--colortempconverted = ct_to_rgb(colortemp)
grp.update(addr, colortemp)
addressmapping[item.name]['colorvalue'] = colortemp
if logging == true then
log('lamp ' .. item.name .. ' color is: ' .. colortemp)
end
end
end
end
end
end
--log('manufacturername = ' .. item.manufacturername)
--log('swversion = ' .. item.swversion)
--log('type = ' .. item.type)
--log('ct = ' .. item.state.ct)
--log('reachable = ' .. item.state.reachable)
--log('alert = ' .. item.state.alert)
--log('on = ' .. item.state.on)
--log('bri = ' .. item.state.bri)
--log('colormode = ' .. item.state.colormode)
--log('hue = ' .. item.state.hue)
--log('sat = ' .. item.state.sat)
--log('effect = ' .. item.state.effect)
--log('x = ' .. item.state.xy[1])
--log('y = ' .. item.state.xy[2])
--log('uniqueid = ' .. item.uniqueid)
--log('modelid = ' .. item.modelid)
--log('name = ' .. item.name)
end
-- Delay loop
os.sleep(interval)
end
Kind regards
Can it be that there's a typo in the lines?
Code: -- get groups start
reply = getHueGroups()
groups = json.pdecode(reply) -- ==>json.decode(reply) ???
if type(groups) == 'table' then
for k, v in pairs(groups) do
mylamps[ k ] = v
end
end
-- get groups end
Novice DIY with a HL and KNX basics trying to ...
Posts: 7733
Threads: 42
Joined: Jun 2015
Reputation:
446
Try this (change line 31): mylamps[ #mylamps +1 ] = v
pdecode is needed for safe deciding in case there's no reply or it is malformed.
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
Admin,
Individual lamp statusses are updated again, but still no update on the group status, brightness and rgb. Log's are also back now.
Novice DIY with a HL and KNX basics trying to ...
Posts: 7733
Threads: 42
Joined: Jun 2015
Reputation:
446
Add log(groups) after pdecode and post what you get in Logs tab.
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
this is the log:
Code: * table:
["4"]
* table:
["action"]
* table:
["ct"]
* number: 153
["alert"]
* string: select
["on"]
* bool: true
["bri"]
* number: 254
["colormode"]
* string: xy
["hue"]
* number: 41435
["sat"]
* number: 77
["effect"]
* string: none
["xy"]
* table:
[1]
* number: 0.3129
[2]
* number: 0.3291
["sensors"]
* table:
["recycle"]
* bool: false
["state"]
* table:
["all_on"]
* bool: true
["any_on"]
* bool: true
["lights"]
* table:
[1]
* string: 4
[2]
* string: 3
["class"]
* string: Kitchen
["name"]
* string: Keuken Werkblad
["type"]
* string: Room
["1"]
* table:
["action"]
* table:
["ct"]
* number: 331
["alert"]
* string: none
["on"]
* bool: false
["bri"]
* number: 254
["colormode"]
* string: xy
["hue"]
* number: 58281
["sat"]
* number: 142
["effect"]
* string: none
["xy"]
* table:
[1]
* number: 0.4359
[2]
* number: 0.2811
["sensors"]
* table:
["recycle"]
* bool: false
["state"]
* table:
["all_on"]
* bool: false
["any_on"]
* bool: false
["lights"]
* table:
[1]
* string: 1
["class"]
* string: Terrace
["name"]
* string: Tuin
["type"]
* string: Room
["2"]
* table:
["action"]
* table:
["on"]
* bool: false
["alert"]
* string: none
["sensors"]
* table:
["recycle"]
* bool: false
["state"]
* table:
["all_on"]
* bool: false
["any_on"]
* bool: false
["lights"]
* table:
["class"]
* string: Bathroom
["name"]
* string: Badkamer
["type"]
* string: Room
["6"]
* table:
["action"]
* table:
["ct"]
* number: 343
["alert"]
* string: select
["on"]
* bool: false
["bri"]
* number: 254
["colormode"]
* string: xy
["hue"]
* number: 8597
["sat"]
* number: 121
["effect"]
* string: none
["xy"]
* table:
[1]
* number: 0.4452
[2]
* number: 0.4068
["sensors"]
* table:
["recycle"]
* bool: false
["state"]
* table:
["all_on"]
* bool: false
["any_on"]
* bool: false
["lights"]
* table:
[1]
* string: 5
[2]
* string: 6
["class"]
* string: Bathroom
["name"]
* string: Douche
["type"]
* string: Room
["3"]
* table:
["action"]
* table:
["ct"]
* number: 156
["alert"]
* string: select
["on"]
* bool: true
["bri"]
* number: 254
["colormode"]
* string: ct
["hue"]
* number: 41432
["sat"]
* number: 75
["effect"]
* string: none
["xy"]
* table:
[1]
* number: 0.3146
[2]
* number: 0.3304
["sensors"]
* table:
["recycle"]
* bool: false
["state"]
* table:
["all_on"]
* bool: true
["any_on"]
* bool: true
["lights"]
* table:
[1]
* string: 2
["class"]
* string: Kitchen
["name"]
* string: Keuken Eiland
["type"]
* string: Room
Novice DIY with a HL and KNX basics trying to ...
Posts: 7733
Threads: 42
Joined: Jun 2015
Reputation:
446
Try this:
Code: v.state = v.action
mylamps[ #mylamps +1 ] = v
There's no full state response for groups, only the last sent values.
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
No change. Group doesn't get updated
Novice DIY with a HL and KNX basics trying to ...
Posts: 44
Threads: 1
Joined: Mar 2019
Reputation:
1
How do you get CT state in the resident Script ??
I tried adding , ct = x/x/x , after the RGB state valeu but nothing happens.
Posts: 7733
Threads: 42
Joined: Jun 2015
Reputation:
446
Try adding this to the script before -- Color:
Code: -- color temperature
name = addressmapping[item.name]
if name and item.state.ct then
addr = addressmapping[item.name]['ct']
if addr and addr ~= '' then
newvalue = math.floor(1000000 / item.state.ct)
currentvalue = addressmapping[item.name]['ctvalue']
if currentvalue ~= newvalue then
grp.update(addr, newvalue)
addressmapping[item.name]['ctvalue'] = newvalue
if logging == true then
log('lamp ' .. item.name .. ' color temperature is: ' .. newvalue .. ' K')
end
end
end
end
|