Page 1 of 1
Arduino data trough usb
Posted: Thursday 10 December 2020 22:09
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
Re: Arduino data trough usb
Posted: Friday 11 December 2020 0:43
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
Re: Arduino data trough usb
Posted: Friday 11 December 2020 1:08
by jacobsentertainment
Thanks a lot, it looks hopefull. Ill give it try tomorrow

Re: Arduino data trough usb
Posted: Monday 14 December 2020 20:15
by jacobsentertainment
Just a heads-up, it works like a charm

Tanks for the tip!
Re: Arduino data trough usb
Posted: Monday 14 December 2020 20:26
by waltervl
You're welcome, have fun

Re: Arduino data trough usb
Posted: Saturday 19 December 2020 12:45
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

)
So ill keep looking for a reliable temperature input to the system..
Re: Arduino data trough usb
Posted: Saturday 19 December 2020 13:51
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?
Re: Arduino data trough usb
Posted: Saturday 19 December 2020 14:22
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!
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
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.
Re: Arduino data trough usb
Posted: Saturday 19 December 2020 22:12
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.
Re: Arduino data trough usb
Posted: Saturday 19 December 2020 22:18
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..
Re: Arduino data trough usb
Posted: Monday 21 December 2020 11:46
by FlyingDomotic
Sorry,
I was quoting original message, asking help reading USB serial data to Domoticz.
Re: Arduino data trough usb
Posted: Monday 21 December 2020 11:52
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
Re: Arduino data trough usb
Posted: Monday 21 December 2020 12:47
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

nice one!