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
Create action from switch attached to GPIO
#11
(2017-05-24, 01:07 PM)Littlechay Wrote: Thanks good idea to put it in a script; which I had thought about but not got around to.

I have done it now. Works every time from the command line but nothing happens when triggered from an action.

Permissions are set on the script. I put it on the same path as you have done.. nothing.

The trigger is working OK just nothing from this action. Anything different from default in your system that may be affecting things?

Hmm, can't think of anything wierd, it's actually a recent install from the latest alpha image updated and upgraded so should be pretty clean. I set permissions to 777 but that was trying, unsuccessfully, to get the script to run from node-red, think it ran OK before that on O. So close......... Wink I'll have another play when I get back onboard.
Being single handed the MOB function isn't actually that useful... So I changed it to control-M to drop a mark at the boat position which will be handy anchoring, if I can get node-red working..

Sent from my SGP511 using Tapatalk
Reply
#12
Trying to break it put it keeps on working....???
Cleaned out all the other actions and gpio pin definitions.

Here's what I have from openplotter.conf

I short gpio pin 26 to ground and opencpn drops a waypoint at the boat gps position.


[GPIO]
sensors = [[u'test', 'in', u'26', u'up']]
________________
[ACTIONS]
triggers = [[1, u'sensors.test.value', 2, '0', [['ACT2', 'sudo /home/pi/scripts/dropmark.sh', 0.0, 0]]]]
Reply
#13
(2017-05-24, 07:50 PM)PaddyB Wrote: Trying to break it put it keeps on working....???
Cleaned out all the other actions and gpio pin definitions.

Here's what I have from openplotter.conf

I short gpio pin 26 to ground and opencpn drops a waypoint at the boat gps position.


[GPIO]
sensors = [[u'test', 'in', u'26', u'up']]
________________
[ACTIONS]
triggers = [[1, u'sensors.test.value', 2, '0', [['ACT2', 'sudo /home/pi/scripts/dropmark.sh', 0.0, 0]]]]
Thanks for that clue. Interesting I checked the conf file and for some reason the script name in my conf file had a newline character on the end "....../mob.sh\n'" I have no idea what put that there it wasn't me and wasn't showing in the command in the actions panel of OP. 

Anyway I manually deleted the \n and everything now works as advertised. 

In the attached image I have pushed the red button on the left, top, of my plotter; the MOB marker has appeared and the alarm switch (top right) has illuminated. Pushing the illuminated switch cancels the alarm. 

Other actions will be configured to sound alarms too. Ideally AIS CP etc.. but that is another story. 

Cheers


Attached Files Image(s)
   
Reply
#14
Hi, Maybe I'm doing something wrong. But somehow I can't really figure out what I'm doing wrong. I
hope one of you has the answer!What I'm trying to do is to let my pi shutdown whenever I push a button. And for the time being I have just put in a message box in order to give me some sort of feedback, instead that it keeps booting down.

   
The button I'm attaching
   
How I set up the GPIO pull-up
   
How I set up my action
   

And I get the message if I put the value to 1, but then it also shows the message when I boot, which means that it would go immediately into shutdown (that happened already once to me)

Hopefully you guys can help. I have the latest version of Openplotter v1.0.0

Quote:If you want to trigger when a pin is connected to ground then the gpio pin needs to be configured as pull up, otherwise it's always connected to ground internally. In this example there are 3 pins being used, when pin 26 is connected to ground it turns the LED on pin 16 on, then if pin 19 is connected to ground it turns the LED off again.
On openplotter V0.11.7 alpha.

[Image: jaxYtit.png]
[Image: 9CBBid0.png]
[Image: u0aebhZ.png]

Creating a waypoint in opencpn doesn't look so easy though:
From
https://opencpn.org/wiki/dokuwiki/doku.p..._sentences


Quote:xxWPL - Waypoint Location Used to send routes and waypoints up to a GPS receiver. OpenCPN does not process these sentences as input.

Edit: Though digging deeper...
https://opencpn.org/flyspray/index.php?d...sk_id=1595

Quote:I've just recently realised that, in theory, OCPN should read-in a WPL sentance in the context of APRS, and generate a specific AIS target. If this is the case, the contextual menu (right click on the AIS target/target query) should offer the possibility of creating a waypoint.
Actually creating the nmea sentence might be a job better suited to node-red - quite easy to get at the signalk data, or anyone know how to do that as bash?
Reply
#15
"And I get the message if I put the value to 1, but then it also shows the message when I boot, which means that it would go immediately into shutdown (that happened already once to me)"

be careful with that shutdown command or reboot for that matter it's no fun has happened to me lol..i had an inject once at start Smile

i have alarms set to gpio pins sending emails "SK node red", when i reboot it always sends a message when the gpio pins are started, enabled on boot.
i dont think there's anything you can do about it..
Reply
#16
So basically what you say is that I should configure it outside Openplotter?  Dodgy

Or send a request maybe to the openplotter community. Otherwise you will always have a shutdown after you boot up the machine. Not really wanted...

I hope somebody has a solution  Big Grin

(2018-07-15, 10:41 PM)jim321 Wrote: "And I get the message if I put the value to 1, but then it also shows the message when I boot, which means that it would go immediately into shutdown (that happened already once to me)"

be careful with that shutdown command or reboot for that matter it's no fun has happened to me lol..i had an inject once at start Smile

i have alarms set to gpio pins sending emails "SK node red", when i reboot it always sends a message when the gpio pins are started, enabled on boot.
i dont think there's anything you can do about it..
Reply
#17
(2018-07-16, 11:24 AM)vriezenaar Wrote: So basically what you say is that I should configure it outside Openplotter?  Dodgy

Or send a request maybe to the openplotter community. Otherwise you will always have a shutdown after you boot up the machine. Not really wanted...

I hope somebody has a solution  Big Grin

I do the following on my Win10 device: click on my Bash shortcut (I installed Windows Subsystem for Linux), Arrow up + enter (to launch ssh session), password input, Arrow up + enter (to launch sudo shutdown –h)

More info  about Windows Subsystem for Linux: https://docs.microsoft.com/en-us/windows...tall-win10
Reply
#18
(2018-07-16, 11:24 AM)vriezenaar Wrote: I hope somebody has a solution  Big Grin

I use a button in a node red dashboard, then shut down nicely from any device which can see a Web page.

Sent from my SM-T813 using Tapatalk
Reply
#19
Code:
[{"id":"660f1acc.275d04","type":"exec","z":"46d7f9c0.e081c8","command":"sudo reboot","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":370,"y":240,"wires":[[],[],[]]},{"id":"5c954e15.98908","type":"inject","z":"46d7f9c0.e081c8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":240,"wires":[["61a904dc.c9162c"]]},{"id":"61a904dc.c9162c","type":"ui_button","z":"46d7f9c0.e081c8","name":"","group":"61c12cf6.6a9484","order":1,"width":0,"height":0,"passthru":false,"label":"reboot","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":230,"y":240,"wires":[["660f1acc.275d04"]]},{"id":"61c12cf6.6a9484","type":"ui_group","z":"","name":"NAV 1","tab":"47ff93a8.26e4bc","order":1,"disp":false,"width":"4"},{"id":"47ff93a8.26e4bc","type":"ui_tab","z":"","name":"Engine","icon":"dashboard","order":1}]
example flow
its reboot could be changed to shutdown

"So basically what you say is that I should configure it outside Openplotter?
Or send a request maybe to the openplotter community. "

its a raspberry pi issue that when the gpio is started.. it sends a signal.. its hardware issue not software.
your at the openplotter community
Reply
#20
(2018-07-16, 12:07 PM)jim321 Wrote: its reboot could be changed to shutdown

Similar to mine but I close Opencpn before shutting down or rebooting the Pi

Quote:killall -s TERM opencpn 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)