(Nodered) Setting brightness from flow variable

Hey guys,

I have a variable called flow.study_brightness that I want to use to set the light brightness.

I tried:
{“entity_id”:“light.study”, “brightness”: flow.study_brightness }
to no avail.

Anybody know the right way to do this?

Thanks!

1 Like

Hi,

Yeah I found this in the forum you can try. I’m real new to NR and just started so brace yourself. Replace your format (f?) node with this. In my case; I set my brightness (in pct; brightness_pct) from a custom input_boolean I have made.

var newMsg =  {  
   payload:{  
      "data":{  
         "brightness_pct":msg.payload,
         "transition":"3"
      }
   }
}
return newMsg;

From what I gather (since I cannot find any docs on this) is that the newMsg variable is the lightOptions that show up below the entity id in call service block. All you have to do is enter the entity ID and the varMsg should auto fill the rest.

Not sure if this is what you’re looking for, but if you don’t mind using the node-red ui to control it, you could do something like this

snip_20180608192944

the slider (Light Dimmer) is set-up this way.snip_20180608193509

and the function node (brightness) is set-up this waysnip_20180608193706

The ui will allow you to adjust the brightness. Hope this helps.

1 Like

Try using {{flow.study_brightness}}.

If that doesn’t work, here is a pastebin link to a flow I created that stores states of lights, calls a scene, and then restores the state that it was previously in when I turn the scene off. There are a lot of places where I use flow variables in template nodes to control outputs to hass call service nodes: https://pastebin.com/UVMZy7WU

4 Likes

Thanks guys. Was able to solve it although garretbeachy’s solution looks more elegant. Might change it later.

The only thing that’s missing right now is the initial state when my NUC starts up and there’s no values in the luminance sensor (trigger for setting brightness).

Hello @garrettbeachy and @jilsx,

I discovered node-red yesterday and have been playing around with it today (all day). I must say I’m a bit disappointed with its complexity because I did not manage to implement the scenario I was after.

@garrettbeachy, I’m very envyous. I get the big picture of what your code does and it sounds very appealling. I hope I will get there sometime :slight_smile:

May I ask you to review my code and help me polish it so that it does what I want? My idea is: create a dusk till dawn light that will automatically dim to a certain % at some point during the night and remains dimmed until it is automatically switched off.

Implementing the dusk till down part was pretty easy thanks to the big timer. What a powerful component! However, I have not got around to implementing the dimming part. I’ve reviewd Garret’s code hoping to decypher how to go about this, but haven’t figured it out.

The part I’m currently stuck at is by far storing and formating what the slider generates. In principle, what I’ve put together does capture the value, although the intermediate steps seem to introduce noice. Additionally, I can’t seem to be able to monitor the changes because once the slider has reached the first stable value, whatever I do simply does not get upadated (the brightness doesn’t change anymore).

https://pastebin.com/riqNZ9CM

Hope you can help me understand this.

Thanks a million in advance,

Sorry to but in on a) some elses thread and b) and old thread.

But can you show the settings u have in the service call as well (labelled as on in ur pic)
I’m pulling my hair out trying to build a flow to dim up or down my lights using nodered as they don’t support transition.

Sure, here you go. I’ve also included the complete flow below the screenshot so you can see how its all fits together.

[{"id":"3028c889.3efbd8","type":"switch","z":"e6ab8208.bfbbe","name":"The Switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":320,"wires":[["3a9de05e.285a7"],["d653e739.c84db8","482fc6a7.4c9858"]]},{"id":"f6b876c8.b46578","type":"function","z":"e6ab8208.bfbbe","name":"brightness","func":"var newMsg = {\n payload: {\"data\":{\"brightness\":msg.payload}}\n };\nreturn newMsg;","outputs":1,"noerr":0,"x":490,"y":260,"wires":[["3a9de05e.285a7"]]},{"id":"3a9de05e.285a7","type":"api-call-service","z":"e6ab8208.bfbbe","name":"On","server":"f0aa0465.fa7ce8","service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"light.master_bedroom_level\"}","mergecontext":"","x":690,"y":260,"wires":[["482fc6a7.4c9858"]]},{"id":"1a670af1.a1e345","type":"ui_switch","z":"e6ab8208.bfbbe","name":"","label":"Recamara","group":"4bb4b124.c9376","order":9,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"{light.master_bedroom_level}","style":"","onvalue":"on","onvalueType":"str","onicon":"highlight","oncolor":"red","offvalue":"off","offvalueType":"str","officon":"highlight","offcolor":"white","x":310,"y":320,"wires":[["3028c889.3efbd8"]]},{"id":"d0f3a307.99de5","type":"ui_slider","z":"e6ab8208.bfbbe","name":"Brightness recramara","label":"I: {{value}}","tooltip":"","group":"4bb4b124.c9376","order":10,"width":"2","height":"1","passthru":true,"outs":"end","topic":"","min":"3","max":"255","step":1,"x":300,"y":260,"wires":[["f6b876c8.b46578"]]},{"id":"908c6b1c.314a98","type":"server-state-changed","z":"e6ab8208.bfbbe","name":"Master Bedroom","server":"f0aa0465.fa7ce8","entityidfilter":"light.master_bedroom_level","entityidfiltertype":"exact","outputinitially":false,"haltifstate":"","outputs":1,"x":80,"y":320,"wires":[["1a670af1.a1e345","77098d3a.e14464"]]},{"id":"b2da8313.f985e","type":"ui_slider","z":"e6ab8208.bfbbe","name":"timer recramara","label":"M: {{value}}","group":"4bb4b124.c9376","order":11,"width":"2","height":"1","passthru":true,"outs":"end","topic":"","min":"15","max":"60","step":"5","x":320,"y":200,"wires":[["3a9de05e.285a7","5e447305.1f15ec"]]},{"id":"482fc6a7.4c9858","type":"mytimeout","z":"e6ab8208.bfbbe","name":"Timer","outtopic":"","outsafe":"on","outwarning":"Warning","outunsafe":"off","warning":"5","timer":"900","debug":"","repeat":false,"again":false,"x":890,"y":200,"wires":[["a059c68e.644b28"],[]]},{"id":"4aa8dbdf.d5e544","type":"change","z":"e6ab8208.bfbbe","name":"set timer count","rules":[{"t":"set","p":"timeout","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":200,"wires":[["482fc6a7.4c9858"]]},{"id":"a059c68e.644b28","type":"switch","z":"e6ab8208.bfbbe","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1070,"y":200,"wires":[["d653e739.c84db8"]]},{"id":"d653e739.c84db8","type":"change","z":"e6ab8208.bfbbe","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"data\":{\"entity_id\":\"light.master_bedroom_level\"}}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1220,"y":200,"wires":[["4defc185.4ed33"]]},{"id":"4defc185.4ed33","type":"api-call-service","z":"e6ab8208.bfbbe","name":"Off","server":"f0aa0465.fa7ce8","service_domain":"light","service":"turn_off","data":"","mergecontext":"","x":1370,"y":200,"wires":[[]]},{"id":"5e447305.1f15ec","type":"function","z":"e6ab8208.bfbbe","name":"Convert to minutes","func":"msg.payload = msg.payload * 60\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":200,"wires":[["4aa8dbdf.d5e544"]]},{"id":"77098d3a.e14464","type":"nora-switch","z":"e6ab8208.bfbbe","devicename":"Main Light","roomhint":"Master Bedroom","name":"My bedroom","passthru":true,"nora":"9028317a.9e18a","topic":"","onvalue":"on","onvalueType":"str","offvalue":"off","offvalueType":"str","x":90,"y":260,"wires":[["1a670af1.a1e345"]]},{"id":"f0aa0465.fa7ce8","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true},{"id":"4bb4b124.c9376","type":"ui_group","z":"","name":"Lights","tab":"c5e67c2b.eb40e","order":2,"disp":false,"width":"6","collapse":false},{"id":"9028317a.9e18a","type":"nora-config","z":"","name":"nora config"},{"id":"c5e67c2b.eb40e","type":"ui_tab","z":"","name":"Dashboard","icon":"dashboard","order":2}]

Awesome ! Tho from the looks of those boxes ur using a different home assistant crontrib thing than me (the websockets one?)

Correct, but I’m not using any of the new functionality so you should be able to replace them with yours.

Hi all, I’m hoping someone can help me. I’m trying to do a very basic test to change the brightness of a bulb from the current brightness. I get to the point where I can return a message with the new brightness (e.g. 255-50 = 205) but I can’t for the life of me get the bulb to receive this instruction. What am I missing?

On a side note, I’ve spent an entire week of spare time googling this issue before posting. I’m not the most techie person but in my upper limit, I have built python scripts for web crawling and file manipulation and I use VBA routinely for spreadsheet work. The fact that this single action has taken me over a week of google and trial and error is just insane. I’ve found yaml super easy to get started but you hit a brick wall when you try to do more complex stuff e.g. iterations. Nodered is not that easy to start and it’s just hard in a different way like they literally replaced the mind boggling code with just as mind boggling visualisations.

Now I’m at a point where I am considering whether to abandon node-red in favour of another alternative like appdaemon. Does anyone have any thoughts or recommendations before I shelf this?

There’s a bit of a learning curve, but personally, I think node red is worth the effort. It’s very flexible and it’s ability to connect to things that HA can’t is useful at time too.

I have a flow which dims my lights prior to turning them off, if there’s movement it sets them back to the original brightness. I store the original brightness in the message.

Here’s where I set it back again

the entry in Data is

 {
     "brightness": "{{light_orig_state.attributes.brightness}}",
     "transition": 1
 }

where light_orig_state.attributes.brightness is the variable

3 Likes

Looks like you pretty much have it.
I too use a function and the light API call

image

[{"id":"156ad641.9e35ea","type":"function","z":"3da2c349.0ebdcc","name":"Set brightness in payload","func":"msg.payload = {\n domain: 'light',\n service: 'turn_on',\n data: { entity_id: 'light.hallway', brightness: msg.data.event.new_state.attributes.brightness }\n};\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":1120,"wires":[["c67ff8f1.7e3798"]]},{"id":"c67ff8f1.7e3798","type":"api-call-service","z":"3da2c349.0ebdcc","name":"Set Hallway Brightness","server":"b8197728.8ac978","version":1,"service_domain":"light","service":"turn_on","entityId":"light.hallway","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1070,"y":1120,"wires":[[]]},{"id":"b8197728.8ac978","type":"server","z":"","name":"Home Assistant instance","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

hope it helps/

IMO this is a pretty nasty way of doing it, but I could not find anything more elegant w/o the function block.

2 Likes

Looks like @eggman just solved that, too.

Thanks for helping me get it, it took me ages but I finally got there.

The next question I had was how to set the brightness for a group of lights. There doesn’t seem to be a brightness attribute for groups.

Are you using groups or light groups?

Mind blown, wasn’t aware of this. I was using groups from the GUI

Historically I have:

  1. Used Hue (zigbee) groups for lights in a physical group (e.g. 2 bulbs in same lumiere) and AFAIK it is better for performance. These appear in HA as another light and can use light API e.g. light.turn_on
  2. Used normal groups for “logical” grouping of lights - e.g. all the lights I want to turn on at dusk. I then use the homeassistant API for these e.g. homeassistant.turn_on

You have the JSON flow we could look at?

It’s pat of a much larger flow that :

  • dims the light after a period of inactivity
  • if there’s movement in the next few minutes it brightens the light again
  • if not it pauses / mutes whatever’s on
  • waits a bit longer and sets everything back if there’s movement
  • shuts everything off, if there’s still no movement

You’ll have to dig out the useful bits.

[{"id":"a852e5f8.454c88","type":"subflow","name":"lounge media command","info":"payload must be one of: play, pause, stop\nthe command will be sent to whichever device is on","category":"","in":[{"x":171.81749725341797,"y":193.74007034301758,"wires":[{"id":"95106d65.46eb4"}]}],"out":[{"x":1462.1903686523438,"y":260.7837429046631,"wires":[{"id":"f2b99657.c0a568","port":0}]}]},{"id":"af06f394.54983","type":"api-current-state","z":"a852e5f8.454c88","name":"get chromecast state","server":"cc436e5e.bbf7e","version":1,"outputs":2,"halt_if":"playing,paused","halt_if_type":"str","halt_if_compare":"does_not_include","override_topic":false,"entity_id":"media_player.lounge_chromecast","state_type":"str","state_location":"cc_state","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":460,"y":100,"wires":[["c00dcb11.369b78"],["a7231fe4.d6035"]]},{"id":"e7704823.898e48","type":"api-call-service","z":"a852e5f8.454c88","name":"Media player command","server":"cc436e5e.bbf7e","service_domain":"media_player","service":"","data":"","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1030,"y":200,"wires":[["f2b99657.c0a568"]]},{"id":"c00dcb11.369b78","type":"api-call-service","z":"a852e5f8.454c88","name":"Harmony remote command","server":"cc436e5e.bbf7e","service_domain":"remote","service":"send_command","data":"{\"entity_id\":\"remote.lounge\",\"device\":\"64042126\",\"command\":\"{{payload}}\"}","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":860,"y":60,"wires":[["f2b99657.c0a568"]]},{"id":"95106d65.46eb4","type":"api-current-state","z":"a852e5f8.454c88","name":"get TV state","server":"cc436e5e.bbf7e","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.lounge_tv","state_type":"str","state_location":"tv_state","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":310,"y":180,"wires":[["af06f394.54983"],["7e434a99.61ff04"]],"icon":"node-red/switch.png"},{"id":"a7231fe4.d6035","type":"change","z":"a852e5f8.454c88","name":"media_player is lounge chromecast","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t   \"service\": \"media_\" & payload,\t   \"data\":{\t       \"entity_id\":\"media_player.lounge_chromecast\"\t   }\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":160,"wires":[["e7704823.898e48"]]},{"id":"7e434a99.61ff04","type":"change","z":"a852e5f8.454c88","name":"media_player is lounge hub","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t   \"service\": \"media_\" & payload,\t   \"data\":{\t       \"entity_id\":\"media_player.lounge_hub\"\t   }\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":240,"wires":[["e7704823.898e48"]]},{"id":"f2b99657.c0a568","type":"change","z":"a852e5f8.454c88","name":"Clear payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1280,"y":120,"wires":[[]]},{"id":"bfb3ba20.e651d8","type":"tab","label":"Lounge Presence","disabled":false,"info":"# Turn off lounge lights & TV \n\nIf there's no movement for 20 minutes, dim lights and pause TV\n\nIf there's still no movement for 5 minutes turn them off \n\nOtherwise restore them to original state"},{"id":"2e928545.a1ad0a","type":"ha-wait-until","z":"bfb3ba20.e651d8","name":"warning timer","server":"cc436e5e.bbf7e","outputs":2,"entityId":"binary_sensor.loungemotion","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"20","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":393.3115234375,"y":299.1984233856201,"wires":[[],["e939bbc3.9dd108"]],"outputLabels":["motion detected - cancel","no motion - warning"]},{"id":"86931eb5.ea345","type":"subflow:a852e5f8.454c88","z":"bfb3ba20.e651d8","name":"","x":1501.3093070983887,"y":243.6468276977539,"wires":[["5a71139f.a7032c"]]},{"id":"8e69244d.436e08","type":"change","z":"bfb3ba20.e651d8","name":"pause","rules":[{"t":"set","p":"payload","pt":"msg","to":"pause","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1282.5909881591797,"y":243.76979064941406,"wires":[["86931eb5.ea345"]]},{"id":"e939bbc3.9dd108","type":"api-current-state","z":"bfb3ba20.e651d8","name":"get light state","server":"cc436e5e.bbf7e","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.ceiling","state_type":"str","state_location":"","override_payload":"none","entity_location":"light_orig_state","override_data":"msg","blockInputOverrides":false,"x":587.898811340332,"y":306.09127616882324,"wires":[["50b2ce.ffeced3"],["e7519e1c.8a75a"]],"outputLabels":["light on","light off"]},{"id":"50b2ce.ffeced3","type":"api-call-service","z":"bfb3ba20.e651d8","name":"dim light","server":"cc436e5e.bbf7e","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.ceiling","data":"{\"brightness_pct\":5}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":712.081428527832,"y":242.08929443359375,"wires":[["64ef49d5.fe4878"]]},{"id":"e7519e1c.8a75a","type":"api-current-state","z":"bfb3ba20.e651d8","name":"get PS state","server":"cc436e5e.bbf7e","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.ps3","state_type":"str","state_location":"ps4_orig_state","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":1062.085292816162,"y":311.0297546386719,"wires":[["690f0b1c.b399d4"],["d22609e2.6b5048"]]},{"id":"690f0b1c.b399d4","type":"api-call-service","z":"bfb3ba20.e651d8","name":"mute volume","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.lounge","data":"{\"device\":29590173,\"command\":\"mute\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1316.7875442504883,"y":169.02774238586426,"wires":[["5a71139f.a7032c"]]},{"id":"64ef49d5.fe4878","type":"ha-wait-until","z":"bfb3ba20.e651d8","name":"delay 30s","server":"cc436e5e.bbf7e","outputs":2,"entityId":"binary_sensor.loungemotion","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"30","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":867,"y":219,"wires":[["47d7ea95.278574"],["e7519e1c.8a75a"]],"outputLabels":["motion detected - cancel","no motion - warning"]},{"id":"47d7ea95.278574","type":"api-call-service","z":"bfb3ba20.e651d8","name":"reset light","server":"cc436e5e.bbf7e","version":1,"debugenabled":true,"service_domain":"light","service":"turn_on","entityId":"light.ceiling","data":"{\"brightness\":\"{{light_orig_state.attributes.brightness}}\",\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1047.1051597595215,"y":170.02776908874512,"wires":[[]]},{"id":"d22609e2.6b5048","type":"api-current-state","z":"bfb3ba20.e651d8","name":"get tv/soundbar state","server":"cc436e5e.bbf7e","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"group.harmony_lounge","state_type":"str","state_location":"ghl_orig_state","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":1312.517780303955,"y":317.027756690979,"wires":[["8e69244d.436e08"],["5a71139f.a7032c"]]},{"id":"5a71139f.a7032c","type":"link out","z":"bfb3ba20.e651d8","name":"","links":["e1135631.347958"],"x":1762.2381763458252,"y":242.74405097961426,"wires":[]},{"id":"e1135631.347958","type":"link in","z":"bfb3ba20.e651d8","name":"","links":["5a71139f.a7032c"],"x":146.30556106567383,"y":578.2995986938477,"wires":[["4b270e71.486ae"]]},{"id":"4b270e71.486ae","type":"ha-wait-until","z":"bfb3ba20.e651d8","name":"off timer","server":"cc436e5e.bbf7e","outputs":2,"entityId":"binary_sensor.loungemotion","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"2","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"x":304.74007415771484,"y":578.3769569396973,"wires":[["bb094442.86ffb8","40b365e6.f5d88c","264abf4.bb8a84"],["2d4d38e.eae6fc8","3d31e9c0.8aed16","d1a65a6.2d45aa8"]],"outputLabels":["motion detected - cancel","no motion - warning"]},{"id":"92893071.e7f14","type":"comment","z":"bfb3ba20.e651d8","name":"Warning flow","info":"Dim lights (if they're on)\nStill no motion for 30s then mute playstation or pause TV (if they're on)","x":130,"y":240,"wires":[]},{"id":"8a13da3.163d628","type":"comment","z":"bfb3ba20.e651d8","name":"Off or reset flow","info":"Now in warning mode if no motion things should be turned off\nif there is motion things should be returned to their original states","x":140,"y":500,"wires":[]},{"id":"bb094442.86ffb8","type":"switch","z":"bfb3ba20.e651d8","name":"reset light?","property":"light_orig_state.state","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":577,"y":399,"wires":[["ad1917df.f0d828"]]},{"id":"40b365e6.f5d88c","type":"switch","z":"bfb3ba20.e651d8","name":"reset PS4?","property":"ps4_orig_state","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":577,"y":459,"wires":[["a1e4e81d.902258"]]},{"id":"264abf4.bb8a84","type":"switch","z":"bfb3ba20.e651d8","name":"reset TV/SB?","property":"ghl_orig_state","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":577,"y":519,"wires":[["4097fa99.936e14"]]},{"id":"ad1917df.f0d828","type":"api-call-service","z":"bfb3ba20.e651d8","name":"reset light","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.ceiling","data":"{\"brightness\":\"{{light_orig_state.attributes.brightness}}\",\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":927,"y":399,"wires":[[]]},{"id":"a1e4e81d.902258","type":"api-call-service","z":"bfb3ba20.e651d8","name":"unmute volume","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.lounge","data":"{\"device\":29590173,\"command\":\"mute\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":947,"y":459,"wires":[[]]},{"id":"4097fa99.936e14","type":"change","z":"bfb3ba20.e651d8","name":"play","rules":[{"t":"set","p":"payload","pt":"msg","to":"play","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":757,"y":519,"wires":[["84b596cc.093428"]]},{"id":"84b596cc.093428","type":"subflow:a852e5f8.454c88","z":"bfb3ba20.e651d8","name":"","x":977,"y":519,"wires":[[]]},{"id":"2d4d38e.eae6fc8","type":"switch","z":"bfb3ba20.e651d8","name":"turn off light?","property":"light_orig_state.state","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":580.6289978027344,"y":642.0118827819824,"wires":[["cbefe89b.51ede8"]]},{"id":"cbefe89b.51ede8","type":"api-call-service","z":"bfb3ba20.e651d8","name":"reset light","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.ceiling","data":"{\"brightness\":\"{{light_orig_state.attributes.brightness}}\",\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":778.40673828125,"y":642.0119018554688,"wires":[["293a7fc0.d9067"]]},{"id":"293a7fc0.d9067","type":"api-call-service","z":"bfb3ba20.e651d8","name":"turn off light","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.ceiling","data":"{\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":974.40673828125,"y":642.0119018554688,"wires":[[]]},{"id":"3d31e9c0.8aed16","type":"api-current-state","z":"bfb3ba20.e651d8","name":"turn off other device?","server":"cc436e5e.bbf7e","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"group.harmony_lounge","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":609.0397071838379,"y":704.2975969314575,"wires":[["e2b6d3ed.97e86"],[]]},{"id":"e2b6d3ed.97e86","type":"api-call-service","z":"bfb3ba20.e651d8","name":"turn off","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"remote","service":"turn_off","entityId":"remote.lounge","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":957.8015079498291,"y":698.3630800247192,"wires":[[]]},{"id":"d1a65a6.2d45aa8","type":"api-call-service","z":"bfb3ba20.e651d8","name":"Fairy lights","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.fairy_lights","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":580.3016052246094,"y":775.5159072875977,"wires":[[]]},{"id":"1dc795e5.b8e15a","type":"server-state-changed","z":"bfb3ba20.e651d8","name":"lights on","server":"cc436e5e.bbf7e","version":1,"entityidfilter":"light.ceiling","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":187.30159378051758,"y":170.4523868560791,"wires":[["2e928545.a1ad0a"],[]]},{"id":"6c18e4fa.1e20bc","type":"server-state-changed","z":"bfb3ba20.e651d8","name":"harmony device on","server":"cc436e5e.bbf7e","version":1,"entityidfilter":"group.harmony_lounge","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":196.30953979492188,"y":120.44644165039062,"wires":[["2e928545.a1ad0a"],[]]},{"id":"a15ee7a1.61fda8","type":"trigger-state","z":"bfb3ba20.e651d8","name":"Motion?","server":"cc436e5e.bbf7e","entityid":"binary_sensor.loungemotion","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"c13emwjvaen","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":177.3095245361328,"y":305.2182550430298,"wires":[["2e928545.a1ad0a"],[]]},{"id":"e4e5ec7c.2e7df","type":"comment","z":"bfb3ba20.e651d8","name":"Turn off lights and TV if no motion","info":"","x":151,"y":40,"wires":[]},{"id":"cc436e5e.bbf7e","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
1 Like