OpenMarine
action alert on pressure drop - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: action alert on pressure drop (/showthread.php?tid=1073)



action alert on pressure drop - all1p - 2018-03-16

hello, is it possible to create an action with warning for a drop in pressure over time. Example, drop of 1 hpa per hour. Thank you.


RE: action alert on pressure drop - shark24 - 2018-03-16

(2018-03-16, 01:40 PM)all1p Wrote: hello, is it possible to create an action with warning for a drop in pressure over time. Example, drop of 1 hpa per hour. Thank you.

Well it's possible with the help of node-red. You would have to log the data to a file or database or cache them.
There are many tutorials out there on node-red. You can do so much with it that it's really worth to get into it.


RE: action alert on pressure drop - PaddyB - 2018-03-16

(2018-03-16, 01:57 PM)shark24 Wrote: Well it's possible with the help of node-red. You would have to log the data to a file or database or cache them.
There are many tutorials out there on node-red. You can do so much with it that it's really worth to get into it.

Node red could  certainly do it, I record pressure into a database so checking for a drop over time wouldn't be that tricky once you have the rest sorted out. 

What about a change of nearly 3hPa in 3 minutes? This is a close shave with a tornado a few weeks ago in Portugal 

[Image: S9xceXD.png]


RE: action alert on pressure drop - shark24 - 2018-03-16

3 hPa in 3 min that's scary  Big Grin 

I was thinking of using a global variable to store the data of the last 4 hours or so. I guess that would be an easy approach for beginners.


RE: action alert on pressure drop - PaddyB - 2018-03-16

(2018-03-16, 02:22 PM)shark24 Wrote: 3 hPa in 3 min that's scary  Big Grin 

I was thinking of using a global variable to store the data of the last 4 hours or so. I guess that would be an easy approach for beginners.

Good idea - here's an easy way to store signalk values into global variables, well some sensor signalk anyway.  >

Plug the output into a MQTT out and you can see all the data on the web as well Cool 


Code:
[
   {
       "id": "72db7bb3.6de9e4",
       "type": "websocket in",
       "z": "3f30ea31.da3756",
       "name": "SignalK input",
       "server": "fc1b2b62.0b63a8",
       "client": "",
       "x": 169,
       "y": 809,
       "wires": [
           [
               "fd8f5723.077e38"
           ]
       ]
   },
   {
       "id": "fd8f5723.077e38",
       "type": "function",
       "z": "3f30ea31.da3756",
       "name": "Create global variable",
       "func": "obj=msg.payload.updates[0].values[0].path;\nvalue=msg.payload.updates[0].values[0].value;\nglobal.set(obj, value);\n\nmsg.payload =  value;\nmsg.topic = obj;\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 308,
       "y": 902,
       "wires": [
           [
               "6e82c403.2d258c",
               "ec14fb6b.9c39e8"
           ]
       ]
   },
   {
       "id": "6e82c403.2d258c",
       "type": "debug",
       "z": "3f30ea31.da3756",
       "name": "",
       "active": false,
       "console": "false",
       "complete": "true",
       "x": 547,
       "y": 915,
       "wires": []
   },
   {
       "id": "ec14fb6b.9c39e8",
       "type": "mqtt out",
       "z": "3f30ea31.da3756",
       "name": "",
       "topic": "",
       "qos": "",
       "retain": "",
       "broker": "d07a7e43.825c9",
       "x": 597,
       "y": 848,
       "wires": []
   },
   {
       "id": "fc1b2b62.0b63a8",
       "type": "websocket-listener",
       "z": "",
       "path": "ws://localhost:3000/signalk/v1/stream",
       "wholemsg": "false"
   },
   {
       "id": "d07a7e43.825c9",
       "type": "mqtt-broker",
       "z": "",
       "broker": "m10.cloudmqtt.com",
       "port": "16098",
       "clientid": "",
       "usetls": false,
       "compatmode": true,
       "keepalive": "60",
       "cleansession": true,
       "willTopic": "",
       "willQos": "0",
       "willPayload": "",
       "birthTopic": "press",
       "birthQos": "0",
       "birthPayload": "test birth"
   }
]



RE: action alert on pressure drop - all1p - 2018-03-16

(2018-03-16, 02:48 PM)PaddyB Wrote:
(2018-03-16, 02:22 PM)shark24 Wrote: 3 hPa en 3 min c'est effrayant  Big Grin 

Je pensais utiliser une variable globale pour stocker les données des 4 dernières heures. Je suppose que ce serait une approche facile pour les débutants.

Bonne idée - voici un moyen facile de stocker des valeurs de signal dans des variables globales, ainsi qu'un signal de capteur de toute façon. >

Branchez la sortie dans un MQTT et vous pouvez voir toutes les données sur le web ainsiCool 


Code:
[
   {
       "id": "72db7bb3.6de9e4",
       "type": "websocket in",
       "z": "3f30ea31.da3756",
       "name": "SignalK input",
       "server": "fc1b2b62.0b63a8",
       "client": "",
       "x": 169,
       "y": 809,
       "wires": [
           [
               "fd8f5723.077e38"
           ]
       ]
   },
   {
       "id": "fd8f5723.077e38",
       "type": "function",
       "z": "3f30ea31.da3756",
       "name": "Create global variable",
       "func": "obj=msg.payload.updates[0].values[0].path;\nvalue=msg.payload.updates[0].values[0].value;\nglobal.set(obj, value);\n\nmsg.payload =  value;\nmsg.topic = obj;\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "x": 308,
       "y": 902,
       "wires": [
           [
               "6e82c403.2d258c",
               "ec14fb6b.9c39e8"
           ]
       ]
   },
   {
       "id": "6e82c403.2d258c",
       "type": "debug",
       "z": "3f30ea31.da3756",
       "name": "",
       "active": false,
       "console": "false",
       "complete": "true",
       "x": 547,
       "y": 915,
       "wires": []
   },
   {
       "id": "ec14fb6b.9c39e8",
       "type": "mqtt out",
       "z": "3f30ea31.da3756",
       "name": "",
       "topic": "",
       "qos": "",
       "retain": "",
       "broker": "d07a7e43.825c9",
       "x": 597,
       "y": 848,
       "wires": []
   },
   {
       "id": "fc1b2b62.0b63a8",
       "type": "websocket-listener",
       "z": "",
       "path": "ws://localhost:3000/signalk/v1/stream",
       "wholemsg": "false"
   },
   {
       "id": "d07a7e43.825c9",
       "type": "mqtt-broker",
       "z": "",
       "broker": "m10.cloudmqtt.com",
       "port": "16098",
       "clientid": "",
       "usetls": false,
       "compatmode": true,
       "keepalive": "60",
       "cleansession": true,
       "willTopic": "",
       "willQos": "0",
       "willPayload": "",
       "birthTopic": "press",
       "birthQos": "0",
       "birthPayload": "test birth"
   }
]

Merci pour vos réponses. Je soupçonnais que la solution était l'utilisation du nœud rouge. Je ne comprends rien aux programmes :-) Je vais d'abord chercher des tutoriels en français pour commencer.