This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cron email
#1
How can I send email from console or cron containing the sensor data?
Reply
#2
you can use node red i get alarm emails.
just pull the data you want from the signalk stream with websocket ws://localhost:3000/signalk/v1/stream
and email it
mare liberum
Reply
#3
(2019-01-17, 03:26 AM)jim321 Wrote: you can use node red i get alarm emails.
just pull the data you want from the signalk stream with websocket ws://localhost:3000/signalk/v1/stream
and email it

Sounds good. I’ll check it out. 
I would like to be able to use the gmail it functionality, but need help getting the sensor data into the msg body.
Reply
#4
my bilge warning simple switch email it sends when changes occur what data do you need to send ? you might need to send on some kind of trigger or timer so its not sending a bunch of emails

Code:
[{"id":"d11771be.073a5","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"b9302db2.00bed","type":"websocket in","z":"d11771be.073a5","name":"ws","server":"45e5d0ed.aaea7","client":"","x":55,"y":90,"wires":[["b7ca2b7c.4b6878"]]},{"id":"b7ca2b7c.4b6878","type":"jsonpath","z":"d11771be.073a5","expression":"$.updates..values[*]","split":false,"name":"Signal K delta values","x":228,"y":90.99999523162842,"wires":[["b6838d71.3c964"]]},{"id":"b6838d71.3c964","type":"function","z":"d11771be.073a5","name":"merge values","func":"var paths={};\nvar arrayLength = msg.payload.length;\nfor (var i = 0; i < arrayLength; i++) {\n    paths[msg.payload[i].path]=msg.payload[i].value;\n}\nmsg.payload = paths;\nreturn msg;","outputs":1,"noerr":0,"x":425,"y":90,"wires":[["63e060b9.3fdd4"]]},{"id":"63e060b9.3fdd4","type":"function","z":"d11771be.073a5","name":"float","func":"var signalk_key=\"sensors.bilge\";\n\nif(msg.payload.hasOwnProperty(signalk_key)){\n    msg.payload=msg.payload[signalk_key];\n    return msg;\n    \n\n}","outputs":1,"noerr":0,"x":578,"y":91,"wires":[["df71e1a2.754f7"]]},{"id":"df71e1a2.754f7","type":"function","z":"d11771be.073a5","name":"","func":"var water=msg.payload;\nvar alarm=\"BILDGE ALARM\"\nvar ok=\"OK\"\nif (water===1)msg.payload=alarm;\nif (water===0)msg.payload=ok;\nreturn msg;","outputs":1,"noerr":0,"x":697.1666259765625,"y":92.33333587646484,"wires":[["c29b28a0.b0a048"]]},{"id":"c29b28a0.b0a048","type":"e-mail","z":"d11771be.073a5","server":"smtp.gmail.com","port":"465","secure":true,"name":"","dname":"","x":820,"y":91,"wires":[]},{"id":"45e5d0ed.aaea7","type":"websocket-listener","z":"","path":"ws://localhost:3000/signalk/v1/stream","wholemsg":"false"}]
mare liberum
Reply
#5
(2019-01-17, 04:25 PM)jim321 Wrote: my bilge warning simple switch email it sends when changes occur what data do you need to send ? you might need to send on some kind of trigger or timer so its not sending a bunch of emails

Think that would be easier in signalk node-red?  Then you can have a signalk-subscribe node outputting the value, maybe a switch node to send the email if the sigK value is above a threshold or something.
Reply
#6
Thanks Jim and PaddyB. 

Jim - I saw in your comments re MOB marker in OpenCPN that your bilge alarm sends an email every time it boots. Mine is set up the same way - send a WET alarm email when the bilge pump turns on, send a DRY email when it turns off - ie the normal condition. So in testing at the house I would get 1 DRY email when the Pi rebooted, but when I took it to the boat, it was sending a DRY email every 3 minutes - like  clockwork.  I have the Pi wifi connected to my iphone hotspot. I have a Wyze cam also connected to the iPhone hotspot with no connectivity issues - even video playback. 

I was powering the pi with a cigartette lighter USB 2.5 amp adapter. Its likely my house batteries are 13.5v on a sunny day - so maybe this combination was causing the reboots? Have you seen that? Would a 12v-5v buck converter provide a more stable power range?

A timer, that what I was hoping to accomplish by using cron. Cant think of a way to use gpio to effect a timer. Maybe I'll setup a light sensor on a gpio to send that morning checkup email - that would still be multiple emails - but probably not every 3 minutes... 

Regarding node-red - I have to confess. I had trouble with v1.0 network connections reliability so I set it aside and pulled out an old Openplotter 0.8.0 that has always run without issues when quickly cobbling this monitoring system together. I hadn't installed node-red on that 0.8.0 sd though I did get up to speed w v1.1 and node-red - impressive. Time to revisit 1.x. Is  Pi 3B+ working for both ap and internet connectivity or better to stick with Pi3B for now? 

Thanks.

Hank
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)