There's two different kinds of integrations worth doing. The first is
setting up MQTT Binary Sensors to get motion history. I use this to show a history chart on my Lovelace page:
View attachment 64579
The second is getting detailed info for use in the sequence in NodeRed. For that just directly register for the MQTT events using the MQTT in node. I register for "aimotion/triggers/+" as the topic and have the output set to "a parsed JSON object". The default messages sent contain
all the info you need (scroll down a bit to see the sample standard message content).
In my case I use HA + NodeRed to send a notification to my phone for any front door motion. The notification is done using the native Home Assistant notifications to my mobile app.
formattedPredictions has a nicely formatted version of the predictions ready to send in a message caption/title/body/whatever.
For the image what I do is actually have Home Assistant request a dedicated snapshot from the camera. This gets the image stored locally on my HA web server so I can access it remotely. Alternatively you can reference it directly from the trigger Docker image with some additional configuration, but frankly I found that more hassle than it was worth... and I even wrote the feature specifically because I wanted it!
Picture of the flow. You'll note that I also have HA managing the triggering of the recording by
BlueIris, and turning landscape lights on when garage or front door motion is detected:
View attachment 64580
Here's the function node code, which extracts the camera name and only allows the sequence to proceed if the state is
on:
JavaScript:
msg.cameraName = `${msg.topic.split("/").pop()}`
if (msg.payload.state === "off") {
node.status({
fill: "red",
shape: "dot",
text: msg.cameraName
});
return null;
}
node.status({
fill: "green",
shape: "dot",
text: msg.cameraName
});
return msg;
Edit: I just realized the splitting of the camera name is unnecessary since I now send
name (the name of the trigger) as a part of the default MQTT message. So the only thing this function really does is check the state is on/off, and that can be a simple switch node instead.