Skip to content

Instantly share code, notes, and snippets.

@tmarquespt
Created January 31, 2022 22:21
Show Gist options
  • Save tmarquespt/20674700769c7d4ba60c96bca22f9fd8 to your computer and use it in GitHub Desktop.
Save tmarquespt/20674700769c7d4ba60c96bca22f9fd8 to your computer and use it in GitHub Desktop.
Node-RED Ikea dimmer Nest volume control
[{"id":"4d1de183f6149d7a","type":"tab","label":"Flow 4","disabled":false,"info":"","env":[]},{"id":"c28b4db1424b96bb","type":"cast-to-client","z":"4d1de183f6149d7a","name":"","url":"","contentType":"","message":"","language":"pt","ip":"10.11.5.14","port":"","volume":"","x":800,"y":520,"wires":[[]]},{"id":"ec3632cb5e84f68d","type":"time-based-dimmer","z":"4d1de183f6149d7a","name":"dimmer","interval":200,"step":5,"minValue":0,"maxValue":100,"startIncCommand":"up","stopIncCommand":"stop","startDecCommand":"down","stopDecCommand":"stop","x":440,"y":520,"wires":[["d2c1de7b13baa65a"]]},{"id":"cc2e4714f0dcf7e6","type":"inject","z":"4d1de183f6149d7a","name":"up","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"up","payloadType":"str","x":230,"y":480,"wires":[["ec3632cb5e84f68d"]]},{"id":"116f5add7b865d81","type":"inject","z":"4d1de183f6149d7a","name":"down","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"down","payloadType":"str","x":230,"y":560,"wires":[["ec3632cb5e84f68d"]]},{"id":"f43d6f33676bfb94","type":"inject","z":"4d1de183f6149d7a","name":"stop","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"stop","payloadType":"str","x":230,"y":520,"wires":[["ec3632cb5e84f68d"]]},{"id":"d2c1de7b13baa65a","type":"change","z":"4d1de183f6149d7a","name":"msg2volume","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.volume","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":520,"wires":[["c28b4db1424b96bb"]]},{"id":"2f739310b2edc102","type":"server-state-changed","z":"4d1de183f6149d7a","name":"nest.volume","server":"2998c139.aa476e","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"media_player.nestaudio3541","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":230,"y":400,"wires":[["9d9f636deed02143"]]},{"id":"9d9f636deed02143","type":"function","z":"4d1de183f6149d7a","name":"","func":"\nvar nestlevel = Number(((msg.data.new_state.attributes.volume_level * 100)).toFixed(0))\nmsg.payload = nestlevel \nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":400,"wires":[["ec3632cb5e84f68d"]]},{"id":"2998c139.aa476e","type":"server","name":"Home Assistant1","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment