DzVents script suggestions please  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

HvdW
Posts: 616
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: DzVents script suggestions please

Post by HvdW »

Correct @willemd
I changed the script once more and now I get the values of 24 hours before.

Code: Select all

return {
	active = true,
	on = {
		timer = { 'at *:05' },           -- every minute for testing, every hour when active
		httpResponses = { 'GasmeterRetrieved' }     -- matches callback string below
	},
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'http://192.168.1.1:8080/json.htm?type=command&param=graph&sensor=counter&idx=16&range=day',
				method = 'GET',
				callback = 'GasmeterRetrieved'
			})

		elseif (item.isHTTPResponse) then
			if (item.ok and item.isJSON) then 
				domoticz.utils.dumpTable(item.json)   -- dumpTable laat alle waarden zien, mooi voor debugging
				domoticz.devices('Gas yesterday').updateGas(item.json.result[25].mu*1000)
			else
				-- oops
				domoticz.log('Error fetching Gasmeter data', domoticz.LOG_ERROR)
				domoticz.log(item.data, domoticz.LOG_ERROR)
			end
		end
	end
}
What's the value of knowing yesterdays' value?
It's nice to know and external circumstances are in my mind, so I don't need to calculate that.
My daily results show in mindergas.nl which calculates by using 'gewogen graaddagen'.

The best result of this excercise is to be happy programming and learn a bit more about Domoticz.
Bugs bug me.
willemd
Posts: 659
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: DzVents script suggestions please

Post by willemd »

HvdW wrote: Sunday 03 December 2023 12:15 ...

The best result of this excercise is to be happy programming and learn a bit more about Domoticz.
I fully understand :-)
HvdW
Posts: 616
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: DzVents script suggestions please

Post by HvdW »

Here is the result of my programming.
gas.jpg
gas.jpg (42.37 KiB) Viewed 914 times
@waltervl mentioned 'gewogen graaddagen'.
Here is an older post about integration of weighted degree days in Domoticz..
Bugs bug me.
User avatar
waltervl
Posts: 5890
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: DzVents script suggestions please

Post by waltervl »

I personally would have put these extra values yesterday and day before yesterday in a custom sensor device for easier display https://www.domoticz.com/wiki/Dummy_for ... tom_Sensor
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
HvdW
Posts: 616
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: DzVents script suggestions please

Post by HvdW »

waltervl wrote: Tuesday 05 December 2023 13:59 I personally would have put these extra values yesterday and day before yesterday in a custom sensor device for easier display https://www.domoticz.com/wiki/Dummy_for ... tom_Sensor
You're right @waltervl, the tile has a more tidy look.
Which raises the next question.
Where or how can I find the gasmeter icon to add that to the CustomSensor.

In general: I'd like to have the full choice of preloaded Domoticz icons for every type of tile.
Is that possible for a next version (2024.1) or can it be achieved with some kind of trick in the current version.
Bugs bug me.
User avatar
waltervl
Posts: 5890
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: DzVents script suggestions please

Post by waltervl »

You are not able to change the icon to a Gas meter with the edit button?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
HvdW
Posts: 616
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: DzVents script suggestions please

Post by HvdW »

waltervl wrote: Thursday 07 December 2023 17:40 You are not able to change the icon to a Gas meter with the edit button?
Not for a Custom sensor. The gas choice dormant pop up.
Bugs bug me.
User avatar
waltervl
Posts: 5890
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: DzVents script suggestions please

Post by waltervl »

Indeed, I tested it in latest beta and no gas meter icon available for 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest