Watermeter through GPIO and TCRT5000

Moderator: leecollings

User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Watermeter through GPIO and TCRT5000

Post by sincze »

joostnl wrote:Can someone write me a step guide to install, Isrcounter.
My script for water is working only i want to make it more accurate

It was a bit hidden I have to agree :D
viewtopic.php?f=32&t=3151&start=60#p112272
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
heggink
Posts: 980
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Watermeter through GPIO and TCRT5000

Post by heggink »

I attached the tcrt through espeasy to domoticz. I experience a weird consistenr ~6% higher reading in domoticz than the real consumption. Consistent enough to make me wonder if it's really the reflection meter edge that could cause it. Any thoughts?

H
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Watermeter through GPIO and TCRT5000

Post by sincze »

heggink wrote:I attached the tcrt through espeasy to domoticz. I experience a weird consistenr ~6% higher reading in domoticz than the real consumption. Consistent enough to make me wonder if it's really the reflection meter edge that could cause it. Any thoughts?

H
Did you connect directly to EspEasy or also used a resistor (pull down).
I know that having this sensor exposed to external light (lightning) will increase the usage as well.
So I covered mine. I am not using the Espeasy though and have been running the tcrt5000 for 2 years now.
It works like a Swiss clock. :D
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
heggink
Posts: 980
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Watermeter through GPIO and TCRT5000

Post by heggink »

Turned out that the esp module was faulty and generated lots of bogus counts. Probably a broken lead somewhere which was really difficult to track down.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
pvangorp
Posts: 70
Joined: Tuesday 28 March 2017 10:18
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest B
Location: The Netherlands
Contact:

Re: Watermeter through GPIO and TCRT5000

Post by pvangorp »

commandArray = {}

print('> Monitoring water consumption')

-- Water usage
-- Retrieve value from water meter device:
sWaterUsage = otherdevices_svalues['Water']

-- To have a better readable format, divide number by 1000:
sWaterUsagePrint = tonumber(sWaterUsage / 1000);

-- calculation is done with the unmodified water value
sWaterUsage = tonumber(sWaterUsage);

print(">> Utilities: Water usage until now is " .. sWaterUsagePrint .. " ");

if (devicechanged['GPIO_WATER'] == 'Close')
then
sWaterUsageTot = (sWaterUsage + 1)

print(">> Utilities: Water usage is now " .. sWaterUsageTot .. " ");
commandArray['UpdateDevice'] = '164|0|'..sWaterUsageTot..''
end

return commandArray
I changed the code in red. This function is designed for it. When using a test and production environment you don't need to update the IP address.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest