Example application neuron - evok for home automation
Martijn Hemeryck last edited by
I am currently trying to figure out the specs / setup for a DIY home automation project for a new building. Needless to say I'd figure the unipi / neuron HW would fit in nicely.
For the software part, I'm thinking of using something like home assistant . I've already been tinkering a bit with a regular raspberry pi, but for a home project I'd like to use the neuron as it already seems to be able to do all the IO transformation I would need.
From reading the docs / this forum, I can see however that it's probably not the input to address the IO itself directly; if I understand correctly, the idea is to use EVOK as a web-like API instead.
Do you have some example code for a small setup with EVOK? I am thinking of something like:
- reading a digital input switch (e.g. reading a 24V push button)
- writing a digital output switch (e.g. writing a 24V output to trigger a bistable relay to drives a lamp)
For the reading part: would you typically do some kind of polling? Or is there some sort of interrupt / callback-like system available?
Thanks in advance!
@Martijn-Hemeryck I cannot help you much with the opensource solutions, because there seems to be a lot of them and its impossible to test them all.
Evok, as you say, is only an API, which polls the internal Modbus server which provides the access to all of the IOs except 1Wire. So the coding of the behaviour has to be done somewhere else - either you write your own app to drive the behaviour or you use one of the opensource solutions for that. For the lights, check the DirectSwitch function it is ideal for such applications and you do need to write the if 1 then 1 code...
Anyway, check Mervis. It might seem a bit hard from the beginning but then some customizations or more complex behaviour is really easy to implement
Martijn Hemeryck last edited by
Home assistant is only an example and actually not even that relevant to my question here -- ideally I'd write my own integration into home assistant.
I am more interested really in how to program against the low-level IO with a general purpose programming language. I already read a bit about EVOK and the modbus server, so I'll probably just need to read a bit more about that.
My main question really was to have a simple "hello world"-like example in a general purpose programming language on a neuron. I was thinking about something like a python-script that reads inputs (e.g. a push button) and than drives an output (e.g. light switch) based on that input, pretty much that same way that you can do an a regular raspberry pi with the
wrt Mervis: I had the idea the focus there was that it uses a custom graphical programming interface. My main motivation for a setup with a unipi / neuron would be to not have to deal with graphical programming tools, to be honest :slight_smile:
Specifically about the DirectSwitch: is this documented somewhere? What is it really? I have the impression that you sort of link an output state directly to a state change of an input. I would rather have the option to specify my own logic (callback, trigger, whatever you'd like to call it) based on an input change.
As a general question: what would be the best starting point (documentation) for developing a custom application? I do like the idea of EVOK as a web-like API to develop against. I am a bit skeptical however about the reaction time with all these different levels of abstraction ...
Direct switches are described in the documentation of Neurons at downloads: https://files.unipi.technology/s/public But if you want to control this login in the software, then go ahead. But expect the delay caused by the ModbusTCP <---evok---> webservices delay. But there are topics in this forum how to get evok faster a bit to poll the Modbus faster than the default poll rate to be able to catch fast pulses to the DIs
Jitu last edited by
I am also trying to read analog and digital ports on unipi to collect sensor data from few sensors. I was also just wondering if we can do it in the same way like we do it on raspberry pi using a python script. I can see that even you wanted to do something like that. I have also gone through evok api but they seem to be specific models. I dont think using that we can directly read analog and digital I/Os on unipi. Can you please suggest any ideas if you were successful doing that?