Page 2 of 2

Re: Water Meter, sensor type

Posted: Friday 21 April 2023 14:06
by flhoest
Thanks for the graph and the typo ;) Sorted !

Re: Water Meter, sensor type

Posted: Friday 21 April 2023 15:32
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 ?

Re: Water Meter, sensor type

Posted: Friday 21 April 2023 16:28
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 3920 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

Re: Water Meter, sensor type

Posted: Friday 21 April 2023 16:37
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

Re: Water Meter, sensor type

Posted: Friday 21 April 2023 16:55
by Kedi
Sorry, I really don't know anymore if I used the Meter Offset, I suppose so.

Re: Water Meter, sensor type

Posted: Friday 21 April 2023 17:31
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.

Re: Water Meter, sensor type

Posted: Friday 21 April 2023 19:45
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

Re: Water Meter, sensor type

Posted: Friday 21 April 2023 22:54
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

Re: Water Meter, sensor type

Posted: Saturday 22 April 2023 12:38
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 3862 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

Re: Water Meter, sensor type

Posted: Saturday 22 April 2023 14:31
by flhoest
Brilliant !

Re: Water Meter, sensor type

Posted: Monday 24 April 2023 8:48
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.

Re: Water Meter, sensor type

Posted: Sunday 16 July 2023 12:48
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

Re: Water Meter, sensor type

Posted: Sunday 16 July 2023 16:36
by flhoest
Since then, I did a blog post on my setup...

https://www.lets-talk-about.tech/2023/0 ... usage.html

Re: Water Meter, sensor type

Posted: Monday 17 July 2023 7:18
by gizmocuz
Another way (at least for Dutch meters) is to use a proximity sensor

https://github.com/gizmocuz/esp_proximity_sensor_mqtt

Re: Water Meter, sensor type

Posted: Thursday 07 November 2024 16:23
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

Re: Water Meter, sensor type

Posted: Thursday 07 November 2024 21:25
by FireWizard
Sure,

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

Regards

Re: Water Meter, sensor type

Posted: Friday 08 November 2024 10:53
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

Re: Water Meter, sensor type

Posted: Sunday 10 November 2024 16:26
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.

Re: Water Meter, sensor type

Posted: Sunday 10 November 2024 17:09
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