OK, great!
It looks like Motioneye doesn’t send a second (timeout) message after no motion is detected for a while, so you could add a Trigger node in NR to handle that function:
[{"id":"230812e0.66a52e","type":"change","z":"43d5ef6e.4b6a9","name":"Syntax: view_path","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"data\":{\"view_path\":\"\"}}","tot":"json"},{"t":"move","p":"payload","pt":"msg","to":"payload.data.view_path","tot":"msg"},{"t":"change","p":"payload.data.view_path","pt":"msg","from":"on","fromt":"str","to":"courtyard_camera","tot":"str"},{"t":"change","p":"payload.data.view_path","pt":"msg","from":"off","fromt":"str","to":"dashboard","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":80,"wires":[["d0c7c4bd.11b7b8"]],"info":" - Change `msg.data.new_state.entity_id` from `input_select.${camera_short_name}_cast` to `${camera_short_name}_feed`\n - Move `msg.data.new_state.entity_id` to `payload.data.view_path`"},{"id":"d0c7c4bd.11b7b8","type":"api-call-service","z":"43d5ef6e.4b6a9","name":"Living Area Hub","server":"e9beaddb.fc24e","version":1,"debugenabled":false,"service_domain":"cast","service":"show_lovelace_view","entityId":"media_player.living_area_hub","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":880,"y":80,"wires":[[]]},{"id":"89da533.a8ebab","type":"trigger","z":"43d5ef6e.4b6a9","name":"","op1":"","op2":"{\"test\":\"2\"}","op1type":"pay","op2type":"json","duration":"30","extend":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":410,"y":80,"wires":[["f9ac8bcc.6d82e8","230812e0.66a52e"]]},{"id":"f9ac8bcc.6d82e8","type":"mapper","z":"43d5ef6e.4b6a9","name":"Toggle","property":"payload","map":[{"search":"on","replace":"{\"service\":\"turn_on\"}"},{"search":"off","replace":"{\"service\":\"turn_off\"}"}],"passthrough":false,"x":670,"y":140,"wires":[["f2b9be8b.676c2"]]},{"id":"7bfcf0d5.b9e02","type":"http in","z":"43d5ef6e.4b6a9","name":"","url":"/courtyard_camera","method":"post","upload":false,"swaggerDoc":"","x":170,"y":80,"wires":[["efff12ab.54db4","89da533.a8ebab"]]},{"id":"f2b9be8b.676c2","type":"api-call-service","z":"43d5ef6e.4b6a9","name":"Courtyard Motion","server":"e9beaddb.fc24e","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":870,"y":140,"wires":[[]]},{"id":"efff12ab.54db4","type":"http response","z":"43d5ef6e.4b6a9","name":"","statusCode":"","headers":{},"x":230,"y":140,"wires":[]},{"id":"e9beaddb.fc24e","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Here’s how this one is configured:
- Your initial message (
test:1
) would be passed through when motion is detected. - It would then wait 30 seconds after the last message was received (if motion is triggered again within the initial 30 seconds it will restart the 30 second timer).
- After 30 seconds with no motion trigger it would send a second JSON formatted message (
test:2
) which you can use to reset yourview_path
andinput_boolean
.
Of course you can rename these key/value pairs (test/1, test/2) to whatever you like and update the Change and Mapper nodes accordingly.