Working: Gasmetersensor based on Kaku doorsensor (15 euros)

Moderator: leecollings

Kubra
Posts: 22
Joined: Wednesday 01 April 2015 22:06
Target OS: NAS (Synology & others)
Domoticz version: latest
Location: Hollanda
Contact:

Re: Working: Gasmetersensor based on Kaku doorsensor (15 euros)

Post by Kubra »

Set local switchName = "Contacteur Gaz" to local switchName = "gaz"?
Polygontrauma
Posts: 6
Joined: Sunday 28 August 2016 12:48
Target OS: -
Domoticz version:
Contact:

Re: Working: Gasmetersensor based on Kaku doorsensor (15 euros)

Post by Polygontrauma »

I followed your instructions exactly, but it won't work. Switch itself does work, counter and switch are named as in youre example, and I've adapted the idx and the file path in the script.
Then I pasted the following line after "On Action" and "Off Action" of the door switch: script://home/pi/domoticz/scripts/lua/script_device_gaspuls.lua
I get no errors, can watch the switch turn on/off, but the counter still says 0.
What am I doing wrong?
davidmarli
Posts: 8
Joined: Tuesday 02 February 2016 10:36
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Working: Gasmetersensor based on Kaku doorsensor (15 euros)

Post by davidmarli »

Hi,

just buy and install this kaku sensor. All is working fine with domoticz except the display .
On the first page I see "today" on the plugin display in domoticz web interface, but on my web interface not ...
And it counts 1 only when 1m^3 is used !!!
I would like that counter counts every pulse... Because on the graph it says always 0 m^3 used ... (I use appoximely 0,7m^3 gas a day ...)

Thank you to help me improve display ...
georon
Posts: 13
Joined: Friday 23 February 2018 14:09
Target OS: Raspberry Pi / ODroid
Domoticz version: Bèta
Location: Netherlands
Contact:

Re: Working: Gasmetersensor based on Kaku doorsensor (15 euros)

Post by georon »

Great!
I was wondering more than a year now how to get readings of my (belgian) Gas meter that stands outside the house.

I currently rushed off today to get this working.
Broke the glass of the reed contact when trying to get it to read the gas meter. Bummer.

I will also attach a 2xAA battery unit in the future so it will last somewhat longer than a few weeks (I guess that should do the trick...)

So I need to order a new reed contact.
And asked a friend to 3D print one of these for me:
https://www.thingiverse.com/thing:1949041
https://www.thingiverse.com/thing:2749173

My dzVents script approach for this:

Code: Select all

--[[
	Prerequisites
	==================================
	Domoticz v3.8837 or later (dzVents version 2.4 or later)
	User Variable named UV_GasMeter type float, that holds value of the gas meter
    Dummy switches that match the variables beneath

	CHANGE LOG: See https://github.com/Geo-Ron/dzVents/commits/master/dzUtilityMeters.lua


]]--


 local scriptVersion = '1.2.29'
 local inspiredByUrl = 'https://www.domoticz.com/forum/viewtopic.php?f=14&t=1641'
 local inspiredByAuthor = 'pwhooftman'
 
---- Variables to match dummy switches withing Domoticz
 local GasMeterUserVariableName   = 'UV_GasMeter' -- User Variable type Float that holds the current meter reading
 local GasPulseSensorName         = 'Gasmeter_Sensor' -- Actual Gas Pulse Sensor
 local GasMeterName         	  = 'Gasmeter' -- Dummy Counter or Gas device 
 local UpdateType                 = 'Gas' -- Possible values: Gas or Counter type device
 local devicecorrectionfactor     = 1000
 
 
----- End Variables
 
 return {
	logging = {
		--level = domoticz.LOG_DEBUG, -- Uncomment to override the dzVents global logging setting
		marker = 'dzUtilityMeters v'..scriptVersion
	},
	on = {
		-- timer = {
			-- 'every minute'
		-- },
		devices = {
			GasPulseSensorName
		}
	},
	execute = function(domoticz, item)

    local CurrentGasMeterValue = domoticz.variables(GasMeterUserVariableName).value
	

        if (item.isDevice) then
            -- Run Only if a device has changed on the Domoticz side...
            -- Note that the OpenURL call is made AFTER the script has finished
            domoticz.log('Device '.. item.name ..' changed.', domoticz.LOG_DEBUG)
            --Run when device Changed
		    --domoticz.openURL(string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', ToonIP, device.SetPoint*100))
		    --item.dump()
		    if item.name == GasPulseSensorName and item.state == 'Open' then
		        --local NewToonSetPoint = domoticz.utils.round(item.setPoint, 2)
				local NewGasMeterValue = CurrentGasMeterValue + 0.01
    		    domoticz.log('Updating Gasmeter to '.. NewGasMeterValue, domoticz.LOG_DEBUG)
    		    --Update Variable in m3
    		    if UpdateType == 'Gas' then
    		        --Update Device in dm3
				    domoticz.devices(GasMeterName).updateGas(NewGasMeterValue*devicecorrectionfactor)
				else
				    --Update Total to m3
				    domoticz.devices(GasMeterName).updateCounter(NewGasMeterValue)
				end
				--Update UV
				domoticz.variables(GasMeterUserVariableName).set(NewGasMeterValue)
			else
			    domoticz.log('Not updating GasMeter. Pulse device state is '..item.state, domoticz.LOG_DEBUG)
			end
            
		end
	end
}
 
   
thaui
Posts: 58
Joined: Sunday 15 March 2015 19:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Hamburg
Contact:

Re: Working: Gasmetersensor based on Kaku doorsensor (15 euros)

Post by thaui »

georon wrote: Saturday 26 January 2019 20:52 Great!
I was wondering more than a year now how to get readings of my (belgian) Gas meter that stands outside the house.

I currently rushed off today to get this working.
Broke the glass of the reed contact when trying to get it to read the gas meter. Bummer.

I will also attach a 2xAA battery unit in the future so it will last somewhat longer than a few weeks (I guess that should do the trick...)

So I need to order a new reed contact.
And asked a friend to 3D print one of these for me:
https://www.thingiverse.com/thing:1949041
https://www.thingiverse.com/thing:2749173

My dzVents script approach for this:

Code: Select all

--[[
	Prerequisites
	==================================
	Domoticz v3.8837 or later (dzVents version 2.4 or later)
	User Variable named UV_GasMeter type float, that holds value of the gas meter
    Dummy switches that match the variables beneath

	CHANGE LOG: See https://github.com/Geo-Ron/dzVents/commits/master/dzUtilityMeters.lua


]]--


 local scriptVersion = '1.2.29'
 local inspiredByUrl = 'https://www.domoticz.com/forum/viewtopic.php?f=14&t=1641'
 local inspiredByAuthor = 'pwhooftman'
 
---- Variables to match dummy switches withing Domoticz
 local GasMeterUserVariableName   = 'UV_GasMeter' -- User Variable type Float that holds the current meter reading
 local GasPulseSensorName         = 'Gasmeter_Sensor' -- Actual Gas Pulse Sensor
 local GasMeterName         	  = 'Gasmeter' -- Dummy Counter or Gas device 
 local UpdateType                 = 'Gas' -- Possible values: Gas or Counter type device
 local devicecorrectionfactor     = 1000
 
 
----- End Variables
 
 return {
	logging = {
		--level = domoticz.LOG_DEBUG, -- Uncomment to override the dzVents global logging setting
		marker = 'dzUtilityMeters v'..scriptVersion
	},
	on = {
		-- timer = {
			-- 'every minute'
		-- },
		devices = {
			GasPulseSensorName
		}
	},
	execute = function(domoticz, item)

    local CurrentGasMeterValue = domoticz.variables(GasMeterUserVariableName).value
	

        if (item.isDevice) then
            -- Run Only if a device has changed on the Domoticz side...
            -- Note that the OpenURL call is made AFTER the script has finished
            domoticz.log('Device '.. item.name ..' changed.', domoticz.LOG_DEBUG)
            --Run when device Changed
		    --domoticz.openURL(string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', ToonIP, device.SetPoint*100))
		    --item.dump()
		    if item.name == GasPulseSensorName and item.state == 'Open' then
		        --local NewToonSetPoint = domoticz.utils.round(item.setPoint, 2)
				local NewGasMeterValue = CurrentGasMeterValue + 0.01
    		    domoticz.log('Updating Gasmeter to '.. NewGasMeterValue, domoticz.LOG_DEBUG)
    		    --Update Variable in m3
    		    if UpdateType == 'Gas' then
    		        --Update Device in dm3
				    domoticz.devices(GasMeterName).updateGas(NewGasMeterValue*devicecorrectionfactor)
				else
				    --Update Total to m3
				    domoticz.devices(GasMeterName).updateCounter(NewGasMeterValue)
				end
				--Update UV
				domoticz.variables(GasMeterUserVariableName).set(NewGasMeterValue)
			else
			    domoticz.log('Not updating GasMeter. Pulse device state is '..item.state, domoticz.LOG_DEBUG)
			end
            
		end
	end
}
 
   
Thanks, this is a very helpfull script. More precise than all the devices offered with ESP32. I am using it with a NeoCool Zwave doorsensor.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest