Re: Water Meter, sensor type
Posted: Friday 21 April 2023 14:06
Thanks for the graph and the typo
Sorted !
Hello Kedi,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 Domoticzand have this Device in 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]];
20.04.2023_18.26.11_REC.png
This works fine with a nice history.
I suggest you to read the Wiki and then also this page: https://www.domoticz.com/wiki/About_DomoticzI'm using Domoticz since 2008, but I don't know why, I only register to this forum today ... don't ask me why
So beside that you obviously use hardware, before this has been produced, you have also access to software, before its release.The first release of Domoticz was in december 2012.
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]];
}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: 0That is a lot of water 1,000,000 is equal to 1,000 m3 of water.If I'm passing the value in litre, it looks like the divider in the Domoticz setup should state 1000000
The global divider should be set to 1000 and you have to send the value to Domoticz in liters.Counter
/json.htm?type=command¶m=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).
I was also searching why it is always 0.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
FireWizard wrote: Friday 21 April 2023 16:28 Hello @flhoest,
In your first post you stated:
I suggest you to read the Wiki and then also this page: https://www.domoticz.com/wiki/About_DomoticzI'm using Domoticz since 2008, but I don't know why, I only register to this forum today ... don't ask me why
In the first paragraph, last line, you will see:
So beside that you obviously use hardware, before this has been produced, you have also access to software, before its release.The first release of Domoticz was in december 2012.
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.
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)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]]; }
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:
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.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
Best regards
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": ""
}
]Thanks, I'll take a look at what I can improve on.FireWizard wrote: Friday 08 November 2024 10:53 Hereby the promised flow:
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.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": "" } ]
Regards