Neuron - Addressing GPIO from C++
@tomas_hora ok, going to try it on Jessie Lite...
I am completely confused about the software that is available atm. Can you do a summary on what is what?
I see Mervis had TCP modbus, but no REST API, which seems to be part of EVOK?
I wanted to try out someting using the REST API, but on Mervis, there is only modbus?
Do I see it correctly, and Mervis contains Modbus as it uses it to communicate itself? And is EVOK a collection of UniPi API possibilities?
Edit: in meanwhile, I have installed EVOK without any issues on a Jessie Lite img and could address the REST API. The Pi I had it installed on was not the one in the UniPi. I have to use some pliers to get the SD-card out of the UniPi to replace it ;) will do that tomorrow, enough for today ;)
Edit the next morning :) : I think I understand now. EVOK is something that is in development with API's and (in future?) control the UniPi via some UI, like Mervis
Mervis is an off-the-shelve solution that already existed and works with the UniPi...
@Boy-Lenssen :) You got it all right. Evok and the TCP Modbus server are opensourse solutions for people who want to do their own implementation.
Mervis makes UniPi all in one PLC system including scada, HMI designer and database.
@tomas_hora Ok, I made the mistake by following the readme instead of getting the current branch :p
I restarted this morning, get -qO- http://192.168.1.16/rest/all does not show anything. I selected option 2 (Neuron) during setup, so all should be ok.
Can you tell me how to read / write via rest (or another way?)...how do I know what the ports are called? Also I see no web interface when going to http://192.168.1.16
What am I doing wrong?
Edit: OK! Adding port nr 8088 to the command makes it work! wget -qO- http://192.168.1.16:8088/rest/relay/2_14 --post-data='value=0' now changes the value! \o/ thanks!
Edit2: websocket via Python script is also working perfectly! But as you said TCP Modbus is faster, I might go with that one...
@tomas_hora I got it working with Modbus, websockets and REST, very cool!
You advised to use Modbus because of the speed. To see changes on the input, I need to poll the port. Do websockets push any changes so polling is not necessary?
When should I use registers to change a value, and when should I use coils?
@Boy-Lenssen Great :) Yep, the websocket automatically notifies all clients about a change of state at DI. However by default it does only twice a second so check your config.
If you want to set only a single for example relay then use coils. If you want to set multiple relays at once, use registers. But be aware that by using registers, you set all the relays mapped to the registers, so you can accidentally set relay to a different state (eg. if the state of relay changes from a different place in your app between the read and write to register).
Boy Lenssen last edited by
@tomas_hora Ok, coils it is :p
ok, notification is perfect! It is not a problem if it takes half a second, would be nice if i could set it down to 5 times a second, but as you mention here, that is possible :)
I think I'm going to go with websockets then!
Boy Lenssen last edited by
@tomas_hora I changed the config of
50, as I really need to know when an input has changed for a split second. This way it checks every 20ms and that seems to be working ok. Are there any caveats when setting the frequency so high?
@Boy-Lenssen You should be OK.