Smart home status application for mobile phone

#1

Hello all Node-Red users!

This topic is created for the discussion of one thing that I miss in Node-Red. On the other hand, such a thing would be useful for any home automation system

My home has ~20 sensors and very often some of them go offline, batteries become low or value of sensors exceeds a threshold value.
All these events are important for me so I use a chain of node-red nodes (like node-red-contrib-timeout, node-red-contrib-edge-trigger), android applications (tasker, Remote Bot, AutoNotification) and telegram transport to show persistent notifications on my Android phone. But this chain is too complicated and doesn't work stable.

I also use regular notifications like PushBullet but they can be easily removed and I forgot that something is wrong in seconds :slight_smile:

My idea is to create a consistent chain of Node-Red nodes, service, and mobile phone application that allows to:

  • show a persistent notification on a phone when some device worth an attention
  • remove it when it becomes OK
  • notifications have action buttons that could be handled by Node-Red flows (some kind of callbacks)

Also, I'm thinking about the next Node-Red nodes:

  • battery node - sends a notification when the battery level is less than 10% and removes it when a device is charged again
  • offline node - notification when no message is received from a device during some time. This node could also have optional actions that could be triggered by the phone to make node working again (e.g. send reboot command). Notification is removed when any new message is received
  • threshold node - notification when a value from a sensor exceeds the threshold. Notification is removed when a normal value is received
  • some kind of raw node that could be configured using the parameters of the incoming message

Maybe there is already something similar or could be used this way?
If no - I'll try to create a sketch of such service and node-red nodes when I have free time

Please share your thoughts and ways how you handle such events in your systems.

#2

I make sure that all of mine are reporting consistently via MQTT so that I can separate out the monitoring from the reporting. Always a good first step.

Once you have that data flowing into MQTT using a consistent set of topic names, you have more choice about how you consume that data. For example, there are various Android tools and at least one for iOS that can consume MQTT directly.

If you are using Telegram, you don't need PushBullet as they pretty much do the same thing but Telegram does it better and has more features.

In my own setup, I have a simple flow that listens to specific MQTT topics and creates a formatted Telegram message so that is really easy to use from anywhere with Node-RED or indeed from anywhere that can output to MQTT.

Another thing that I do is to send updates through to InfluxDB as well. That makes it easy to use Grafana to create status and history dashboards. You can use links in dashboards to steer Node-RED flows (via the http-in node for example or uibuilder).

Not too sure about the first 2, especially on Android as I don't use Android much. I've always been happy with Telegram on iOS where you can see the updates from the home screen and can individually or in bulk clear them. You still see them in the Telegram app of course.

For anything else, I'd personally just use a UI in an app or web page.

Either way, both Telegram and web pages or apps can be 2-way with Node-RED of course. Though as always, you need to take care of security if you are exposing Node-RED to the internet - another reason I like using Telegram since that is mainly taken care of for you. With Telegram, you can also have custom button responses which are nice.

I suppose you could create this but there are so many different ways of getting battery data from different devices I would question whether it would be worth it. As mentioned, I feed battery and other environmental device data into a set of standard MQTT topics so that access to the latest figures is very simple. Similarly, sending to an InfluxDB database in a standardised format gives me access to current and historic data via standard queries.

Again, there are too many different devices, connections and data schema's. If a device (e.g. ESP8266) can talk direct to MQTT, you can do this with a simple MQTT LWT configuration & a heartbeat message from the device. Otherwise, I simulate that via Node-RED flows so that everything is standardised.

Same problem - too many data schema's and types. Easier to create flows that standardise the data. With thresholds taken from a configuration file/db/persistent variable.


In short, by keeping inputs and outputs in separate flows and by using MQTT (and InfluxDB) to hold standardised data/topics, you can massively simplify your flows.

Custom nodes are probably not that useful unless you use a lot of identical source devices.