Good afternoon.
I try to create via node-red-contrib-googlehome, Level set function for domoticz.
For this I created an account with [Node-RED Google Assistant Bridge.
I added it to my google home, and added a device.
Now I have managed to give a, on and off command, but dimming is not possible. I can't created the right command. I added the flow. I have a raspberry 4, I run on docker/docker compose
[{"id":"34e77087.0485d","type":"google-home","z":"753ec312.e5c01c","conf":"73171d30.8abbf4","device":"10241","acknowledge":true,"name":"keuken links","topic":".idx.4","x":130,"y":400,"wires":[["f1794ef8.4343c"]]},{"id":"df5a008a.babad","type":"link out","z":"753ec312.e5c01c","name":"","links":["28dd7675.a7986a"],"x":895,"y":520,"wires":[]},{"id":"c9fc8cbe.afe96","type":"template","z":"753ec312.e5c01c","name":"","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{\"command\":\"switchlight\",\"idx\":64,\"switchcmd\": \"{{{payload}}}\" };","output":"str","x":660,"y":620,"wires":[["df5a008a.babad"]]},{"id":"112270b8.7db2ef","type":"change","z":"753ec312.e5c01c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"On","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":340,"wires":[["67cb33bd.1ae27c"]]},{"id":"257688d1.c1bcb8","type":"change","z":"753ec312.e5c01c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":640,"wires":[["2e98c7dd.7c0f58","c9fc8cbe.afe96"]]},{"id":"2e98c7dd.7c0f58","type":"debug","z":"753ec312.e5c01c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":700,"wires":[]},{"id":"56f5e63e.956618","type":"switch","z":"753ec312.e5c01c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"true","vt":"str"},{"t":"neq","v":"","vt":"prev"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":380,"wires":[["112270b8.7db2ef"],["da854be4.26b0b8"]]},{"id":"67cb33bd.1ae27c","type":"debug","z":"753ec312.e5c01c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":320,"wires":[]},{"id":"aa403066.3c881","type":"debug","z":"753ec312.e5c01c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":970,"y":400,"wires":[]},{"id":"da854be4.26b0b8","type":"function","z":"753ec312.e5c01c","name":"Function out Dimmer","func":"\nvar brightness = msg.payload\nif ( msg.payload === 0 )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": 64, \"switchcmd\": \"Off\" };\nreturn [msg, null]\n}\nelse\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": 64, \"switchcmd\": \"Set Level\", \"level\": brightness };\nreturn [null, msg]\n}\n\n\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":740,"y":400,"wires":[["df5a008a.babad"],["aa403066.3c881","df5a008a.babad"]]},{"id":"f1794ef8.4343c","type":"function","z":"753ec312.e5c01c","name":"","func":"\nif (msg.payload.command == \"action.devices.commands.OnOff\") {\n if (msg.payload.params.on) {\n msg.payload = true;\n return [msg,null];\n } else {\n msg.payload = false;\n return [null,msg];\n }\n} else {\n //brightness\n var brightness = Math.round(100 * (msg.payload.params.brightness / 100));\n msg.payload = { brightness\n }\n return [msg,null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","x":320,"y":400,"wires":[["56f5e63e.956618"],["257688d1.c1bcb8"]]},{"id":"73171d30.8abbf4","type":"google-home-conf","username":"bce626"}]
log output
{"command":"switchlight","idx":64,"switchcmd":"Set Level","level":{"brightness":53}}
instead of what is needed for the trigger to take place
{"command":"switchlight","idx":64,"switchcmd":"Set Level","level":{53}}
thank you in advance for all the help.
this post was created with online translate