Complex Notification system

Hi everybody !
I’d like to build a notification system in my OH2 with certain level of complexity…
This is what I mean: after a lot of experiments I have a lot of rules sending messages (notifications) to me and my family through different devices:

  1. two Alexa devices and one Google Home speaking when , i.e., presence sensor is triggered or when it rains (“It’s time to close the windows”…)

  2. four Yeelight RGB bulbs sending different visual signals based on different events

  3. two Telegram bots (with different message level depth)

In each rule i have to code al lot of IF-THEN statements to determine which notification has to be sent and which not, based on different checks (like hour of the day and other things).

What is, in your opinion, the best way to create a more efficient and easy to maintain solution?
Thans for any suggestion,
Alex

First, I wouldn’t call this a “development” question (“Development” is about Java development of OH itself, not about rules development inside OH). So please move it to a section this better fits into.
Second, when-and-how-to-signal-what is a question that anybody has to individually solve for himself as it’s just a matter of preference. A binding with limited preset possibilities or similar would not make much sense here (and it would still require you to define your if-then cascades
Third, it depends on the language you use (rules DSL, jython, …).
Fourth, it depends on the media types and things/items you can use to notify…
… and so on. In short, it’s all up to you.

Thats not an easy question. I am thinking about a system with presets for people and types of information level.

So prefer to get my information with pushOver, my wife prefers e-mails and my daugther prefer speech over sonos, so the sould be something like a configuratione panel.

Next level is the informatione type. This could be a simple Info, or a warning or an alert or a broadcast message. It should be configurable which person get which kind of message. For example it is use less to send a warning about empty batteries to my daugthers.

On the other hand it should be possible to overide the defaults.

That are my toughts at the moment.

1 Like

I dont think that it is no development question. The first impression is that should be done by rules, but at a second glance why should a sophisticated notification system not part on openhab.

It is just a point of view.

1 Like

So all of this can be done with existing scripting functionality. What you would want is a level of abstraction on top of the execution mechanism. You don’t want to over-prescribe how the notification shall be done in the individual script. One way to do this is to classify the notification level. Then in the execution, you can decide which devices/service to use depending on the criticality of the notification.

Here is something I use in my system (written in Python):

  • Alert: this is the alert information.
  • AlertManager: this is the execution. It uses two mechanism right now: audio alert (volume depends on the current house activity) and email alert.

The individual script’s job is then to create an alert and then use AlertManager to process it. The script doesn’t care how the alert is done.

I hope this helps.

3 Likes

Design Pattern: Separation of Behaviors.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.