Generic serial communication

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
mirodin
Posts: 7
Joined: Tuesday 25 February 2020 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Generic serial communication

Post by mirodin »

Hey guys,

first of: I am a long time NodeRED user but the JS curse aka. dependency hell finally caught up to me. Playing around with a bunch of alternatives Domoticz looked very promising with its batteries included philosophy which is the exact opposite of NodeRED. For me another bonus point is the fact that rules/automations are written in Lua - understanding code is way easier for me than a screen of nodes which tell me nothing connected by wires.

However I am running a MySensors network alongside a bus system called PJON. This system is layed out in a star topology connected to a cental Arduino Uno since the clock of a Rapsberry is not reliable enough. I have this Arduino hand all readings via USB to my Raspberry. When I was looking for how to setup this solution in Domoticz I could not find a generic serial hardware component which would allow me to listen to a serial device and send those readings to an event handler.

tl;dr: what is the correct way to have a serial communication between Domoticz and an Arduino connected via USB/GPIO?
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Generic serial communication

Post by freijn »

mirodin
Posts: 7
Joined: Tuesday 25 February 2020 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Generic serial communication

Post by mirodin »

Thank you for that link, this looks not too shabby ;)

As far as I can tell this relies on an ESP8266 which in turn is bond to WiFi? I have my bus PJON setup because I do not care if a temp reading via MySensors gets missing since 5 minutes later the next one might get through. But when my switches do not work because my WiFi is down I would be in a world of pain with my family :lol:. Plus I think some things are to important to have them run via radio.
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Generic serial communication

Post by freijn »

I have only 2 devices hard wired. My P1 and heating measurement via USB to the Raspberry.
Rest is all radio, most of it Wifi and some cheap ass 433 Kaku.

Not sure in which part of the world you live but my Wifi is stable and 99% available. Ok, I have a proffesional Access Point
but before that it was almost same.
By the way, have a look at IoT-land and see how much is wireless :-)


I do not understand your question. Are you looking at a layer 1 or 5-7 ?

You have your raspberry connected to the Arduino. That is your serial conversion already.

With MQTT you could read your serial with Node-Red and pass it over to Domoticz via MQTT.

Again, no clue what you are looking for.
mirodin
Posts: 7
Joined: Tuesday 25 February 2020 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Generic serial communication

Post by mirodin »

freijn wrote: Wednesday 26 February 2020 8:40 Not sure in which part of the world you live but my Wifi is stable and 99% available.
Well for me 99% is not enough for a light switch. Plus I do have my access control running ever this bus as well and I do not feel comfortable to do this wireless.
You have your raspberry connected to the Arduino. That is your serial conversion already.
Yes, I do have a serial connection but I need domoticz to use this Arduino like it uses a MySensors gateway so it can communicate with my already existing bus.
mirodin
Posts: 7
Joined: Tuesday 25 February 2020 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Generic serial communication

Post by mirodin »

freijn wrote: Tuesday 25 February 2020 22:11 I think this is your solution :-)
@freijn I did some more reading on your link and I think I did a poor job explaining what I was looking for.

My current setup is like this:

Code: Select all

                                       <---PJON---> Arduino1 (Client)
Raspberry <---USB---> Arduino (Master) <---PJON---> Arduino2 (Client)
                                       <---PJON---> Arduino3 (Client)
So my Clients all talk via the PJON bus to my "Master" Arduino which in turn prints all data out via USB to my Raspberry. What I want is to keep this setup (or something like this) since it works quite nice and just swap out NodeRED with Domoticz. Therefore I need Domoticz to have some "Hardware" which receives data from my Master Arduino and sends new data out the same way.

My data is a custom string formatted like this:

Code: Select all

key1:value1;key2:value2
I do not mind writing Lua scripts to do the parsing and creating outgoing messages. I am just looking for something that listens on the USB port and processes incoming requests/sends out commands complying to the Arduino's baud rate.

I hope this clarifies my intentions better than before, it seems I did not even know, what I was asking :oops:
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Generic serial communication

Post by freijn »

Hi Mirodin

Much much better explanation ! :-)

Have a look at this one.

https://www.raspberrypi.org/forums/view ... p?t=106468

Grab the first example and run it and see if you get data.
If this runs, you need to map the data to an idx ( sensor target ) and do a json call to the domoticz.

However , search on python as well , I do see some PJON stuff but no PJON serial reciever.
mirodin
Posts: 7
Joined: Tuesday 25 February 2020 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Generic serial communication

Post by mirodin »

Thank you, I will check out your link. Unfortunately though I will not have time to try this until Friday next week but I will let you know how it went.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest