Posts: 52
Threads: 2
Joined: Mar 2019
Reputation:
1
30.11.2020, 15:59
(This post was last modified: 30.11.2020, 16:05 by Sral1987 .)
Thank you admin
it worked just one time then this error replyed
Code:
1 2 3
Resident script :
32 :
Expected value but found T_END at character 1
stack traceback :
[
C ]:
in function 'decode'
this is my full resident feedbac script
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
addressmapping = {
[
'Schlafzimmer' ] = {
state =
'10/1/27' ,
bri =
'10/1/15' ,
rgb =
'x/x/x' ,
ct =
'32/1/21' ,
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 =
'' },
[
'Nachtlicht' ] = {
state =
'10/1/57' ,
bri =
'10/1/59' ,
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 =
'' }
}
interval =
1
logging =
false
require (
'user.hue' )
require (
'json' )
while true do
reply =
getHueLights ()
mylamps =
json.decode (
reply )
for _ ,
item in pairs (
mylamps )
do
if item.state.reachable ==
true then
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
if item.state.bri then
name =
addressmapping [
item.name ]
if name then
addr =
addressmapping [
item.name ][
'bri' ]
if addr and addr ~=
'' then
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.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
end
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
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
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 )
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.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
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
end
end
os.sleep (
interval )
end
Posts: 1793
Threads: 6
Joined: Jul 2015
Reputation:
120
30.11.2020, 20:59
(This post was last modified: 30.11.2020, 21:01 by Erwin van der Zwart .)
I think you use an older version of the user.hue
Can you check if your function getHueLights() matches the one below? Especially for
return table.concat(response)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
function getHueLights ()
local response = {}
body_searchHueLights =
''
socket.http.request ({
url =
"http://" ..
ip_add.. "/api/" ..
user.. "/lights" ,
method =
'GET' ,
sink =
ltn12.sink.table (
response ),
headers = {
[
'content-length' ] = #
body_searchHueLights ,
[
'content-type' ] =
'application/json' ,
},
source =
ltn12.source.string (
body_searchHueLights ),
})
return table.concat (
response )
end
Posts: 52
Threads: 2
Joined: Mar 2019
Reputation:
1
Hmm strage behavior,
now it works without any error. User.hue function is the same. I user your V3.
The last time this Error appeared was yesterday 22:30, i did not change anything.
What i notice is when i add a new light ist takes some time to recorgnize till states would written on objects. Is there something like a timeouot or value check before writing to objects ?
Anyway thank you admin and Erwin for your Work
BR
Posts: 3
Threads: 0
Joined: Aug 2020
Reputation:
0
(09.06.2020, 08:24) Firechief Wrote: Ok, got it working now!
Thx for the helpCan u pls tell me How run the Bridge setup () and how to control hue lights with LM
Posts: 4
Threads: 1
Joined: Sep 2021
Reputation:
0
Hello
The control of Philips Hue lamps via the fabrscript is working.
But how can I control tunable white lamp or how is the script to do this for a single lamp
So that I can change the color temperature.
Could someone help me with this I would need the script for this (hue commands)
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
25.03.2023, 14:56
(This post was last modified: 25.03.2023, 14:57 by Firechief .)
@ Erwin,
I've installed a few (13) new Hue lamps and i'm trying to discover their lampnumbers via the discover script. I get a return in the log, but not all lamps are there. Any idea?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
Hue discovery 24.03.2023 08 :
18 :
54
*
string :
192.168.100.187
Hue discovery 24.03.2023 08 :
18 :
54
*
table :
[
1 ]
*
string : [{
"error" :{
"type" :
101 ,
"address" :
"" ,
"description" :
"link button not pressed" }}]
Hue discovery 24.03.2023 08 :
18 :
55
*
table :
[
1 ]
*
string : [{
"success" :{
"/lights" :
"Searching for new devices" }}]
Hue discovery 24.03.2023 08 :
18 :
55
string : {
“
1 ":{" state ":{" on ":false," bri ":254," hue ":41490," sat ":78," effect ":" none "," xy ":[0.3116,0.3277]," ct ":153," alert ":" select "," colormode ":" ct "," mode ":" homeautomation "," reachable ":true}," swupdate ":{" state ":" noupdates "," lastinstall ":" 2022 -
12 -
03T14 :
06 :
43 "}," type ":" Extended color light ”,
"name" :
"Led terras”,
"modelid" :
"LST004" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" :
"Hue lightstrip outdoor”," capabilities ":{" certified ":true," control ":{" mindimlevel ":2000," colorgamuttype ":" C "," colorgamut ":[[0.6915,0.3083],[0.1700,0.7000],[0.1532,0.0475]]," ct ":{" min ":153," max ":500}}," streaming ":{" renderer ":true," proxy ":true}}," config ":{" archetype ":" huelightstrip "," function ":" mixed "," direction ":" omnidirectional "," startup ":{" mode ":" powerfail "," configured ":true}}," uniqueid ":" 00 :
17 :
88 :
01 :
06 :
6a :
54 :
98 -
0b "," swversion ":" 1.101.2 "," swconfigid ":" D771FA32 "," productid ":" Philips-LST004-1-LedStripsOutv1 "},
"3" :{
"state" :{
"on" :
false ,
"bri" :
254 ,
"hue" :
41432 ,
"sat" :
75 ,
"effect" :
"none" ,
"xy" :[
0.3143 ,
0.3302 ],
"ct" :
156 ,
"alert" :
"none" ,
"colormode" :
"ct" ,
"mode" :
"homeautomation" ,
"reachable" :
true },
"swupdate" :{
"state" :
"noupdates" ,
"lastinstall" :
"2022-12-03T14:00:15" },
"type" :
"Extended color light" ,
"name" :
"Keuken Werkblad R”,
"modelid" :
"LCA001" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" :
"Hue color lamp”," capabilities ":{" certified ":true," control ":{" mindimlevel ":200," maxlumen ":800," colorgamuttype ":" C "," colorgamut ":[[0.6915,0.3083],[0.1700,0.7000],[0.1532,0.0475]]," ct ":{" min ":153," max ":500}}," streaming ":{" renderer ":true," proxy ":true}}," config ":{" archetype ":" sultanbulb "," function ":" mixed "," direction ":" omnidirectional "," startup ":{" mode ":" powerfail "," configured ":true}}," uniqueid ":" 00 :
17 :
88 :
01 :
06 :
2e :
13 :
af-0b "," swversion ":" 1.101.2 "," swconfigid ":" 3C05E7B6 "," productid ":" Philips-LCA001-5-A19ECLv6 "},
"4" :{
"state" :{
"on" :
false ,
"bri" :
254 ,
"hue" :
41432 ,
"sat" :
75 ,
"effect" :
"none" ,
"xy" :[
0.3143 ,
0.3302 ],
"ct" :
156 ,
"alert" :
"none" ,
"colormode" :
"ct" ,
"mode" :
"homeautomation" ,
"reachable" :
true },
"swupdate" :{
"state" :
"noupdates" ,
"lastinstall" :
"2022-12-03T14:00:25" },
"type" :
"Extended color light" ,
"name" :
"Keuken Werkblad L”,
"modelid" :
"LCA001" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" :
"Hue color lamp”," capabilities ":{" certified ":true," control ":{" mindimlevel ":200," maxlumen ":800," colorgamuttype ":" C "," colorgamut ":[[0.6915,0.3083],[0.1700,0.7000],[0.1532,0.0475]]," ct ":{" min ":153," max ":500}}," streaming ":{" renderer ":true," proxy ":true}}," config ":{" archetype ":" sultanbulb "," function ":" mixed "," direction ":" omnidirectional "," startup ":{" mode ":" powerfail "," configured ":true}}," uniqueid ":" 00 :
17 :
88 :
01 :
06 :
2c :
ef :
60 -
0b "," swversion ":" 1.101.2 "," swconfigid ":" 3C05E7B6 "," productid ":" Philips-LCA001-5-A19ECLv6 "},
"5" :{
"state" :{
"on" :
false ,
"bri" :
254 ,
"hue" :
8632 ,
"sat" :
117 ,
"effect" :
"none" ,
"xy" :[
0.4425 ,
0.4060 ],
"ct" :
343 ,
"alert" :
"select" ,
"colormode" :
"ct" ,
"mode" :
"homeautomation" ,
"reachable" :
true },
"swupdate" :{
"state" :
"noupdates" ,
"lastinstall" :
"2023-02-16T16:21:36" },
"type" :
"Extended color light" ,
"name" :
"Douche 1”,
"modelid" :
"LCG002" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" :
"Hue color spot”," capabilities ":{" certified ":true," control ":{" mindimlevel ":200," maxlumen ":300," colorgamuttype ":" C "," colorgamut ":[[0.6915,0.3083],[0.1700,0.7000],[0.1532,0.0475]]," ct ":{" min ":153," max ":500}}," streaming ":{" renderer ":true," proxy ":true}}," config ":{" archetype ":" spotbulb "," function ":" mixed "," direction ":" downwards "," startup ":{" mode ":" powerfail "," configured ":true}}," uniqueid ":" 00 :
17 :
88 :
01 :
06 :
bb :
4b :
ae-0b "," swversion ":" 1.101.10 "," swconfigid ":" 0982EB31 "," productid ":" Philips-LCG002-1-GU10ECLv2 "},
"6" :{
"state" :{
"on" :
false ,
"bri" :
254 ,
"hue" :
8632 ,
"sat" :
117 ,
"effect" :
"none" ,
"xy" :[
0.4425 ,
0.4060 ],
"ct" :
343 ,
"alert" :
"select" ,
"colormode" :
"ct" ,
"mode" :
"homeautomation" ,
"reachable" :
true },
"swupdate" :{
"state" :
"noupdates" ,
"lastinstall" :
"2023-02-16T16:27:01" },
"type" :
"Extended color light" ,
"name" :
"Douche 2”,
"modelid" :
"LCG002" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" :
"Hue color spot”," capabilities ":{" certified ":true," control ":{" mindimlevel ":200," maxlumen ":300," colorgamuttype ":" C "," colorgamut ":[[0.6915,0.3083],[0.1700,0.7000],[0.1532,0.0475]]," ct ":{" min ":153," max ":500}}," streaming ":{" renderer ":true," proxy ":true}}," config ":{" archetype ":" spotbulb "," function ":" mixed "," direction ":" downwards "," startup ":{" mode ":" powerfail "," configured ":true}}," uniqueid ":" 00 :
17 :
88 :
01 :
08 :
41 :
77 :
f1-0b "," swversion ":" 1.101.10 "," swconfigid ":" 0982EB31 "," productid ":" Philips-LCG002-1-GU10ECLv2 "},
"7" :{
"state" :{
"on" :
false ,
"alert" :
"none" ,
"mode" :
"homeautomation" ,
"reachable" :
true },
"swupdate" :{
"state" :
"noupdates" ,
"lastinstall" :
"2021-12-12T13:50:30" },
"type" :
"On/Off plug-in unit" ,
"name" :
"Hue Smart plug”,
"modelid" :
"LOM002" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" :
"Hue Smart plug”," capabilities ":{" certified ":true," control ":{}," streaming ":{" renderer ":false," proxy ":false}}," config ":{" archetype ":" plug "," function ":" functional "," direction ":" omnidirectional "," startup ":{" mode ":" safety "," configured ":true}}," uniqueid ":" 00 :
17 :
88 :
01 :
08 :
62 :
9c :
b7-0b "," swversion ":" 1.93.6 "," swconfigid ":" 7A0791B1 "," productid ":" SmartPlug_OnOff_v01-00_02 "},
"10" :{
"state" :{
"on" :
false ,
"bri" :
254 ,
"hue" :
41432 ,
"sat" :
75 ,
"effect" :
"none" ,
"xy" :[
0.3143 ,
0.3302 ],
"ct" :
156 ,
"alert" :
"select" ,
"colormode" :
"ct" ,
"mode" :
"homeautomation" ,
"reachable" :
true },
"swupdate" :{
"state" :
"noupdates" ,
"lastinstall" :
"2022-12-08T15:39:53" },
"type" :
"Extended color light" ,
"name" :
"Keuken Wasbak”,
"modelid" :
"929003116101" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" :
"Perifo linear light bar”," capabilities ":{" certified ":true," control ":{" mindimlevel ":100," maxlumen ":1700," colorgamuttype ":" C "," colorgamut ":[[0.6915,0.3083],[0.1700,0.7000],[0.1532,0.0475]]," ct ":{" min ":153," max ":500}}," streaming ":{" renderer ":true," proxy ":true}}," config ":{" archetype ":" ceilinghorizontal "," function ":" mixed "," direction ":" downwards "," startup ":{" mode ":" powerfail "," configured ":true}}," uniqueid ":" 00 :
17 :
88 :
01 :
0c :
bd :
de :
f4-0b "," swversion ":" 1.101.5 "," swconfigid ":" 83BB01E2 "," productid ":" 3241 -
3129 -
1221_HC07_PSG04 "},
"11" :{
"state" :{
"on" :
false ,
"bri" :
254 ,
"hue" :
41432 ,
"sat" :
75 ,
"effect" :
"none" ,
"xy" :[
0.3143 ,
0.3302 ],
"ct" :
156 ,
"alert" :
"select" ,
"colormode" :
"ct" ,
"mode" :
"homeautomation" ,
"reachable" :
true },
"swupdate" :{
"state" :
"noupdates" ,
"lastinstall" :
"2022-12-08T14:16:02" },
"type" :
"Extended color light" ,
"name" :
"Hanglamp Eiland 2”,
"modelid" :
"929003115901" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" :
"Perifo cylinder pendant”," capabilities ":{" certified ":true," control ":{" mindimlevel ":100," maxlumen ":510," colorgamuttype ":" C "," colorgamut ":[[0.6915,0.3083],[0.1700,0.7000],[0.1532,0.0475]]," ct ":{" min ":153," max ":500}}," streaming ":{" renderer ":true," proxy ":true}}," config ":{" archetype ":" pendantspot "," function ":" mixed "," direction ":" downwards "," startup ":{" mode ":" powerfail "," configured ":true}}," uniqueid ":" 00 :
17 :
88 :
01 :
0d :
1a :
8b :
aa-0b "," swversion ":" 1.101.5 "," swconfigid ":" 85CF1793 "," productid ":" 4422 -
9556 -
4251_HC07_PSG04 "},
"13" :{
"state" :{
"on" :
false ,
"bri" :
254 ,
"hue" :
41432 ,
"sat" :
75 ,
"effect" :
"none" ,
"xy" :[
0.3143 ,
0.3302 ],
"ct" :
156 ,
"alert" :
"select" ,
"colormode" :
"ct" ,
"mode" :
"homeautomation" ,
"reachable" :
true },
"swupdate" :{
"state" :
"noupdates" ,
"lastinstall" :
"2023-01-04T16:43:50" },
"type" :
"Extended color light" ,
"name" :
"Hanglamp Eiland 1”,
"modelid" :
"929003115901" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" :
"Perifo cylinder pendant”," capabilities ":{" certified ":true," control ":{" mindimlevel ":100," maxlumen ":510," colorgamuttype ":" C "," colorgamut ":[[0.6915,0.3083],[0.1700,0.7000],[0.1532,0.0475]]," ct ":{" min ":153," max ":500}}," streaming ":{" renderer ":true," proxy ":true}}," config ":{" archetype ":" pendantspot "," function ":" mixed "," direction ":" downwards "," startup ":{" mode ":" safety "," configured ":true}}," uniqueid ":" 00 :
17 :
88 :
01 :
0c :
69 :
83 :
d8-0b "," swversion ":" 1.101.5 "," swconfigid ":" 85CF1793 "," productid ":" 4422 -
9556 -
4251_HC07_PSG04 "},
"14" :{
"state" :{
"on" :
false ,
"bri" :
254 ,
"hue" :
39391 ,
"sat" :
14 ,
"effect" :
"none" ,
"xy" :[
0.3682 ,
0.3715 ],
"ct" :
230 ,
"alert" :
"select" ,
"colormode" :
"xy" ,
"mode" :
"homeautomation" ,
"reachable" :
true },
"swupdate" :{
"state" :
"noupdates" ,
"lastinstall" :
"2023-03-24T07:16:31" },
"type" :
"Extended color light" ,
"name" :
"Eetplaats Balk”,
"modelid" :
"5060730P7_01" ,
"manufacturername" :
"Signify Netherlands B.V." ,
"productname" ...
As you can see there are ... but even that lamp is not complete.
user.lua: V5
Kind regards
Novice DIY with a HL and KNX basics trying to ...
Posts: 8071
Threads: 43
Joined: Jun 2015
Reputation:
471
Each log entry is limited to 8KB. You can decode the JSON string and log each entry separately:
Code:
1 2 3 4
data =
require (
'json' ).
decode (
response )
for key ,
value in pairs (
data )
do
log (
key ,
value )
end
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
(27.03.2023, 05:28) admin Wrote: Each log entry is limited to 8KB. You can decode the JSON string and log each entry separately:
Code:
1 2 3 4
data =
require (
'json' ).
decode (
response )
for key ,
value in pairs (
data )
do
log (
key ,
value )
end
Do i add this to the current hue discovery script?
Kind regards.
Novice DIY with a HL and KNX basics trying to ...
Posts: 8071
Threads: 43
Joined: Jun 2015
Reputation:
471
Yes, instead of logging the JSON string response from getHueLights() use the above code. Replace response variable with the variable name that getHueLights() returns.
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
Admin,
I'm sorry, but as stated in my signature i am a novice at this.
So i've made a new "test" script and pasted the code in there, but nothing shows up.
I do get an error in the error log:
Code:
1 2 3 4
Hue Discovery Test 28.03.2023 11 :
22 :
58
Resident script :
2 :
bad argument #
1 to 'decode' (
string expected ,
got nil )
stack traceback :
[
C ]:
in function 'decode' So cleary i'm doing something wrong but i have no clue.
Novice DIY with a HL and KNX basics trying to ...
Posts: 8071
Threads: 43
Joined: Jun 2015
Reputation:
471
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
Code:
1 2 3 4 5
require (
'user.hue' )
data =
require (
'json' ).
decode (
response )
for key ,
value in pairs (
data )
do
log (
key ,
value )
end
Novice DIY with a HL and KNX basics trying to ...
Posts: 8071
Threads: 43
Joined: Jun 2015
Reputation:
471
Try this:
Code:
1 2 3 4 5 6
require (
'user.hue' )
response =
getHueLights ()
data =
require (
'json' ).
decode (
response )
for key ,
value in pairs (
data )
do
log (
key ,
value )
end
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
28.03.2023, 09:41
(This post was last modified: 28.03.2023, 10:17 by Firechief .)
This works! Thx a lot!
Admin,
This seems to log only 10 out of my 19 lamps...
Admin,
Disregard my remark, it seems only 10 are shown in the log at the script itself. In the SE general log they are all there.
Novice DIY with a HL and KNX basics trying to ...
Posts: 15
Threads: 4
Joined: Oct 2022
Reputation:
0
Helo,
Can you help me with the script to control the RGB color of a group in Philips Hue. I followed your recommendations for on/off, brightness and color temperature and everything works very well. But I can't handle the RGB of a group. I am using user.hue v5
Thank you in advance!
Best regards,
Nayden
Posts: 1793
Threads: 6
Joined: Jul 2015
Reputation:
120
Are you using setRGBGroup(Group_num,RGB_variable)?
Posts: 15
Threads: 4
Joined: Oct 2022
Reputation:
0
20.04.2023, 13:38
(This post was last modified: 20.04.2023, 20:02 by NKereshki .)
(20.04.2023, 12:12) Erwin van der Zwart Wrote: Are you using setRGBGroup(Group_num,RGB_variable)?
Hello,
I haven't tried that. In the forum I can't find an example script using the setRGBGroup(Group_num,RGB_variable). I'm an electrical engineer and now styding lua scripting. I used the RGB commands in the HUE for one lamp and everything works perfectly. But for a group I can't set it up.
Best regards,
Nayden Kereshki
Posts: 1793
Threads: 6
Joined: Jul 2015
Reputation:
120
Code:
1 2 3 4 5 6 7 8 9 10
require (
'user.hue' )
value =
event.getvalue ()
group_id =
1
if value ==
0 then
body_msg =
'{"on":false}'
sendToGroup (
lamp_id ,
body_msg )
else
setRGBGroup (
group_id ,
value )
end
Posts: 15
Threads: 4
Joined: Oct 2022
Reputation:
0
(21.04.2023, 06:45) Erwin van der Zwart Wrote: Code:
1 2 3 4 5 6 7 8 9 10
require (
'user.hue' )
value =
event.getvalue ()
group_id =
1
if value ==
0 then
body_msg =
'{"on":false}'
sendToGroup (
lamp_id ,
body_msg )
else
setRGBGroup (
group_id ,
value )
end
Hello, Erwin
Thank you very much for the help. It works exactly as I expected. I don't know what we would do without your support.
Best regards,
Nayden Kereshki
Posts: 52
Threads: 2
Joined: Mar 2019
Reputation:
1
01.05.2023, 08:44
(This post was last modified: 01.05.2023, 08:48 by Sral1987 .)
(05.09.2020, 20:24) Erwin van der Zwart Wrote: Hi,
You have 2 mistakes in your script:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
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:
1 2 3 4 5 6
require (
'user.hue' )
require (
'json' )
setBrightnessCTGroup (
1 ,
60 ,
2000 )
BR,
Erwin
Hi Erwin,
finaly i found time to Solve Group Control, unfortunanly i cant control Groups by Group Adress cause the Brightness Value is the Script by 100%. How could i change that ?
NVM!!! Sometimes the Solutuoion is just to easy ( shame on me )
of course it has to be like this
require('user.hue')
require('json')
--log(json.pdecode(getHueGroups())) -- enable to check group number
value = event.getvalue() -- 1 byte unsigned integer scale 0 - 100
setBrightnessGroup(3,value) -- Group, brightness in %
--setBrightnessCTGroup(1,60,2000) -- Group, brightness in %, CT in Kelvin