Arduino data trough usb

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Arduino data trough usb

Post by jacobsentertainment »

Hi all,

I'm working on some temperature sensors and a pressure sensor, I got this hooked up and so far working on my arduino mega and I can get the data over the usb/serial in to node-red and fetch it trough node-red mqtt to domoticz where I can read it in the log file.

The data i get from arduino is flexible and at the moment looks like

Code: Select all

21:55:08.530 -> ,Temp_1=27.87,Temp_2=20.06,Temp_3=26.94,Temp_3=26.44,Press_1=97
I can split this up in separate topics but I can't make it work in domoticz, I don't know how to connect an "idx" to an single topic.

I have seen some topics here and many point at "MySensors" but only solution i can find there is through a sender and I want to have these main sensors hard wired to my system.

I'm stuck here :? So if any of you have a good idea for me or have some good tutorial for me how to solve this issue
User avatar
waltervl
Posts: 5913
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Arduino data trough usb

Post by waltervl »

No mysensor user myself but you can use your Arduino as a mysensor serial gateway and add extra code for your hardwired sensors directly in the gateway Arduino sketch.
viewtopic.php?f=42&t=22929
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Arduino data trough usb

Post by jacobsentertainment »

Thanks a lot, it looks hopefull. Ill give it try tomorrow 😎
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Arduino data trough usb

Post by jacobsentertainment »

Just a heads-up, it works like a charm ;) Tanks for the tip!
User avatar
waltervl
Posts: 5913
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Arduino data trough usb

Post by waltervl »

You're welcome, have fun :-)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Arduino data trough usb

Post by jacobsentertainment »

Update on the topic, it doesn't work as fine as I would like to :? I stops working on and it f***s up my floor-heating e.a. the temperature readout stops updating and my domoticz thermostat just continues heating up the floor till max system temperature, this happened to me now 3 times. (always over night :x )
So ill keep looking for a reliable temperature input to the system..
User avatar
waltervl
Posts: 5913
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Arduino data trough usb

Post by waltervl »

Sorry to hear that, but this is also part of the fun: make it reliable....
You better ask the reliability question in the mysensors section of the domoticz forum or on the mysensors forum. It depends on the failure, is it on Domoticz or on the mysensor part?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Arduino data trough usb

Post by jacobsentertainment »

waltervl wrote: Saturday 19 December 2020 13:51 Sorry to hear that, but this is also part of the fun: make it reliable....
You better ask the reliability question in the mysensors section of the domoticz forum or on the mysensors forum. It depends on the failure, is it on Domoticz or on the mysensor part?
That's a good question! :D
I woke up this morning and noticed the high floor temperature and the first thing I did was putting the thermostat in to pause (hold) and after that I did an restart on the pi (this forces also domoticz to restart) but the temperatures didn't change so I reset the arduino to this helpe. By the time all was up to working again the log was empty :roll:

Does any of you know where the log is stored or can be recorded?
Also I posted the whole issue on "MySensor" Maybe they can help me out, I'm really not good in programming.
FlyingDomotic
Posts: 392
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Arduino data trough usb

Post by FlyingDomotic »

You may write a Python plugin that reads Arduino USB port data and do whatever you want on Domoticz sensor(s).

That's the way I do with an ESP8266 with EspNow to map few ESP PIR to Domoticz.

I may help if needed.
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Arduino data trough usb

Post by jacobsentertainment »

FlyingDomotic wrote: Saturday 19 December 2020 22:12 You may write a Python plugin that reads Arduino USB port data and do whatever you want on Domoticz sensor(s).

That's the way I do with an ESP8266 with EspNow to map few ESP PIR to Domoticz.

I may help if needed.
Not sure if I get the picture here.
I'm at the moment searching trough the lua part t see if can find a sample or so to check if the sensor is updating within a set time period if not it will switch the thermostat to pause..
FlyingDomotic
Posts: 392
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Arduino data trough usb

Post by FlyingDomotic »

Sorry,

I was quoting original message, asking help reading USB serial data to Domoticz.
FlyingDomotic
Posts: 392
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Arduino data trough usb

Post by FlyingDomotic »

To answer the last update date request, here's a small LUA function giving last update date delay in second for a device:

Code: Select all

function lastSeen(device)
  timestamp = otherdevices_lastupdate[device] or device
  y, m, d, H, M, S = timestamp:match("(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)")
  difference = os.difftime(os.time(), os.time{year=y, month=m, day=d, hour=H, min=M, sec=S})
  return difference
end
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Arduino data trough usb

Post by jacobsentertainment »

FlyingDomotic wrote: Monday 21 December 2020 11:52 To answer the last update date request, here's a small LUA function giving last update date delay in second for a device:

Code: Select all

function lastSeen(device)
  timestamp = otherdevices_lastupdate[device] or device
  y, m, d, H, M, S = timestamp:match("(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)")
  difference = os.difftime(os.time(), os.time{year=y, month=m, day=d, hour=H, min=M, sec=S})
  return difference
end
8-) nice one!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest