(2022-09-18, 03:53 AM)Erikblade Wrote: hi;
I have a question about notifications 3.0.6-stable
the corresponding documentation is not published and I have doubts about the use of this function.
From what I have been able to investigate, it seems that it is possible to execute a command when an event occurs, but I am not very clear.
The issue that I was looking to achieve was to establish a series of alarms (flood, intrusion, etc.) so that, when I am not on board, a script is executed that sends me a notification to my mobile (Telegram bot) and/or performs some action. .
I don't know if it will be possible, at least for now in tests, I haven't succeeded, I think it's because I don't understand how it works.
Thank you very much for your time and very grateful for the work developed.
Sorry, openplotter-notifications app is a powerful app that will need a good documentation but we are focused on other apps now.
This app is perfect for your requirements. this should be the procedure:
- Your sensors should send data to some signal k keys using openplotter-I2C or openplotter-GPIO apps (both still under development ). Both signal k keys should be 0 or 1:
sensors.flood
sensors.intrusion
- Then you should define zones for your new signal k keys using the signal k plugin "Zones". For example you can set a zone for sensors.flood as "normal", no visual, no sound and write any message when sensors.flood is less than 1 and another zone as "alarm", visual, sound and any message when sensors.flood is bigger than 0.
- The signal k server will detect when the value of sensors.flood is between a defined zone and will generate new signal k keys with this format:
{
"path": "notifications.sensors.flood",
"value": {
"message": "xxxxxxx",
"state": "normal",
"method": []
}
or:
{
"path": "notifications.sensors.flood",
"value": {
"message": "yyyyyyy",
"state": "alarm",
"method": ["visual", "sound"]
}
- The openplotter-notifications app detects these signal k keys and will play the sound assigned to each state and will show a window if the "method" is defined for that state.
- If you need more actions than sounds or windows you can use the tab "Actions" in openplotter-notifications app to set multiple actions for any state of any notification. There are many actions available and every openplotter app can add more actions to the list when installed. In your case you should choose the action "run command" to run an external script or wait for the notifications-iot app that will add actions to interact with Telegram bots.
This is a brief summary, the docs will have some examples and screenshots to make it easier to understand. I hope it helps.