District warming

For heating/cooling related questions in Domoticz

Moderator: leecollings

Post Reply
remko2000
Posts: 165
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

District warming

Post by remko2000 »

I managed to read all the data from my Kamstrup 601. I now see, among other things, the total consumption in GJ. However, I also want to see what my daily consumption is. What is the simplest way to add this to domoticz with an extra dummy sensor?
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

If you use the proper Domoticz device you should see your daily consumption already.
What device do you use to monitor the heating?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
remko2000
Posts: 165
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: District warming

Post by remko2000 »

User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

Yes, that is a bummer... They instruct to make custom sensors instead of counters for Heating GJ.

Better try to have them change that.

Can you post a couple of JSON messages from your meter trough

Code: Select all

http://ip_address_gateway:82/kamst-ir/api/read
Lets see if we can make up something.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
remko2000
Posts: 165
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: District warming

Post by remko2000 »

yes that is exactly the problem. But isn't it possible to work around this with, for example, some kind of script that passes the volume of the current day to a separate day counter?
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

I am wondering what data this sensor creates. So that is why I asked for some sample jsons from you.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

The most interesting value is heat_energy. Is that an increasing value over days or is it reset to 0 every day?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
remko2000
Posts: 165
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: District warming

Post by remko2000 »

The rest api gives me this:
{"mac_address":"C0_49_EF_CE_E6_C4","gateway_model":"connectix_kamst-ir_gateway_v1.0","startup_time":"2024-01-27T19:05:12Z","firmware_running":"2024011002","firmware_available":"2024011002","firmware_update_available":"false","wifi_rssi":"-48","mqtt_configured":"false","heat_energy":"210.310","power":"0.000","temp1":"59.16","temp2":"51.24","tempdiff":"7.92","flow":"0.00","volume":"1491.420","minflow_m":"0.00","maxflow_m":"441.00","minflowdate_m":"240109.00","maxflowdate_m":"240109.00","minpower_m":"0.00","maxpower_m":"18.10","avgtemp2_m":"42.00","minpowerdate_m":"240101.00","maxpowerdate_m":"240109.00","minflow_y":"0.00","maxflow_y":"441.00","minflowdate_y":"240109.00","maxflowdate_y":"240109.00","minpower_y":"0.00","maxpower_y":"18.10","avgtemp1_y":"18.10","avgtemp2_y":"42.00","minpowerdate_y":"240101.00","maxpowerdate_y":"240109.00","temp1xm3":"109199.00","temp2xm3":"57580.00","infoevent":"1.00","hourcounter":"116625.00","power_act":""}
I think my kamstrup gives me every 900 sec a total of 'heat energy'
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

Thanks!
Now the issue is, what does "heat_energy":"210.310" mean? Is it the Energy used for today or the total Energy value from when this meter is running? Similar like your electricity counter in your house.

So if tomorrow it shows for example "heat_energy":"210.710" It means you have used 210.710-210.310=0.400 GJ today. Then we can use this value for a counter.
If it tomorrow shows "heat_energy":"10.710" it means it is reset at night and you need scripting to get something done here.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
remko2000
Posts: 165
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: District warming

Post by remko2000 »

210.310 is the total energy.
So if tomorrow it shows for example "heat_energy":"210.710" It means you have used 210.710-210.310=0.400 GJ today. Then we can use this value for a counter.
This is right.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

Ah OK that seems promising

Then you could make a Dummy Counter named Heating (or what you wish) see also https://www.domoticz.com/wiki/Dummy_for ... es#Counter
After creation, press on Edit and make it a Custom Counter (type = Counter)
Value Quantity: Heating Energy
Value Units: GJ
Counter divider: 1000 (this is important).

Add in your Lua parser script kamstrup.lua in /domoticz/scripts/lua_parsers the following. It could be that the multiply 1000 line gives an error as the value is a string and perhaps not recognized as a fractal. Please report back if it gives an error.

Code: Select all

local idx = [IDX of new Counter]
local heat_energy = domoticz_applyJsonPath(request['content'], '.heat_energy')
heat_energy = heat_energy * 1000
domoticz_updateDevice(idx, '' , heat_energy)
First value could be high as it could report complete history. you can delete this high value the next day (shift+ mouse click on value in the Graph) and then you have normal values.

When everything works well you can delete the custom sensor and the lua code that fills this custom sensor.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
remko2000
Posts: 165
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: District warming

Post by remko2000 »

Thx
what I have now

IDX 251 is called 'heat_energy' (and gives 210,31GJ)
IDX 263 is my new dummy, zie screenshot
Image

My code (in events, lua, type 'all'):

Code: Select all

local idx = 263
local heat_energy = domoticz_applyJsonPath(request['content'], '.heat_energy')
heat_energy = heat_energy * 1000
domoticz_updateDevice(idx, '251' , heat_energy)
I get an error:
' 2024-01-31 16:48:46.011 Error: EventSystem: in Dagtellerwarmte: [string "local idx = 263 ..."]:2: attempt to index a nil value (global 'request')'
Attachments
Scherm­afbeelding 2024-01-31 om 16.45.30.png
Scherm­afbeelding 2024-01-31 om 16.45.30.png (52.91 KiB) Viewed 1403 times
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

remko2000 wrote: Wednesday 31 January 2024 16:49 Thx
what I have now

IDX 251 is called 'heat_energy' (and gives 210,31GJ)
IDX 263 is my new dummy, zie screenshot
Image

My code (in events, lua, type 'all'):

Code: Select all

local idx = 263
local heat_energy = domoticz_applyJsonPath(request['content'], '.heat_energy')
heat_energy = heat_energy * 1000
domoticz_updateDevice(idx, '251' , heat_energy)
I get an error:
' 2024-01-31 16:48:46.011 Error: EventSystem: in Dagtellerwarmte: [string "local idx = 263 ..."]:2: attempt to index a nil value (global 'request')'

Code: Select all

domoticz_updateDevice(idx, '251' , heat_energy)
should be

Code: Select all

domoticz_updateDevice(idx, '' , heat_energy)
You will have 2 Devices showing the GJ values. If it all works you can remove device 251 and the script part belonging to it.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

Beside my previous remark. You should not create a new script!!!
You should modify the Lua parser script kamstrup.lua in /domoticz/scripts/lua_parsers that you created according this instruction: https://haprofs.com/kamstrup-multical-s ... -domoticz/
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
remko2000
Posts: 165
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: District warming

Post by remko2000 »

me wrong.

I changed it. Still error:
'2024-01-31 17:02:50.182 Error: EventSystem: in Dagtellerwarmte: [string "local idx = 263 ..."]:2: attempt to index a nil value (global 'request')'

Is LUA by events, type ' lua', type ' All' ......correct?
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

waltervl wrote: Wednesday 31 January 2024 17:03 Beside my previous remark. You should not create a new script!!!
You should modify the Lua parser script kamstrup.lua in /domoticz/scripts/lua_parsers that you created according this instruction: https://haprofs.com/kamstrup-multical-s ... -domoticz/
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
remko2000
Posts: 165
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: District warming

Post by remko2000 »

sorry.

I edit the script kamstrup.lua and add your script at the bottom. Now I get indeed:
Image

so far so good.....
Attachments
Scherm­afbeelding 2024-01-31 om 17.09.31.png
Scherm­afbeelding 2024-01-31 om 17.09.31.png (53.63 KiB) Viewed 1380 times
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

Lets let it run for at least 2 days.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: District warming

Post by waltervl »

So after 1 day, do you see some usage graphs in the log page now? Device page showing some normal results?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
connectix
Posts: 7
Joined: Thursday 01 September 2016 13:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: District warming

Post by connectix »

waltervl wrote: Wednesday 31 January 2024 16:21 Ah OK that seems promising

Then you could make a Dummy Counter named Heating (or what you wish) see also https://www.domoticz.com/wiki/Dummy_for ... es#Counter
After creation, press on Edit and make it a Custom Counter (type = Counter)
Value Quantity: Heating Energy
Value Units: GJ
Counter divider: 1000 (this is important).

Add in your Lua parser script kamstrup.lua in /domoticz/scripts/lua_parsers the following. It could be that the multiply 1000 line gives an error as the value is a string and perhaps not recognized as a fractal. Please report back if it gives an error.

Code: Select all

local idx = [IDX of new Counter]
local heat_energy = domoticz_applyJsonPath(request['content'], '.heat_energy')
heat_energy = heat_energy * 1000
domoticz_updateDevice(idx, '' , heat_energy)
First value could be high as it could report complete history. you can delete this high value the next day (shift+ mouse click on value in the Graph) and then you have normal values.

When everything works well you can delete the custom sensor and the lua code that fills this custom sensor.
Hi Walter!

Thanks for the script adjustments. I updated the instruction for the Kamstrup Multical for Domoticz so other users can benefit from it too.
Keep up the good work!

Greetings, Roel
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest