Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Node red home assistant script to keep roku playing
[{"id":"702ec556.56c62c","type":"tab","label":"HA_S00_Roku","disabled":false,"info":""},{"id":"66a4867d.a17bc8","type":"debug","z":"702ec556.56c62c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":600,"wires":[]},{"id":"c35e6efa.0cc1c","type":"server-state-changed","z":"702ec556.56c62c","name":"","server":"f1283dff.e8922","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"media_player.roku_master","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":220,"y":360,"wires":[["8ffec5bd.951c5","c66cf0f4.023b58"]]},{"id":"8ffec5bd.951c5","type":"switch","z":"702ec556.56c62c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"paused","vt":"str"},{"t":"eq","v":"playing","vt":"str"},{"t":"eq","v":"idle","vt":"str"},{"t":"eq","v":"home","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":230,"y":520,"wires":[["1d3be1f.c13ba1e"],["3eab646.6317d9c"],["18553147.0f53ff"],["46660089.378c58"],["46660089.378c58"]]},{"id":"18553147.0f53ff","type":"change","z":"702ec556.56c62c","name":"Playing","rules":[{"t":"set","p":"isPlaying","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":540,"wires":[["66a4867d.a17bc8"]]},{"id":"1d3be1f.c13ba1e","type":"switch","z":"702ec556.56c62c","name":"on --> play","property":"isPlaying","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":450,"y":460,"wires":[["246d8ab1.faf6d6"]]},{"id":"3c08a148.50e196","type":"api-call-service","z":"702ec556.56c62c","name":"remote select","server":"f1283dff.e8922","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.roku_master","data":"{\"command\":\"select\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":680,"y":360,"wires":[["66a4867d.a17bc8"]]},{"id":"46660089.378c58","type":"change","z":"702ec556.56c62c","name":"Not Playing","rules":[{"t":"set","p":"isPlaying","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":580,"wires":[["66a4867d.a17bc8"]]},{"id":"3eab646.6317d9c","type":"switch","z":"702ec556.56c62c","name":"paused --> play","property":"isPlaying","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":460,"y":500,"wires":[["cd8027d1.b13d28"]]},{"id":"cd8027d1.b13d28","type":"api-call-service","z":"702ec556.56c62c","name":"remote play","server":"f1283dff.e8922","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.roku_master","data":"{\"command\":\"play\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":390,"y":740,"wires":[["39b81339.146e64"]]},{"id":"c66cf0f4.023b58","type":"debug","z":"702ec556.56c62c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":280,"wires":[]},{"id":"884be920.1d0c38","type":"api-current-state","z":"702ec556.56c62c","name":"","server":"f1283dff.e8922","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"media_player.roku_master","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":500,"y":900,"wires":[["f49e8b73.fdd6a"]]},{"id":"39b81339.146e64","type":"delay","z":"702ec556.56c62c","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":520,"y":680,"wires":[["884be920.1d0c38"]]},{"id":"f49e8b73.fdd6a","type":"switch","z":"702ec556.56c62c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"paused","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":840,"wires":[["4c6eb618.78db88"]]},{"id":"4c6eb618.78db88","type":"api-call-service","z":"702ec556.56c62c","name":"remote select","server":"f1283dff.e8922","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.roku_master","data":"{\"command\":\"select\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":760,"y":720,"wires":[["66a4867d.a17bc8"]]},{"id":"246d8ab1.faf6d6","type":"delay","z":"702ec556.56c62c","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":520,"y":400,"wires":[["3c08a148.50e196"]]},{"id":"f1283dff.e8922","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.