mjwwit / node-red-contrib-ikea-tradfri

Node-RED nodes to get updates from and control devices connected to an IKEA TRADFRI gateway
3 stars 3 forks source link

light control error messages in debug log #7

Closed JBlond closed 2 years ago

JBlond commented 3 years ago

When I use the tradfri-light-control I get a lot of error messages in the log.

Invalid message received, using node config!
Invalid value 0 supplied to : TradfriLightControlMessage/0: Partial<{ topic: (Int | Array<Int>), payload: TradfriLightControlAction }>/payload: TradfriLightControlAction
mjwwit commented 3 years ago

It appears you're giving the node incorrect messages. From what I can deduce from the error your message contains {"payload":0}, where it expects to receive an Object specifying the action you want to perform. Are you able to share the message you're sending to the node?

JBlond commented 3 years ago

I have a standard switch. 002

And the tradfri-light-control

001

JBlond commented 3 years ago

The error is shown on the debugger, yet the lights turns on and off.

mjwwit commented 3 years ago

Ok, I'm interested to see what payload you're sending to the light-control node. You can inspect this by adding a debug node. Please show me the entire message object.

JBlond commented 3 years ago

okay, the debug output is strange. Since in the standard switch I configured it to send msg topic.

7 Jun 21:22:46 - [warn] [tradfri-light-control:WZ-on] Invalid message received, using node config!
Invalid value "off" supplied to : TradfriLightControlMessage/0: Partial<{ topic: (Int | Array<Int>), payload: TradfriLightControlAction }>/payload: TradfriLightControlAction
7 Jun 21:22:46 - [info] [tradfri-light-control:WZ-on] Sending {"onOff":true} to accessories: [0,0,0] and groups: [131073,131073,131073]
7 Jun 21:22:46 - [info] [tradfri-light-control:WZ-on] Executing operation: {"onOff":true}
7 Jun 21:22:46 - [info] [debug:debug-on] undefined
7 Jun 21:22:46 - [warn] [tradfri-light-control:wz-off] Invalid message received, using node config!
Invalid value "off" supplied to : TradfriLightControlMessage/0: Partial<{ topic: (Int | Array<Int>), payload: TradfriLightControlAction }>/payload: TradfriLightControlAction
7 Jun 21:22:46 - [info] [tradfri-light-control:wz-off] Sending {"onOff":false} to accessories: [0] and groups: [131073]
7 Jun 21:22:46 - [info] [tradfri-light-control:wz-off] Executing operation: {"onOff":false}
7 Jun 21:22:46 - [info] [tradfri-light-control:WZ-on] Light action result: [{"status":"fulfilled","value":true}]
7 Jun 21:22:46 - [info] [tradfri-light-control:wz-off] Light action result: [{"status":"fulfilled","value":true}]
7 Jun 21:22:46 - [info] [tradfri-config:gateway] Group updated: 131073 Licht

When I connect a dash board switch it doesn't work at all.

mjwwit commented 3 years ago

Hm, I still can't see the message you're sending to the node...

Can you configure your setup to look similar to this? image Please note the Output setting of the debug node is configured to show the complete msg object.

JBlond commented 3 years ago
17.6.2021, 21:38:02node: WZ-on
msg : string[217]
string[217]

Invalid message received, using node config!
Invalid value "on" supplied to : TradfriLightControlMessage/0: Partial<{ topic: (Int | Array<Int>), payload: TradfriLightControlAction }>/payload: TradfriLightControlAction

17.6.2021, 21:38:02node: d13f493b.ece75msg : Object
{ payload: "on", socketid: "J34oCDvvihf-wI_yAAAA", _msgid: "4597428c.18185c" }
17.6.2021, 21:38:03node: wz-off
msg : string[217]
"Invalid message received, using node config!↵Invalid value "on" supplied to : TradfriLightControlMessage/0: Partial<{ topic: (Int | Array<Int>), payload: TradfriLightControlAction }>/payload: TradfriLightControlAction"
Soiski71 commented 3 years ago

JBlond.

Its much more simpler that you think reading the instructions. I had exactly same issue/problem that Michael helped me to fix.

image

JBlond commented 3 years ago

@Soiski71 that did not work for me. Simply changing it to "payload" with ""on".

Since I want to know the state of the lamps, on the Dashboard switch, my setup is a bit more complex.

setup

Soiski71 commented 3 years ago

You are correct. You are using the light switch and not the switch control. They seems to behave little bit differently. I agree "complicated is the key word. Here's how I managed to make the light switch to work with push button and real time reply also if light turned on / off from mechanical switch.

image

Also the whole code in text so you can import to see "whats inside"

[{"id":"9b71b572.590338","type":"ui_switch","z":"d98c8438.626d38","name":"","label":"Olohuone jalkal.","tooltip":"","group":"168d7ea3.a5e391","order":10,"width":5,"height":2,"passthru":false,"decouple":"true","topic":"","topicType":"str","style":"","onvalue":"true","onvalueType":"bool","onicon":"fa-3x fa-toggle-on","oncolor":"green","offvalue":"false","offvalueType":"bool","officon":"fa-3x fa-toggle-off","offcolor":"red","animate":true,"x":1073.3051681518555,"y":263.85533142089844,"wires":[["70fc76a9.5bcc48"]]},{"id":"c944e1bd.fd045","type":"tradfri-light-control","z":"d98c8438.626d38","gateway":"fe4ff63b.fa5388","name":"OH Jalkalamppu ON","action":"{\"onOff\":true,\"brightness\":15}","accessories":["65566"],"groups":[],"x":705.6672286987305,"y":80.33338260650635,"wires":[]},{"id":"1a04ebae.7b35a4","type":"tradfri-monitor","z":"d98c8438.626d38","gateway":"fe4ff63b.fa5388","name":"","x":1553.6670455932617,"y":100.20002269744873,"wires":[["5fada44b.61d31c","fba60543.e7bd78"]]},{"id":"5fada44b.61d31c","type":"debug","z":"d98c8438.626d38","name":"IKEA MONITOR","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1840.6668014526367,"y":98.3333568572998,"wires":[]},{"id":"73a4d552.95c63c","type":"inject","z":"d98c8438.626d38","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"topic\": [1], \"payload\": \"on\" }","payloadType":"json","x":265.66705322265625,"y":70.20002555847168,"wires":[["c944e1bd.fd045","d0fe4ac2.b71748"]]},{"id":"8e5764fe.4d01e8","type":"tradfri-state","z":"d98c8438.626d38","gateway":"fe4ff63b.fa5388","name":"","accessories":["65566"],"groups":[],"x":590.6669769287109,"y":260.80006980895996,"wires":[["46968a35.3e9424"]]},{"id":"42da898b.62d458","type":"tradfri-light-control","z":"d98c8438.626d38","gateway":"fe4ff63b.fa5388","name":"OH Jalkalamppu OFF","action":"{\"onOff\":false}","accessories":["65566"],"groups":[],"x":593.9337005615234,"y":184.9333610534668,"wires":[]},{"id":"3e4835a9.a063ea","type":"inject","z":"d98c8438.626d38","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"topic\": [1], \"payload\": \"on\" }","payloadType":"json","x":261.93350982666016,"y":189.93332386016846,"wires":[["42da898b.62d458","c2e9ba59.a99c58"]]},{"id":"46968a35.3e9424","type":"function","z":"d98c8438.626d38","name":"","func":"msg.payload = msg.payload[\"65566\"].lightbulb.isOn\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":799.6670570373535,"y":265.53338050842285,"wires":[["9b71b572.590338"]]},{"id":"d0fe4ac2.b71748","type":"delay","z":"d98c8438.626d38","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":408.6666717529297,"y":134.53338527679443,"wires":[[]]},{"id":"c2e9ba59.a99c58","type":"delay","z":"d98c8438.626d38","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":388.9333381652832,"y":254.93334770202637,"wires":[[]]},{"id":"70fc76a9.5bcc48","type":"switch","z":"d98c8438.626d38","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1261.6667175292969,"y":206.00000762939453,"wires":[["4997e180.b2c04"],["230b3183.73be7e"]]},{"id":"4997e180.b2c04","type":"function","z":"d98c8438.626d38","name":"","func":"msg.payload = { \"topic\": [1], \"payload\": \"on\" };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1266.6667175292969,"y":110.53333282470703,"wires":[["d0fe4ac2.b71748","c944e1bd.fd045"]]},{"id":"230b3183.73be7e","type":"function","z":"d98c8438.626d38","name":"","func":"msg.payload = { \"topic\": [1], \"payload\": \"on\" };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1264.9335403442383,"y":355.93334007263184,"wires":[["42da898b.62d458","c2e9ba59.a99c58"]]},{"id":"1b336bc.79e2594","type":"link in","z":"d98c8438.626d38","name":"OH IN","links":["7ba61cf2.244554"],"x":819.6667175292969,"y":191.8666763305664,"wires":[["8e5764fe.4d01e8"]]},{"id":"7ba61cf2.244554","type":"link out","z":"d98c8438.626d38","name":"OH IN","links":["1b336bc.79e2594"],"x":2082.6668128967285,"y":114.00002670288086,"wires":[]},{"id":"f85569fd.a77be8","type":"switch","z":"d98c8438.626d38","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"65566","vt":"num"},{"t":"eq","v":"65545","vt":"num"},{"t":"eq","v":"65561","vt":"str"},{"t":"eq","v":"65557","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":1927.6670608520508,"y":189.66677474975586,"wires":[["7ba61cf2.244554"],["dbc99a15.8b9588"],["a7f1c235.9b039"],["81bf7aa6.a0e838"]]},{"id":"fba60543.e7bd78","type":"function","z":"d98c8438.626d38","name":"","func":"msg.payload = msg.payload.instanceId\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1751.9334602355957,"y":189.9333553314209,"wires":[["f85569fd.a77be8"]]},{"id":"dbc99a15.8b9588","type":"link out","z":"d98c8438.626d38","name":"MH OUT","links":["c68375ac.f82488"],"x":2079.6668128967285,"y":177.0000457763672,"wires":[]},{"id":"a7f1c235.9b039","type":"link out","z":"d98c8438.626d38","name":"LH OUT","links":["39a6847c.3ff19c"],"x":2075.6668128967285,"y":226.33334922790527,"wires":[]},{"id":"81bf7aa6.a0e838","type":"link out","z":"d98c8438.626d38","name":"TIET OUT","links":["7284856f.c48d6c"],"x":2079.6668128967285,"y":281.33333683013916,"wires":[]},{"id":"168d7ea3.a5e391","type":"ui_group","name":"Home Lights","tab":"f52248a1.476138","order":1,"disp":true,"width":9,"collapse":false},{"id":"fe4ff63b.fa5388","type":"tradfri-config","name":"IKEA GW","gatewayHost":"TRADFRI-Gateway-449160250d15.local","identity":"tradfri_1624464080588","preSharedKey":"Aycw3gmuwmPxddHX"},{"id":"f52248a1.476138","type":"ui_tab","name":"Home Lights","icon":"fa-lightbulb-o","order":3,"disabled":false,"hidden":false}]

mjwwit commented 2 years ago

I've just released a new version (0.6.0) which adds checkboxes to node configurations so you can disable input message validation warning logs. If everything works correctly, but you still see warnings in the debug log, you can simply disable these messages now.