OpenMarine

Full Version: Connecting JSON from Ethernet device
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all
i have a Ethernet device called DEAnetIP4 to control my relays in the boat.
I'm trying to control it with the freeboard. First i tryet in NodeRED, but i'm not good at coding. Then I found out that the relayboard send and recieve by JSON, so i tryet to connect with that. The board is connected with wire to the router where my PI is connected to with a wifidoungle named wlan1. OpenPlotter is transmitted by wlan0, and I think the problem lies here.

When I go to the browser and type this address: http://192.168.1.100/current_state.json?pw=admin

I get this:
Code:
{
 "CurrentState": {
   "DigitalInput": [
     {"Name": "DI1", "Value": "0", "Count": "0"},
     {"Name": "DI2", "Value": "0", "Count": "0"},
     {"Name": "DI3", "Value": "0", "Count": "0"},
     {"Name": "DI4", "Value": "0", "Count": "0"},
     {"Name": "DI5", "Value": "0", "Count": "0"},
     {"Name": "DI6", "Value": "0", "Count": "0"},
     {"Name": "DI7", "Value": "0", "Count": "0"},
     {"Name": "DI8", "Value": "0", "Count": "0"}
   ],
   "AnalogInput": [
     {"Name": "AI1", "Value": "0", "Measure": "0.0 mV"},
     {"Name": "AI2", "Value": "0", "Measure": "0.0 mV"},
     {"Name": "AI3", "Value": "0", "Measure": "0.0 mV"},
     {"Name": "AI4", "Value": "0", "Measure": "0.0 mV"},
     {"Name": "AI5", "Value": "0", "Measure": "0.0 mV"},
     {"Name": "AI6", "Value": "0", "Measure": "0.0 mV"},
     {"Name": "AI7", "Value": "0", "Measure": "0.0 mV"},
     {"Name": "AI8", "Value": "0", "Measure": "0.0 mV"}
   ],
   "Output": [
     {"Name": "Lights", "Value": "1"},
     {"Name": "VHF", "Value": "0"},
     {"Name": "Radar", "Value": "0"},
     {"Name": "Toilet", "Value": "0"},
     {"Name": "Fridge", "Value": "0"},
     {"Name": "Nav", "Value": "0"},
     {"Name": "Anchor", "Value": "0"},
     {"Name": "Steam", "Value": "0"},
     {"Name": "Electro", "Value": "0"},
     {"Name": "Bilge", "Value": "0"},
     {"Name": "Water", "Value": "0"},
     {"Name": "Engine", "Value": "1"},
     {"Name": "DO13", "Value": "0"},
     {"Name": "DO14", "Value": "0"},
     {"Name": "DO15", "Value": "0"},
     {"Name": "DO16", "Value": "0"}
   ],
   "PWM": [
     {"Name": "PWM1", "Value": "0"},
     {"Name": "PWM2", "Value": "0"}
   ]
 }
}
As you can see the lights in the boat and in the engineroom is now turn on.

I tryet to put the address line in freeboard->add sourse->JSON, but it would not update...

I would like it to be connected directly to the PI with eth0, but i cant change the address and netmask on eth0...
I have to change IP to 192.168.1.5 and netmask to 255.255.255.0 to control the relays....

Please... if anybody could help. I'm happy to give access thru VNC, if that is easier...

/Benjamin
Hi,

On a lighter note, the amount of coding which you have displayed here can give complex to anyone doing coding as a profession.
looks like you would need a crossover cable..

""Connect the DAEnetIP2 controller with your computer via UTP crossover cable.""
http://denkovi.com/Products/DAEnetIP2/Cross-over.JPG
http://denkovi.com/web-relay-board-8-cha...-daenetip2

https://www.google.com/search?q=crossove...e&ie=UTF-8
then in a terminal do an ifconfig to see if it got an ip address.

you need to learn NodeRED its not that hard.. freeboard has been taken out of the newest version of op..