Posts: 3,025
Threads: 63
Joined: Mar 2016
Reputation:
284
2022-09-19, 12:03 PM
(This post was last modified: 2022-09-19, 12:06 PM by Sailoog.)
(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 ![Angel Angel](https://forum.openmarine.net/images/smilies/angel.png) ). 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.
Posts: 7
Threads: 2
Joined: Jun 2020
Reputation:
1
(2022-09-19, 12:03 PM)Sailoog Wrote: (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.
thaks for you answer;
I knew that it could work more or less that way, but with the explanation it has become quite clear to me.
Regarding the issue of the GPIO or i2C app, well in my case it is not something that at the moment is a big problem for me, since I have found an "elegant" way to replace it.
Since the GPIO pins are limited, I am using an Arduino that groups external sensors and sends them via USB to openplotter. then in RPI I use two scripts, one of them reads the alarm variables from signalk (TCP) and, if there are any, sends a message via telegram. the other script is a "listening" oriented bot. it is waiting for an order from telegram (for example /turn on_fridge), which is bounced back to the arduino through I2C and the arduino is the one that controls the relay that activates it.
As you can see, it's a bit of a convoluted way to patch things up, but at least it works.
That is if I send the deltas to signalk through Serial.print(), since the Json issue, even using the ArduinoJson.h library, I am not able to understand or master them.
I reiterate that thank you very much for your explanations, they have given me some ways to better understand the openplotter-notifications app
Posts: 1,230
Threads: 103
Joined: Mar 2016
Reputation:
72
(2022-09-19, 01:36 PM)Erikblade Wrote: That is if I send the deltas to signalk through Serial.print(), since the Json issue, even using the ArduinoJson.h library, I am not able to understand or master them.
This rang a few bells... I use micropython now with an esp32 to do stuff then send data as signalk, but before it was arduino code, and also had issues with json, looking at the vscode ini looks like it had to be an ArduinoJson@<6.0.0
https://github.com/boatybits/DATA_SENDER...formio.ini
Feel free to take any code which might be useful >
https://github.com/boatybits/DATA_SENDER...c/main.cpp
Code: void sendSigK(String sigKey, float data)
{
if (sendSig_Flag == 1)
{
DynamicJsonBuffer jsonBuffer;
String deltaText;
// build delta message
JsonObject &delta = jsonBuffer.createObject();
//updated array
JsonArray &updatesArr = delta.createNestedArray("updates");
JsonObject &thisUpdate = updatesArr.createNestedObject(); //Json Object nested inside delta [...
JsonArray &values = thisUpdate.createNestedArray("values"); // Values array nested in delta[ values....
JsonObject &thisValue = values.createNestedObject();
thisValue["path"] = sigKey;
thisValue["value"] = data;
thisUpdate["Source"] = "ESP32";
// Send UDP packet
Udp.beginPacket(remoteIp, remotePort);
delta.printTo(Udp);
Udp.println();
Udp.endPacket();
delta.printTo(Serial);
Serial.println();
}
} //___________________________________________________________
Posts: 14
Threads: 1
Joined: Aug 2022
Reputation:
2
hello sailoog its ready the i2c for testing , thank you
Posts: 3,025
Threads: 63
Joined: Mar 2016
Reputation:
284
Not yet sorry, I have been busy, working on it today.
Posts: 14
Threads: 1
Joined: Aug 2022
Reputation:
2
(2022-10-02, 09:01 AM)Sailoog Wrote: Not yet sorry, I have been busy, working on it today.
ok fuerza !! yo solo era para saber y ir testando a ver que tal se comporta com dispositivos que lean mayor amperaje en 12 volts , tipo ina260 , gracias y disculpa molestias
Posts: 10
Threads: 2
Joined: Oct 2022
Reputation:
0
Hey Sailoog, just downloaded OP3 without realizing that I2C isn't supported yet. I know that you can't specifically predict release dates, but I'll be working on the boat setup in january 2023, do you think I2C will be running and stable by then?
Thanks for all your work. Looking forward to integrating w/ pypilot as well; just used it on a voyage down the coast of Oregon and California
Posts: 3,025
Threads: 63
Joined: Mar 2016
Reputation:
284
(2022-10-04, 02:13 AM)svisara Wrote: Hey Sailoog, just downloaded OP3 without realizing that I2C isn't supported yet. I know that you can't specifically predict release dates, but I'll be working on the boat setup in january 2023, do you think I2C will be running and stable by then?
Thanks for all your work. Looking forward to integrating w/ pypilot as well; just used it on a voyage down the coast of Oregon and California
Of course, I think this weekend I will be able to publish the first beta with almost all the supported sensors working.
Posts: 69
Threads: 3
Joined: Aug 2021
Reputation:
3
2022-10-04, 09:26 PM
(This post was last modified: 2022-10-04, 09:27 PM by Paul M.)
(2022-10-04, 08:03 PM)Sailoog Wrote: (2022-10-04, 02:13 AM)svisara Wrote: Hey Sailoog, just downloaded OP3 without realizing that I2C isn't supported yet. I know that you can't specifically predict release dates, but I'll be working on the boat setup in january 2023, do you think I2C will be running and stable by then?
Thanks for all your work. Looking forward to integrating w/ pypilot as well; just used it on a voyage down the coast of Oregon and California
Of course, I think this weekend I will be able to publish the first beta with almost all the supported sensors working.
Posts: 3,025
Threads: 63
Joined: Mar 2016
Reputation:
284
Here we go...
openplotter-i2c 3.x.x beta for OpenPlotter 3 released: https://forum.openmarine.net/showthread.php?tid=4276
please test and report in that thread. Thanks.
|