Home Assistant Community

Movie mode lighting automation

#1

With my yaml config I have a ‘movie mode’ whereby when Kodi’s state changed the lights in the living room would respond (see https://github.com/glitchcrab/homeassistant/blob/master/automations/media_living_room.yaml).

I’ve migrated most of my config over to node-red, however I’ve not managed to figure this one out. I would like to only trigger the lights if an input boolean is enabled and if the lights are already on, but I’m really struggling to get my head around how I can achieve this. I’ve tried all sorts of things like trying to set a traffic light node etc, but I’ve not managed to construct anything good.

Any suggestions gratefully received!

0 Likes

#2

Add three nodes:

Use an Event State node to monitor Kodi’s state.
Link that to a Current State node that checks your input boolean. Set the nodes halt if property to false.
Link to another Current State node that checks the state of your lights. Set the nodes halt if property to off.
Link to whatever you want to do if the input boolean and lights are both on.

0 Likes

#3

This could be made simpler by using a function node and a little custom code but I wanted to do without using custom code. So hopefully it might be relatable to more people. It’s not fully tested but should get you going in a good direction.

[{"id":"3f9bd620.f9819a","type":"switch","z":"60bb206f.079fd","name":"","property":"payload","propertyType":"msg","rules":[{"t":"jsonata_exp","v":"data.event.old_state.state = \"idle\" and data.event.new_state.state = \"playing\"","vt":"jsonata"},{"t":"jsonata_exp","v":"data.event.old_state.state = \"playing\" and data.event.new_state.state = \"paused\"","vt":"jsonata"},{"t":"jsonata_exp","v":"data.event.old_state.state = \"paused\" and data.event.new_state.state = \"playing\"","vt":"jsonata"},{"t":"eq","v":"idle","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":706,"y":576,"wires":[["4b32f46f.04f63c"],["a8e6d2b5.b30f7"],["9e3d80c8.c265a"],["7171c007.00887"]]},{"id":"35f337ec.39d538","type":"inject","z":"60bb206f.079fd","name":"playing -> paused","topic":"","payload":"{\"entity_id\":\"media_player.kodi\",\"old_state\":{\"state\":\"playing\"},\"new_state\":{\"state\":\"paused\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":234,"y":576,"wires":[["cd2586f3.5ff678"]]},{"id":"6bb541a.a0a67c","type":"inject","z":"60bb206f.079fd","name":"paused -> playing","topic":"","payload":"{\"entity_id\":\"media_player.kodi\",\"old_state\":{\"state\":\"paused\"},\"new_state\":{\"state\":\"playing\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":234,"y":608,"wires":[["cd2586f3.5ff678"]]},{"id":"da0cd1d2.af4a3","type":"inject","z":"60bb206f.079fd","name":"idle -> playing","topic":"","payload":"{\"entity_id\":\"media_player.kodi\",\"old_state\":{\"state\":\"idle\"},\"new_state\":{\"state\":\"playing\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":214,"y":544,"wires":[["cd2586f3.5ff678"]]},{"id":"6ebf8364.a211fc","type":"inject","z":"60bb206f.079fd","name":"random -> idle","topic":"","payload":"{\"entity_id\":\"media_player.kodi\",\"old_state\":{\"state\":\"random\"},\"new_state\":{\"state\":\"idle\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":214,"y":640,"wires":[["cd2586f3.5ff678"]]},{"id":"cd2586f3.5ff678","type":"trigger-state","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","entityid":"media_player.kodi","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"9j39dq9ztx8","targetType":"entity_id","targetValue":"sun.sun","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"below_horizon"},{"id":"tdsi2wxqhzl","targetType":"entity_id","targetValue":"input_boolean.lounge_media_dim_enable","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"id":"5gunooldeqa","targetType":"entity_id","targetValue":"group.lounge_hues","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":498,"y":576,"wires":[["3f9bd620.f9819a"],[]]},{"id":"b13f5825.98d938","type":"trigger-state","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","entityid":"group.lounge_hues","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"9che1gtjte8","targetType":"entity_id","targetValue":"media_player.kodi","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"playing"},{"id":"wr0a0qz3ho","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"id":"g7hcv1xrnz5","targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is_not","comparatorValueDatatype":"str","comparatorValue":"on"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":258,"y":464,"wires":[["4b32f46f.04f63c"],[]]},{"id":"4b32f46f.04f63c","type":"api-current-state","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.standard_lamp_right","state_type":"str","state_location":"","override_payload":"none","entity_location":"data","override_data":"msg","x":608,"y":464,"wires":[["9e3d80c8.c265a"]]},{"id":"9e3d80c8.c265a","type":"change","z":"60bb206f.079fd","name":"brightness: slider trans: 2","rules":[{"t":"set","p":"saved_lounge_brightness","pt":"flow","to":"data.attributes.brightness","tot":"msg"},{"t":"set","p":"brightness","pt":"msg","to":"kodi_dimmer_slider","tot":"flow"},{"t":"set","p":"transition","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":958,"y":512,"wires":[["daafd6a6.0e87f8"]]},{"id":"9ba76a9d.b541c8","type":"comment","z":"60bb206f.079fd","name":"For Testing","info":"","x":204,"y":512,"wires":[]},{"id":"a0bf8f4a.aa105","type":"server-state-changed","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","entityidfilter":"input_number.kodi_dimmer_slider","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"x":308,"y":688,"wires":[["28e48628.d0181a"]]},{"id":"28e48628.d0181a","type":"change","z":"60bb206f.079fd","name":"","rules":[{"t":"set","p":"kodi_dimmer_slider","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":648,"y":688,"wires":[[]]},{"id":"daafd6a6.0e87f8","type":"api-call-service","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"group.lounge_hues\",\"brightness_pct\":\"{{brightness}}\",\"transition\":\"{{transition}}\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","x":1210,"y":560,"wires":[[]]},{"id":"a8e6d2b5.b30f7","type":"change","z":"60bb206f.079fd","name":"brightness: 50 trans: 3","rules":[{"t":"set","p":"brightness","pt":"msg","to":"50","tot":"num"},{"t":"set","p":"transition","pt":"msg","to":"3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":948,"y":560,"wires":[["daafd6a6.0e87f8"]]},{"id":"7171c007.00887","type":"change","z":"60bb206f.079fd","name":"brightness: saved trans: 3","rules":[{"t":"set","p":"brightness","pt":"msg","to":"saved_lounge_brightness","tot":"flow"},{"t":"set","p":"transition","pt":"msg","to":"3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":958,"y":608,"wires":[["daafd6a6.0e87f8"]]}]
0 Likes

#4

There was an error when saving the brightness.

[{"id":"3f9bd620.f9819a","type":"switch","z":"60bb206f.079fd","name":"","property":"payload","propertyType":"msg","rules":[{"t":"jsonata_exp","v":"data.event.old_state.state = \"idle\" and data.event.new_state.state = \"playing\"","vt":"jsonata"},{"t":"jsonata_exp","v":"data.event.old_state.state = \"playing\" and data.event.new_state.state = \"paused\"","vt":"jsonata"},{"t":"jsonata_exp","v":"data.event.old_state.state = \"paused\" and data.event.new_state.state = \"playing\"","vt":"jsonata"},{"t":"eq","v":"idle","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":706,"y":576,"wires":[["4b32f46f.04f63c"],["a8e6d2b5.b30f7"],["9e3d80c8.c265a"],["7171c007.00887"]]},{"id":"35f337ec.39d538","type":"inject","z":"60bb206f.079fd","name":"playing -> paused","topic":"","payload":"{\"entity_id\":\"media_player.kodi\",\"old_state\":{\"state\":\"playing\"},\"new_state\":{\"state\":\"paused\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":234,"y":576,"wires":[["cd2586f3.5ff678"]]},{"id":"6bb541a.a0a67c","type":"inject","z":"60bb206f.079fd","name":"paused -> playing","topic":"","payload":"{\"entity_id\":\"media_player.kodi\",\"old_state\":{\"state\":\"paused\"},\"new_state\":{\"state\":\"playing\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":234,"y":608,"wires":[["cd2586f3.5ff678"]]},{"id":"da0cd1d2.af4a3","type":"inject","z":"60bb206f.079fd","name":"idle -> playing","topic":"","payload":"{\"entity_id\":\"media_player.kodi\",\"old_state\":{\"state\":\"idle\"},\"new_state\":{\"state\":\"playing\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":214,"y":544,"wires":[["cd2586f3.5ff678"]]},{"id":"6ebf8364.a211fc","type":"inject","z":"60bb206f.079fd","name":"random -> idle","topic":"","payload":"{\"entity_id\":\"media_player.kodi\",\"old_state\":{\"state\":\"random\"},\"new_state\":{\"state\":\"idle\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":214,"y":640,"wires":[["cd2586f3.5ff678"]]},{"id":"cd2586f3.5ff678","type":"trigger-state","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","entityid":"media_player.kodi","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"9j39dq9ztx8","targetType":"entity_id","targetValue":"sun.sun","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"below_horizon"},{"id":"tdsi2wxqhzl","targetType":"entity_id","targetValue":"input_boolean.lounge_media_dim_enable","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"id":"5gunooldeqa","targetType":"entity_id","targetValue":"group.lounge_hues","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":498,"y":576,"wires":[["3f9bd620.f9819a"],[]]},{"id":"b13f5825.98d938","type":"trigger-state","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","entityid":"group.lounge_hues","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"9che1gtjte8","targetType":"entity_id","targetValue":"media_player.kodi","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"playing"},{"id":"wr0a0qz3ho","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"id":"g7hcv1xrnz5","targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is_not","comparatorValueDatatype":"str","comparatorValue":"on"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":258,"y":464,"wires":[["4b32f46f.04f63c"],[]]},{"id":"4b32f46f.04f63c","type":"api-current-state","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.standard_lamp_right","state_type":"str","state_location":"","override_payload":"none","entity_location":"data","override_data":"msg","x":608,"y":464,"wires":[["d9aa433a.0ee7d"]]},{"id":"9e3d80c8.c265a","type":"change","z":"60bb206f.079fd","name":"brightness: slider trans: 2","rules":[{"t":"set","p":"brightness","pt":"msg","to":"kodi_dimmer_slider","tot":"flow"},{"t":"set","p":"transition","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":958,"y":512,"wires":[["daafd6a6.0e87f8"]]},{"id":"9ba76a9d.b541c8","type":"comment","z":"60bb206f.079fd","name":"For Testing","info":"","x":204,"y":512,"wires":[]},{"id":"a0bf8f4a.aa105","type":"server-state-changed","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","entityidfilter":"input_number.kodi_dimmer_slider","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"x":308,"y":688,"wires":[["28e48628.d0181a"]]},{"id":"28e48628.d0181a","type":"change","z":"60bb206f.079fd","name":"","rules":[{"t":"set","p":"kodi_dimmer_slider","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":648,"y":688,"wires":[[]]},{"id":"daafd6a6.0e87f8","type":"api-call-service","z":"60bb206f.079fd","name":"","server":"ef067c6f.620e6","service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"group.lounge_hues\",\"brightness_pct\":\"{{brightness}}\",\"transition\":\"{{transition}}\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","x":1210,"y":560,"wires":[[]]},{"id":"a8e6d2b5.b30f7","type":"change","z":"60bb206f.079fd","name":"brightness: 50 trans: 3","rules":[{"t":"set","p":"brightness","pt":"msg","to":"50","tot":"num"},{"t":"set","p":"transition","pt":"msg","to":"3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":948,"y":560,"wires":[["daafd6a6.0e87f8"]]},{"id":"7171c007.00887","type":"change","z":"60bb206f.079fd","name":"brightness: saved trans: 3","rules":[{"t":"set","p":"brightness","pt":"msg","to":"saved_lounge_brightness","tot":"flow"},{"t":"set","p":"transition","pt":"msg","to":"3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":958,"y":608,"wires":[["daafd6a6.0e87f8"]]},{"id":"d9aa433a.0ee7d","type":"change","z":"60bb206f.079fd","name":"save brightness","rules":[{"t":"set","p":"saved_lounge_brightness","pt":"flow","to":"data.attributes.brightness","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":928,"y":464,"wires":[["9e3d80c8.c265a"]]}]
0 Likes

#5

Kermit: that’s fantastic, thanks so much! It makes perfect sense when I look at it, but I definitely have a lot more to learn to be able to create that myself.

0 Likes

#6

Just to follow up on this - I implemented it this evening and it almost works. I get an API error when the last node actually tries to change the light brightness. Below is the output from a debug node attached to that node:

{
   "domain": "light",
   "service": "turn_on",
   "data": {
       "entity_id": "group.lounge_hues",
       "brightness_pct": "{{brightness}}",
       "transition":"{{transition}}"
   }
}

As you can see, it doesn’t seem to be interpolating the variables from the previous message (which are set correctly.

0 Likes

#7

Hi, there is a good node for Kodi available. You will be able to detect all kind of states (PLAY,PAUSE, SCREENSAVER,etc) and than act your light accordingly … you can setup your automation as mentioned by @Kermit but using the Kodi-Node.

I’m using the Kodi-Node and can do lots of things

  • Turn off lights when a Movie is playing
  • I dim the ligths to 10% when TV Shows are playing
  • I resume the light to 75% when a movie or tv show is paused
  • I resume the light to 100% when a movie or tv show is finished or stopped
  • I send notifications to KODI (display on screen) when a movie or tv-show is playing (if no Kodi is playing I announce the notification via Sonos)

I can share a sample and further details when reaching home tonight

0 Likes

#8

I assume you’re using a version prior to 0.9.0. If that’s the case in the call-service node make sure Render templates in data is checked.

0 Likes

#9

That’s correct I am, I know i need to upgrade it but that’s going to involve replacing a whole bunch of nodes as i’m still using the old node-red-contrib-home-assistant package so I’ve held off doing it for now.

0 Likes

#10

Thanks for the tip, I’d be interested to see what you’ve got. I wasn’t aware of a dedicated node for Kodi!

0 Likes

#11

Yes, the KODI node really works awesome and you can utilize the entire JSON functionality provided by KODI.

As I’m using WIFI and/or Ethernet on my KODI boxes I have generated 2 enry and exit points per KODI (e.g. TS Kodi)

There is no light control in this example as I have my light automation in dedicated flows calling from these playing states.

here is a sample video for the playing status

[{"id":"49c63ea8.8a147","type":"kodi-in","z":"2a59a65.117295a","name":"TS Kodi","controller":"85f19228.2703f","x":90,"y":540,"wires":[["bc46bb0c.f41c38","8c2c552.d1370a8","4b099f8d.4b985"]]},{"id":"bc46bb0c.f41c38","type":"switch","z":"2a59a65.117295a","name":"ScreenSaver","property":"payload.notification","propertyType":"msg","rules":[{"t":"eq","v":"GUI.OnScreensaverActivated","vt":"str"},{"t":"eq","v":"GUI.OnScreensaverDeactivated","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":250,"y":520,"wires":[["820787c8.cf2bb8"],["d26c116f.7a294"]]},{"id":"8c2c552.d1370a8","type":"debug","z":"2a59a65.117295a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":220,"y":680,"wires":[]},{"id":"4b099f8d.4b985","type":"switch","z":"2a59a65.117295a","name":"Playing","property":"payload.notification","propertyType":"msg","rules":[{"t":"eq","v":"Player.OnPlay","vt":"str"},{"t":"eq","v":"Player.OnPause","vt":"str"},{"t":"eq","v":"Player.OnStop","vt":"str"},{"t":"eq","v":"System.OnQuit","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":115,"y":871,"wires":[["d26c116f.7a294","2c274dda.5291f2"],["932f50f4.bfa01"],["a78d0782.d2f0f8"],["3560a381.17070c"]]},{"id":"f5d34f7d.bd52c","type":"kodi-in","z":"2a59a65.117295a","name":"TS Kodi","controller":"5d6b605e.1f277","x":90,"y":580,"wires":[["bc46bb0c.f41c38","4b099f8d.4b985","8c2c552.d1370a8"]]},{"id":"820787c8.cf2bb8","type":"link out","z":"2a59a65.117295a","name":"","links":["395ff4f8.f09efc"],"x":475,"y":520,"wires":[]},{"id":"d26c116f.7a294","type":"link out","z":"2a59a65.117295a","name":"TV on","links":["88116503.c233a8","be34b4e.9beed48"],"x":475,"y":600,"wires":[]},{"id":"2c274dda.5291f2","type":"template","z":"2a59a65.117295a","name":"Movie started","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"cmd\": \"GUI.ShowNotification\",\n    \"args\": {\n        \"title\": \"Movie started [xx%]\",\n        \"message\": \"---\"\n    }\n}","output":"str","x":755,"y":831,"wires":[["4a9f7b98.83b554","1ee73792.439c88"]]},{"id":"932f50f4.bfa01","type":"template","z":"2a59a65.117295a","name":"Movie paused","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"cmd\": \"GUI.ShowNotification\",\n    \"args\": {\n        \"title\": \"Movie paused [xx%]\",\n        \"message\": \"---\"\n    }\n}","output":"str","x":755,"y":871,"wires":[["4a9f7b98.83b554"]]},{"id":"a78d0782.d2f0f8","type":"template","z":"2a59a65.117295a","name":"Movie stop","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"cmd\": \"GUI.ShowNotification\",\n    \"args\": {\n        \"title\": \"Movie stopped [xx%]\",\n        \"message\": \"---\"\n    }\n}","output":"str","x":745,"y":911,"wires":[["4a9f7b98.83b554"]]},{"id":"3560a381.17070c","type":"link out","z":"2a59a65.117295a","name":"TS TV off","links":["395ff4f8.f09efc"],"x":335,"y":940,"wires":[]},{"id":"f46e88ca.a57b38","type":"inject","z":"2a59a65.117295a","name":"off","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":580,"wires":[["820787c8.cf2bb8"]]},{"id":"dc5d7027.69f59","type":"inject","z":"2a59a65.117295a","name":"on","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":620,"wires":[["d26c116f.7a294"]]},{"id":"4a9f7b98.83b554","type":"change","z":"2a59a65.117295a","name":"+ Title","rules":[{"t":"change","p":"payload","pt":"msg","from":"---","fromt":"str","to":"Kodi_TS.title","tot":"global"},{"t":"change","p":"payload","pt":"msg","from":"xx","fromt":"str","to":"Kodi_TS.progress","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":965,"y":871,"wires":[["d4b36daa.426ca"]]},{"id":"1ee73792.439c88","type":"link out","z":"2a59a65.117295a","name":"TV on -","links":["5ddf80e1.4b98c"],"x":1090,"y":831,"wires":[]},{"id":"d4b36daa.426ca","type":"link out","z":"2a59a65.117295a","name":"TS Kodi","links":["607f0588.d0e7bc"],"x":1090,"y":871,"wires":[]},{"id":"85f19228.2703f","type":"kodi-controller","z":"","name":"TS_Kodi_wifi","host":"192.168.1.175","port":"9090"},{"id":"5d6b605e.1f277","type":"kodi-controller","z":"","name":"Kodi_ts_lan","host":"192.168.1.179","port":"9090"}]

and a sample flow for notifications on the TV using KODI


[{“id”:“49c63ea8.8a147”,“type”:“kodi-in”,“z”:“2a59a65.117295a”,“name”:“TS Kodi”,“controller”:“85f19228.2703f”,“x”:90,“y”:540,“wires”:[[“bc46bb0c.f41c38”,“8c2c552.d1370a8”,“4b099f8d.4b985”]]},{“id”:“bc46bb0c.f41c38”,“type”:“switch”,“z”:“2a59a65.117295a”,“name”:“ScreenSaver”,“property”:“payload.notification”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“GUI.OnScreensaverActivated”,“vt”:“str”},{“t”:“eq”,“v”:“GUI.OnScreensaverDeactivated”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:2,“x”:250,“y”:520,“wires”:[[“820787c8.cf2bb8”],[“d26c116f.7a294”]]},{“id”:“8c2c552.d1370a8”,“type”:“debug”,“z”:“2a59a65.117295a”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“x”:220,“y”:680,“wires”:[]},{“id”:“4b099f8d.4b985”,“type”:“switch”,“z”:“2a59a65.117295a”,“name”:“Playing”,“property”:“payload.notification”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“Player.OnPlay”,“vt”:“str”},{“t”:“eq”,“v”:“Player.OnPause”,“vt”:“str”},{“t”:“eq”,“v”:“Player.OnStop”,“vt”:“str”},{“t”:“eq”,“v”:“System.OnQuit”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:4,“x”:115,“y”:871,“wires”:[[“d26c116f.7a294”,“2c274dda.5291f2”],[“932f50f4.bfa01”],[“a78d0782.d2f0f8”],[“3560a381.17070c”]]},{“id”:“f5d34f7d.bd52c”,“type”:“kodi-in”,“z”:“2a59a65.117295a”,“name”:“TS Kodi”,“controller”:“5d6b605e.1f277”,“x”:90,“y”:580,“wires”:[[“bc46bb0c.f41c38”,“4b099f8d.4b985”,“8c2c552.d1370a8”]]},{“id”:“820787c8.cf2bb8”,“type”:“link out”,“z”:“2a59a65.117295a”,“name”:"",“links”:[“395ff4f8.f09efc”],“x”:475,“y”:520,“wires”:[]},{“id”:“d26c116f.7a294”,“type”:“link out”,“z”:“2a59a65.117295a”,“name”:“TV on”,“links”:[“88116503.c233a8”,“be34b4e.9beed48”],“x”:475,“y”:600,“wires”:[]},{“id”:“2c274dda.5291f2”,“type”:“template”,“z”:“2a59a65.117295a”,“name”:“Movie started”,“field”:“payload”,“fieldType”:“msg”,“format”:“handlebars”,“syntax”:“mustache”,“template”:"{\n “cmd”: “GUI.ShowNotification”,\n “args”: {\n “title”: “Movie started [xx%]”,\n “message”: “—”\n }\n}",“output”:“str”,“x”:755,“y”:831,“wires”:[[“4a9f7b98.83b554”,“1ee73792.439c88”]]},{“id”:“932f50f4.bfa01”,“type”:“template”,“z”:“2a59a65.117295a”,“name”:“Movie paused”,“field”:“payload”,“fieldType”:“msg”,“format”:“handlebars”,“syntax”:“mustache”,“template”:"{\n “cmd”: “GUI.ShowNotification”,\n “args”: {\n “title”: “Movie paused [xx%]”,\n “message”: “—”\n }\n}",“output”:“str”,“x”:755,“y”:871,“wires”:[[“4a9f7b98.83b554”]]},{“id”:“a78d0782.d2f0f8”,“type”:“template”,“z”:“2a59a65.117295a”,“name”:“Movie stop”,“field”:“payload”,“fieldType”:“msg”,“format”:“handlebars”,“syntax”:“mustache”,“template”:"{\n “cmd”: “GUI.ShowNotification”,\n “args”: {\n “title”: “Movie stopped [xx%]”,\n “message”: “—”\n }\n}",“output”:“str”,“x”:745,“y”:911,“wires”:[[“4a9f7b98.83b554”]]},{“id”:“3560a381.17070c”,“type”:“link out”,“z”:“2a59a65.117295a”,“name”:“TS TV off”,“links”:[“395ff4f8.f09efc”],“x”:335,“y”:940,“wires”:[]},{“id”:“f46e88ca.a57b38”,“type”:“inject”,“z”:“2a59a65.117295a”,“name”:“off”,“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:"",“crontab”:"",“once”:false,“onceDelay”:0.1,“x”:270,“y”:580,“wires”:[[“820787c8.cf2bb8”]]},{“id”:“dc5d7027.69f59”,“type”:“inject”,“z”:“2a59a65.117295a”,“name”:“on”,“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:"",“crontab”:"",“once”:false,“onceDelay”:0.1,“x”:270,“y”:620,“wires”:[[“d26c116f.7a294”]]},{“id”:“4a9f7b98.83b554”,“type”:“change”,“z”:“2a59a65.117295a”,“name”:"+ Title",“rules”:[{“t”:“change”,“p”:“payload”,“pt”:“msg”,“from”:"—",“fromt”:“str”,“to”:“Kodi_TS.title”,“tot”:“global”},{“t”:“change”,“p”:“payload”,“pt”:“msg”,“from”:“xx”,“fromt”:“str”,“to”:“Kodi_TS.progress”,“tot”:“global”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:965,“y”:871,“wires”:[[“d4b36daa.426ca”]]},{“id”:“1ee73792.439c88”,“type”:“link out”,“z”:“2a59a65.117295a”,“name”:“TV on -”,“links”:[“5ddf80e1.4b98c”],“x”:1090,“y”:831,“wires”:[]},{“id”:“d4b36daa.426ca”,“type”:“link out”,“z”:“2a59a65.117295a”,“name”:“TS Kodi”,“links”:[“607f0588.d0e7bc”],“x”:1090,“y”:871,“wires”:[]},{“id”:“85f19228.2703f”,“type”:“kodi-controller”,“z”:"",“name”:“TS_Kodi_wifi”,“host”:“192.168.1.175”,“port”:“9090”},{“id”:“5d6b605e.1f277”,“type”:“kodi-controller”,“z”:"",“name”:“Kodi_ts_lan”,“host”:“192.168.1.179”,“port”:“9090”}]

I hope it helps

0 Likes

#12

Yeah, if you’re not using the websocket version a lot of my flow won’t work correctly.

The upgrade should be pretty painless. You don’t need to replace any nodes just check your poll-state and current-state nodes for it outputting what you expect it to output.

0 Likes

#13

Right, just read the migration notes on the node’s page. Potentially a stupid question, but how can I remove the old package in order to add the new one? As I have nodes in use it doesn’t allow me.

0 Likes

#14
0 Likes

#15

Perfect, thanks! I had to jump through some extra hoops as I run stuff in containers but that was spot on.

0 Likes