Data Logging

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
User avatar
michaldobrotka
Posts: 50
Joined: Sunday 01 November 2015 17:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Data Logging

Post by michaldobrotka »

Hi Guys,
Is it possible to log my data readings (temperature and humidity) from Domoticz running on Raspberry Pi into internal folder or to LAN attached NAS storage (no external service). I need just hourly log with time stamp in some kind of text file.I have been searching on forum with no success.
Thanks a lot for suggestions.
Domoticz on Raspi 3 and slave on ZeroW (running only with Broadlink plugin), Serial Mysensors GW on Arduino nano, Broadlink RM2, Rehau CO2 USB Stick, RF link 433 MHz, 2x Amazon Echo Dot (Controlicz), ESP2866 witk Espeasy, Sonoff
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Data Logging

Post by emme »

what about a script that write a file?
somthing like:

Code: Select all

return {
	on = {
		timer = {
			'every minutes'
		}
	},
	execute = function(domoticz, device)
		local devName = domoticz.devices('myTempHumidDeviceName')
		local fileName = '/path/to/folder/filename.csv'
		local timeStamp = os.date('*t')
		
		fileOut = io.open(fileName, 'a')
		fileOut:write(timeStamp..','..devName.temparature..','..devName.humidity..'\n')
        fileOut:close()
	end
}
The most dangerous phrase in any language is:
"We always done this way"
User avatar
michaldobrotka
Posts: 50
Joined: Sunday 01 November 2015 17:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Data Logging

Post by michaldobrotka »

Thanks emme, I will try it.
Domoticz on Raspi 3 and slave on ZeroW (running only with Broadlink plugin), Serial Mysensors GW on Arduino nano, Broadlink RM2, Rehau CO2 USB Stick, RF link 433 MHz, 2x Amazon Echo Dot (Controlicz), ESP2866 witk Espeasy, Sonoff
User avatar
michaldobrotka
Posts: 50
Joined: Sunday 01 November 2015 17:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Data Logging

Post by michaldobrotka »

Hi emme,
Checked dzVents and changed your script to :

Code: Select all

return {
	on = {
		timer = {
			'every hour'
		}
	},
	execute = function(domoticz, device)
		local devName = domoticz.devices('Terrarium ground')
		local fileName = '/home/domoticz/scripts/Datalogger/Terarriumgroundtemp.csv'
		local timeStamp = os.date('*t')
		
		fileOut = io.open(fileName, 'a')
		fileOut:write(timeStamp..','..devName.temparature..','..devName.humidity..'\n')
        fileOut:close()
	end
}
.csv file was created, but no logs were written after hour.
Am I missing something in script?
Thanks
Domoticz on Raspi 3 and slave on ZeroW (running only with Broadlink plugin), Serial Mysensors GW on Arduino nano, Broadlink RM2, Rehau CO2 USB Stick, RF link 433 MHz, 2x Amazon Echo Dot (Controlicz), ESP2866 witk Espeasy, Sonoff
User avatar
mack
Posts: 14
Joined: Friday 08 April 2016 8:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Dallas, USA
Contact:

Re: Data Logging

Post by mack »

michaldobrotka wrote: Thursday 02 November 2017 11:07Checked dzVents and changed your script to :
I didn't check your script logic, but wanted to point out for dzVents to be enabled, the checkbox for dzVents needs to be UNchecked.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest