Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal 3: don't only store problems #27

Open
macinspak opened this issue Aug 8, 2021 · 6 comments
Open

Proposal 3: don't only store problems #27

macinspak opened this issue Aug 8, 2021 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@macinspak
Copy link
Contributor

Originally from #24, submitted by @bartbutenaers

I have not analyzed the internal kitchen of these nodes yet into detail, so perhaps this is already possible somehow.

When I want to switch my alarm from Off to Away, I want to show a list of the current problems. In the following demo my Node-RED flow sees that there is still one door open, which it shows to me:

demo_popup

Then I can decide whether I cancel the state-change and close the door first. Or I can continue switching the state.

To keep my flow simple, it would be nice if the alarm-nodes could store this information, and make it queryable. Indeed the sensor node gets all values from all sensors, and it knows (based on the last sensor value and the Trigger dropdown options) which sensors currently have detected an issue.

@macinspak
Copy link
Contributor Author

Yes, I had also been thinking about the best way to implement this.

I guess again I had been postponing it myself as I tend to arm the house after leaving and not had this issue. But it is a standard sort of function. Perhaps having real-time nodes always outputting "open or close" state will allow people to build their own led dashboard equivalent, and maybe some logic or additional parameters that will auto-fail setting a mode and returning a separate error output connection if the alarm would immediately fire? Then standard behaviour remains, but you can set an "exit delay" for any mode via that node configuration or passing in a parameter as part of the msg. Then you could fail to switch the mode and push a push notification or "pip" an alarm or something? Or play a sound on your alexa or homepod?

What do people think?

@macinspak macinspak added enhancement New feature or request help wanted Extra attention is needed labels Aug 8, 2021
@bartbutenaers
Copy link
Contributor

I had been postponing it myself as I tend to arm the house after leaving and not had this issue

Indeed when you activate remotely your alarm (via e.g. a smart phone), this is not really useful. Because when you already left your house, you cannot do this:

  1. Press the "Cancel" button
  2. Close the front door (which was still open as mentioned in the popup)
  3. Activate the Away mode again (and now no popup anymore since all doors are closed.

Although it is still a bit useful, because you can blame your wife and kids in the car that they again forgot to close some doors ;-)

Currently I do it like this in my node:

  1. When a sensor value arrives, I calculate whether it is a trigger value or not (similar like you do it in your Sensor node).
  2. Then I store per sensor (e.g. per topic) the boolean result of that calculation. So I remember whether the last value was a trigger value or not.
  3. When I want to activate my alarm, I ask my node a list of all sensors (e.g. topics) whose last value was a trigger value.
  4. I show those sensors in a popup.

In my case this is all inside a single node, but I like your approach of multiple nodes a LOT more! Because I have a lot of wiring towards the same node, which again leads to a spaghetti flow.
To avoid ruining your nice concept, could it perhaps be useful to add a new node to your repository? E.g. a Query node, whose config screen contains a dropdown where you can select a query. In this case the "Sensors with trigger value" query. Then we could put that Query node in between the Dashboard nodes in my use case:

image

Note that the issues popup need only to be showed if there are any sensors whose last value was a trigger value! Because it has no use to show an empty popup...

Therefore it would be useful that such a node had two outputs:

  • when the query resultset contains 1 or more entries, then an output message is being send on the first output.
  • when the query resultset contains 0 entries, then an output message is being send on the first output (containing an empty array) and also on the second output.

The second output can be omitted, but then again you need to add an extra Switch node to check whether the resultset is empty. Resulting again in a less clean flow...

But there might be better ways to implement this in this node suite ...

@macinspak
Copy link
Contributor Author

macinspak commented Aug 17, 2021

Going to think about this one. I like the idea. We can use it to trigger warning "pips" or a push notification to let you know you armed the house, but the back door is still open so you had better turn around, go back and close it.

@bartbutenaers
Copy link
Contributor

Hi @macinspak,
If you should have had time to think about a proposal, it would be nice if we could discuss about it.
Thanks !!
Bart

@macinspak
Copy link
Contributor Author

macinspak commented Oct 2, 2021 via email

@bartbutenaers
Copy link
Contributor

Sorry to keep you waiting!!!

I cannot remember if they refused to arm

Hmm not sure either. But I don't think that logic needs to be part of your node. Let the people handle that in their flows. For example I like to show a popup (to display all sensors that are currently detecting an issue), but other people can just refuse arming, or activate anyway, or ...

If we could just so something like this:

  1. A message is injected into your node.
  2. The Filtrex expression analyses the sensor value, and labels it as a problem or not.
  3. The value and the corresponding problem status is stored per sensor.
  4. We can query the problem status of each sensor, to determine in our flow what should happen next

This way everybody can decide what to do with the problem sensor values. I think such a design is much more flexible, compared to when your node would decide everything on its own. I mean I step 4 you can:

  1. You can show a notification popup: "unable to arm the alarm, because some sensors have problems currently".
  2. You can show a notification popup where you can select 'ignore' to continue arming.
  3. You can arm the alarm system anyway, ignoring all current problems.
  4. You can have a list of which sensors are ignorable and which not. If a non-ignorable sensor has a value, then you can't arm the alarm system.
  5. And so on ...

Or what other cases do we need to cater for?

Suppose your alarm keypad is inside a PIR-secured zone:

  1. You want to leave the house, so you enter the room.
  2. The PIR sensor detects you and an alarm problem value will be injected.
  3. The PIR value should now be ignored, because - as soon as you leave the house- the sensor value will get back to normal again. So it is ignorable during arming.
  4. You enter your key code to activate the alarm (in e.g. 30 seconds).
  5. You leave the room.
  6. The pir sensor value will get back to normal.
  7. The alarm is activated, and that moment there is no PIR problem anymore.

Hopefully this makes sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants