I consider myself knowledgeable on Node-Red and its integration with HA, but I still struggle on simplifying/combining nodes. I have several flows that only deal with motion sensors and lighting. I have one where I dim the living room lights when the LR TV turns on. I have both a Wyze motion sensor and a camera motion sensor through Blue Iris. Here is my flow:
[{"id":"92266247.3aa2b","type":"api-call-service","z":"bc5d2546.59a7a8","name":"Living Room Lamps on 25%","server":"79e1f09.1e9b71","version":1,"service_domain":"light","service":"turn_on","entityId":"light.living_room_lamp, light.entry_lamp_1, light.entry_lamp_2, light.piano_lamp_1, light.piano_lamp_2","data":"{\"brightness_pct\": \"25\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":580,"y":1140,"wires":[[]]},{"id":"4bb15d56.44cfc4","type":"api-call-service","z":"bc5d2546.59a7a8","name":"Living Room Lamps on 100%","server":"79e1f09.1e9b71","version":1,"service_domain":"light","service":"turn_on","entityId":"light.living_room_lamp, light.entry_lamp_1, light.entry_lamp_2, light.piano_lamp_1, light.piano_lamp_2","data":"{\"brightness_pct\":\"100\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":590,"y":1220,"wires":[[]]},{"id":"99361a7e.8d31a","type":"server-state-changed","z":"bc5d2546.59a7a8","name":"Motion (Living Room)","server":"79e1f09.1e9b71","version":1,"entityidfilter":"binary_sensor.living_room_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":140,"y":1180,"wires":[["70bd03cc.bb15ac"],[]]},{"id":"70bd03cc.bb15ac","type":"api-current-state","z":"bc5d2546.59a7a8","name":"TV On?","server":"79e1f09.1e9b71","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"media_player.vizio_smartcast","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":340,"y":1180,"wires":[["92266247.3aa2b"],["4bb15d56.44cfc4"]]},{"id":"4a2cd129.b67358","type":"inject","z":"bc5d2546.59a7a8","name":"","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":true,"onceDelay":0.1,"x":190,"y":1120,"wires":[["70bd03cc.bb15ac"]]},{"id":"5b88d66b.b88578","type":"server-state-changed","z":"bc5d2546.59a7a8","name":"Motion (Living Room Camera)","server":"79e1f09.1e9b71","version":1,"entityidfilter":"binary_sensor.livingroom_camera_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":160,"y":1240,"wires":[["70bd03cc.bb15ac"],[]]},{"id":"79e1f09.1e9b71","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
How can I use both motion sensors while still checking on the status of the TV? There has to be a simpler way.