Water Meter, sensor type

Moderator: leecollings

User avatar
flhoest
Posts: 18
Joined: Tuesday 18 April 2023 19:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Belgium
Contact:

Re: Water Meter, sensor type

Post by flhoest »

Thanks for the graph and the typo ;) Sorted !
Fred
Using Domoticz on Raspberry 3B+ since 2018
Fan of automation, API and PhP.
User avatar
flhoest
Posts: 18
Joined: Tuesday 18 April 2023 19:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Belgium
Contact:

Re: Water Meter, sensor type

Post by flhoest »

Kedi wrote: Thursday 20 April 2023 18:27 I use the same "AI-on-the-edge-device" project for my Water meter.
I use NodeRed with this function to get data to Domoticz

Code: Select all

var IDX = global.get('idxTable','memoryOnly')['Water'].idx;
var msg1 = {};
var msg2 = {};
if (msg.payload.error == 'no error') {
    msg1.payload = { "command": "udevice", "idx": IDX, "svalue": msg.payload.value.toString()};
    msg2.payload = { "command": "addlogmessage", "message": "Water value: "+msg.payload.value.toString()};
} else {
    msg1.payload = { "command": "addlogmessage", "message": "Water ERROR: "+msg.payload.error};
//    msg2.payload = { "command": "sendnotification", "subject": "WATER ERROR!", "subsystem": "pushover", "body": msg.payload.error, "priority": 0};
}
//return msg;
return [[msg1, msg2]];
and have this Device in Domoticz.
20.04.2023_18.26.11_REC.png
This works fine with a nice history.
Hello Kedi,

Quick question, can you confirm the Meter Offset is used to tell the sensor not to start from 0 but from the current meter value ?
Fred
Using Domoticz on Raspberry 3B+ since 2018
Fan of automation, API and PhP.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water Meter, sensor type

Post by FireWizard »

Hello @flhoest,

In your first post you stated:
I'm using Domoticz since 2008, but I don't know why, I only register to this forum today ... don't ask me why ;)
I suggest you to read the Wiki and then also this page: https://www.domoticz.com/wiki/About_Domoticz

In the first paragraph, last line, you will see:
The first release of Domoticz was in december 2012.
So beside that you obviously use hardware, before this has been produced, you have also access to software, before its release.
That is special and maybe you want to share the future with us :)

Well, after the joke, please find also my graphs.

Screenshot_water_log.png
Screenshot_water_log.png (215.95 KiB) Viewed 1656 times
Just FYI,

Like @kedi, I use Node-RED as well, for the Watermeter.

I use the following Function node, before I send it to Domoticz with MQTT.

Code: Select all

let msg1 = {};
let msg2 = {};

if (msg.payload.hasOwnProperty("error")) {
    msg = null;
    return msg;
} else {
    msg1.payload = { "command": "udevice", "idx": 532, "nvalue": 0, "svalue": ((msg.payload.total_liter_m3) * 1000).toString() };
    msg2.payload = { "command": "udevice", "idx": 533, "nvalue": 0, "svalue": (msg.payload.active_liter_lpm).toString() };
return [[msg1,msg2]];
}
Important is that you send the value in liter (so you have multiply the m3 x1000). And to correct that again setup your global divider for water with 1000)

The Question to @Kedi: can you confirm the Meter Offset is used to tell the sensor not to start from 0 but from the current meter value ?

Yes I can, but I saw recently something new.

If I send a http request to the watermeter, I receive the following:

Code: Select all

msg.payload : Object
object
wifi_ssid: "Name "
wifi_strength: 100
total_liter_m3: 41.778
active_liter_lpm: 0
total_liter_offset_m3: 0
Previously "total_liter_offset_m3" was not available. So obviously you can set also the offset in the Home Wizard app. In that case, I assume, you should not use the offset in Domoticz. However, I have not been able to find that setting, yet.

Best regards
User avatar
flhoest
Posts: 18
Joined: Tuesday 18 April 2023 19:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Belgium
Contact:

Re: Water Meter, sensor type

Post by flhoest »

Hi There,

There are a lot of great contents here. I'm starting to go somewhere ... I'm doing further test, I will come back with my results !

Thanks everyone
Fred
Using Domoticz on Raspberry 3B+ since 2018
Fan of automation, API and PhP.
Kedi
Posts: 536
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Water Meter, sensor type

Post by Kedi »

Sorry, I really don't know anymore if I used the Meter Offset, I suppose so.
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
flhoest
Posts: 18
Joined: Tuesday 18 April 2023 19:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Belgium
Contact:

Re: Water Meter, sensor type

Post by flhoest »

If I'm passing the value in litre, it looks like the divider in the Domoticz setup should state 1000000 ... still playing around.
Fred
Using Domoticz on Raspberry 3B+ since 2018
Fan of automation, API and PhP.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water Meter, sensor type

Post by FireWizard »

Hi @flhoest,

You said
If I'm passing the value in litre, it looks like the divider in the Domoticz setup should state 1000000
That is a lot of water 1,000,000 is equal to 1,000 m3 of water.
If you have a swimming pool of 25 m long and 10 m. wide and 4 meter deep, it is 1,000 m3. This is quite a large and deep swimming pool.

See: https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's
Counter
/json.htm?type=command&param=udevice&idx=IDX&svalue=COUNTER
IDX = id of your device (this number can be found in the devices tab in the column "IDX")
COUNTER = Integer of the overall total counter (Energy, Volume, Custom).

When there is a counter created, there is a possibility to change the units by clicking on "Change" at the utility tab.

Energy (reports kWh), give COUNTER value in Wh, integer
Energy Generated (reports kWh). give COUNTER value in Wh, integer
Gas (reports m3) , give COUNTER value in liter (1000 liter = 1 m³), integer
Water (reports m3), give COUNTER value in liter (1000 liter = 1 m³), integer
Counter (no unit)
Time (min?), seems to be obsolete, use Counter instead and use the time units as desired (eg Sec, min, hrs)
The counter will be treated with the divider which is defined in the parameters in the application settings (menu setup-settings, tab counters). For example if the counter is set to "Water" and the value is passed as liters, the divider must set to 1000 (as the unit is m3). The device displays 2 values:
The status is the overall total volume (or counter).
The volume (or counter) of the day (in the top right corner).
The today's volume (or counter) is calculated from the total volume (or counter).
The global divider should be set to 1000 and you have to send the value to Domoticz in liters.
(So for Home Wizard you have to multiply it first with 1000, as you get the value in m3)

Regards

Regards
Last edited by FireWizard on Saturday 22 April 2023 8:20, edited 1 time in total.
User avatar
flhoest
Posts: 18
Joined: Tuesday 18 April 2023 19:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Belgium
Contact:

Re: Water Meter, sensor type

Post by flhoest »

Yes I initially did that, but if I'm sending the value in litre I'm getting millions of litre reported in the graph ... this is weird.
I know that 1000 liters = 1 m3 ;)

My actual value on the meter is 01617.485 (m3)
the "." which is here the decimal divider on my meter.
I have set the meter offset of the sensor to that value. Then each consecutive reading of the value are sent to the sensor. I'm reading a new value every 3 mins and I'm pushing it every 5 mins.
The graph in Domoticz does not seems to be consistent.

It might be decimal separator issue actually since the value should be sent in liter, I have removed the decimal point on my meter reading facility :
Decimal Shift = 0
Fred
Using Domoticz on Raspberry 3B+ since 2018
Fan of automation, API and PhP.
Kedi
Posts: 536
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Water Meter, sensor type

Post by Kedi »

This is my image from the AI project. The value of "666933.70" is send to the Domoticz device.
22.04.2023_12.32.59_REC.png
22.04.2023_12.32.59_REC.png (195.25 KiB) Viewed 1598 times
Decimal shift is 0, so I am sending liters, up to an accuracy of 10 ml.
Rounded by Domoticz to liters.
All with the above Nodered function.
In Domoticz with a water counter divider of 1000 because costs are in €/m3
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
flhoest
Posts: 18
Joined: Tuesday 18 April 2023 19:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Belgium
Contact:

Re: Water Meter, sensor type

Post by flhoest »

Brilliant !
Fred
Using Domoticz on Raspberry 3B+ since 2018
Fan of automation, API and PhP.
User avatar
flhoest
Posts: 18
Joined: Tuesday 18 April 2023 19:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Belgium
Contact:

Re: Water Meter, sensor type

Post by flhoest »

Thanks a lot to everyone assisting on this topic. I'm starting to have relevant figures.
I have noticed the accuracy of the usage graph is "per hour". Is there a way to have better accuracy ? like every 10 mins ?
Thanks again.
I'm preparing a blog post on that topic.
Fred
Using Domoticz on Raspberry 3B+ since 2018
Fan of automation, API and PhP.
Drees
Posts: 8
Joined: Monday 06 June 2022 16:00
Target OS: Windows
Domoticz version:
Contact:

Re: Water Meter, sensor type

Post by Drees »

FireWizard wrote: Friday 21 April 2023 16:28 Previously "total_liter_offset_m3" was not available. So obviously you can set also the offset in the Home Wizard app. In that case, I assume, you should not use the offset in Domoticz. However, I have not been able to find that setting, yet.

Best regards
I was also searching why it is always 0.
After a look at the page, it said

Data points for HWE-WTR

total_liter_offset_m3 - Number - 'The usage of this value is in development and should not be used'
Source: https://homewizard-energy-api.readthedo ... oints.html

So it looks like it is under construction
User avatar
flhoest
Posts: 18
Joined: Tuesday 18 April 2023 19:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Belgium
Contact:

Re: Water Meter, sensor type

Post by flhoest »

Since then, I did a blog post on my setup...

https://www.lets-talk-about.tech/2023/0 ... usage.html
Fred
Using Domoticz on Raspberry 3B+ since 2018
Fan of automation, API and PhP.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Water Meter, sensor type

Post by gizmocuz »

Another way (at least for Dutch meters) is to use a proximity sensor

https://github.com/gizmocuz/esp_proximity_sensor_mqtt
Quality outlives Quantity!
ilkaskim
Posts: 19
Joined: Friday 20 August 2021 2:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Germany
Contact:

Re: Water Meter, sensor type

Post by ilkaskim »

FireWizard wrote: Friday 21 April 2023 16:28 Hello @flhoest,

In your first post you stated:
I'm using Domoticz since 2008, but I don't know why, I only register to this forum today ... don't ask me why ;)
I suggest you to read the Wiki and then also this page: https://www.domoticz.com/wiki/About_Domoticz

In the first paragraph, last line, you will see:
The first release of Domoticz was in december 2012.
So beside that you obviously use hardware, before this has been produced, you have also access to software, before its release.
That is special and maybe you want to share the future with us :)

Well, after the joke, please find also my graphs.


Screenshot_water_log.png

Just FYI,

Like @kedi, I use Node-RED as well, for the Watermeter.

I use the following Function node, before I send it to Domoticz with MQTT.

Code: Select all

let msg1 = {};
let msg2 = {};

if (msg.payload.hasOwnProperty("error")) {
    msg = null;
    return msg;
} else {
    msg1.payload = { "command": "udevice", "idx": 532, "nvalue": 0, "svalue": ((msg.payload.total_liter_m3) * 1000).toString() };
    msg2.payload = { "command": "udevice", "idx": 533, "nvalue": 0, "svalue": (msg.payload.active_liter_lpm).toString() };
return [[msg1,msg2]];
}
Important is that you send the value in liter (so you have multiply the m3 x1000). And to correct that again setup your global divider for water with 1000)

The Question to @Kedi: can you confirm the Meter Offset is used to tell the sensor not to start from 0 but from the current meter value ?

Yes I can, but I saw recently something new.

If I send a http request to the watermeter, I receive the following:

Code: Select all

msg.payload : Object
object
wifi_ssid: "Name "
wifi_strength: 100
total_liter_m3: 41.778
active_liter_lpm: 0
total_liter_offset_m3: 0
Previously "total_liter_offset_m3" was not available. So obviously you can set also the offset in the Home Wizard app. In that case, I assume, you should not use the offset in Domoticz. However, I have not been able to find that setting, yet.

Best regards

hello @Firewizard

Could you please provide the flow of how you implemented it to send the data to domoticz.
greeting
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water Meter, sensor type

Post by FireWizard »

Sure,

I will do that, as soon as I'm behind my computer.

Regards
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water Meter, sensor type

Post by FireWizard »

Hereby the promised flow:

Code: Select all

[
    {
        "id": "4d135b728ec17b22",
        "type": "http request",
        "z": "1ac5277b4a20d52c",
        "name": "HTTP Watermeter",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://192.168.10.115/api/v1/data",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 390,
        "y": 80,
        "wires": [
            [
                "71a2b6594fb9fbcb"
            ]
        ]
    },
    {
        "id": "1a06699e862880bf",
        "type": "inject",
        "z": "1ac5277b4a20d52c",
        "name": "Inject 1 min",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "60",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 170,
        "y": 80,
        "wires": [
            [
                "4d135b728ec17b22"
            ]
        ]
    },
    {
        "id": "7b9afc0f16d83c2e",
        "type": "mqtt out",
        "z": "1ac5277b4a20d52c",
        "name": "To Domoticz",
        "topic": "domoticz/in",
        "qos": "2",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "f8a872af.a6898",
        "x": 910,
        "y": 80,
        "wires": []
    },
    {
        "id": "71a2b6594fb9fbcb",
        "type": "function",
        "z": "1ac5277b4a20d52c",
        "name": "Calculate Waterflow/usage",
        "func": "let msg1 = {};\nlet msg2 = {};\n\nif (msg.payload.hasOwnProperty(\"error\")) {\n    msg = null;\n    return msg;\n} else {\n    msg1.payload = { \"command\": \"udevice\", \"idx\": 532, \"nvalue\": 0, \"svalue\": ((msg.payload.total_liter_m3) * 1000).toString() };\n    msg2.payload = { \"command\": \"udevice\", \"idx\": 533, \"nvalue\": 0, \"svalue\": (msg.payload.active_liter_lpm).toString() };\nreturn [[msg1,msg2]];\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 660,
        "y": 80,
        "wires": [
            [
                "7b9afc0f16d83c2e"
            ]
        ]
    },
    {
        "id": "f8a872af.a6898",
        "type": "mqtt-broker",
        "name": "Jonas_MQTT_Server",
        "broker": "mqtt.jonasnet.nl",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]
Do not forget to change the IP address in the HTTP request node to your own needs and that the IDX numbers in line 8 and 9 in the Function node match with your virtual IDX's in Domoticz.

Regards
ilkaskim
Posts: 19
Joined: Friday 20 August 2021 2:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Germany
Contact:

Re: Water Meter, sensor type

Post by ilkaskim »

FireWizard wrote: Friday 08 November 2024 10:53 Hereby the promised flow:

Code: Select all

[
    {
        "id": "4d135b728ec17b22",
        "type": "http request",
        "z": "1ac5277b4a20d52c",
        "name": "HTTP Watermeter",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://192.168.10.115/api/v1/data",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 390,
        "y": 80,
        "wires": [
            [
                "71a2b6594fb9fbcb"
            ]
        ]
    },
    {
        "id": "1a06699e862880bf",
        "type": "inject",
        "z": "1ac5277b4a20d52c",
        "name": "Inject 1 min",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "60",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 170,
        "y": 80,
        "wires": [
            [
                "4d135b728ec17b22"
            ]
        ]
    },
    {
        "id": "7b9afc0f16d83c2e",
        "type": "mqtt out",
        "z": "1ac5277b4a20d52c",
        "name": "To Domoticz",
        "topic": "domoticz/in",
        "qos": "2",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "f8a872af.a6898",
        "x": 910,
        "y": 80,
        "wires": []
    },
    {
        "id": "71a2b6594fb9fbcb",
        "type": "function",
        "z": "1ac5277b4a20d52c",
        "name": "Calculate Waterflow/usage",
        "func": "let msg1 = {};\nlet msg2 = {};\n\nif (msg.payload.hasOwnProperty(\"error\")) {\n    msg = null;\n    return msg;\n} else {\n    msg1.payload = { \"command\": \"udevice\", \"idx\": 532, \"nvalue\": 0, \"svalue\": ((msg.payload.total_liter_m3) * 1000).toString() };\n    msg2.payload = { \"command\": \"udevice\", \"idx\": 533, \"nvalue\": 0, \"svalue\": (msg.payload.active_liter_lpm).toString() };\nreturn [[msg1,msg2]];\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 660,
        "y": 80,
        "wires": [
            [
                "7b9afc0f16d83c2e"
            ]
        ]
    },
    {
        "id": "f8a872af.a6898",
        "type": "mqtt-broker",
        "name": "Jonas_MQTT_Server",
        "broker": "mqtt.jonasnet.nl",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]
Do not forget to change the IP address in the HTTP request node to your own needs and that the IDX numbers in line 8 and 9 in the Function node match with your virtual IDX's in Domoticz.

Regards
Thanks, I'll take a look at what I can improve on.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water Meter, sensor type

Post by FireWizard »

Okay,

At least you can add the RSSI (wifi_strength).
This can be useful, dependant on your local situation.

When I bought the unit, offset was not available at that time.
But it is not a variable.

Success and let it know.

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests