Page 2 of 2

Re: DzVents script suggestions please

Posted: Sunday 03 December 2023 12:15
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.

Re: DzVents script suggestions please

Posted: Sunday 03 December 2023 13:05
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 :-)

Re: DzVents script suggestions please

Posted: Tuesday 05 December 2023 12:32
by HvdW
Here is the result of my programming.
gas.jpg
gas.jpg (42.37 KiB) Viewed 919 times
@waltervl mentioned 'gewogen graaddagen'.
Here is an older post about integration of weighted degree days in Domoticz..

Re: DzVents script suggestions please

Posted: Tuesday 05 December 2023 13:59
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

Re: DzVents script suggestions please

Posted: Thursday 07 December 2023 11:46
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.

Re: DzVents script suggestions please

Posted: Thursday 07 December 2023 17:40
by waltervl
You are not able to change the icon to a Gas meter with the edit button?

Re: DzVents script suggestions please

Posted: Thursday 07 December 2023 21:19
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.

Re: DzVents script suggestions please

Posted: Thursday 07 December 2023 22:29
by waltervl
Indeed, I tested it in latest beta and no gas meter icon available for custom sensor.