Domoticz & Gas usage on LCD
Moderator: leecollings
-
- Posts: 5
- Joined: Monday 01 January 2024 21:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Domoticz & Gas usage on LCD
Hello
I have Gas counter made on Counter incremental in Utility - it works well.
Few days ago I connected LCD 20x4, where I send some parameters , like temperatures or pressure and it's OK, but when i tried to send actual daily gas usage from counter incremental I bumped into some problems.
Eg. today's gas usage is 4,5 m3, but I can see sth like that 018446744073709187545 on LCD screen.
What should I use in dzVents or lua to to see proper value on LCD?
I have Gas counter made on Counter incremental in Utility - it works well.
Few days ago I connected LCD 20x4, where I send some parameters , like temperatures or pressure and it's OK, but when i tried to send actual daily gas usage from counter incremental I bumped into some problems.
Eg. today's gas usage is 4,5 m3, but I can see sth like that 018446744073709187545 on LCD screen.
What should I use in dzVents or lua to to see proper value on LCD?
-
- Posts: 661
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Domoticz & Gas usage on LCD
in dzVents domoticz.devices(IDX),counterToday should do it. (replacing IDX by the number of the device).
What do you see if you print that value to the logfile? And do you see something different on your LCD?
What do you see if you print that value to the logfile? And do you see something different on your LCD?
-
- Posts: 5
- Joined: Monday 01 January 2024 21:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Domoticz & Gas usage on LCD
I thought about counterToday value.
when i used
Now I see value 018446744073709187545 like in a logfile , not like 4,5 (as shows CounterToday)
Could you show me an example?
when i used
i saw the value of Counter & CounterToday, but i didn't know how to do to show counterToday value on my LCD./js...htm?type=devices&rid=IDX
Now I see value 018446744073709187545 like in a logfile , not like 4,5 (as shows CounterToday)
Could you show me an example?
-
- Posts: 661
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Domoticz & Gas usage on LCD
This is a small dzVents script that prints the counterToday value to the logfile (in the example of device with idx 105)
If you add a line that updates the LCD with the value domoticz.devices(idxOfCounter).counterToday then it should work.
How to do that is up to you. I don't know the interface towards that LCD screen.
If you add a line that updates the LCD with the value domoticz.devices(idxOfCounter).counterToday then it should work.
How to do that is up to you. I don't know the interface towards that LCD screen.
Code: Select all
local idxOfCounter=105
return {
on = {
devices = {
idxOfCounter
}
},
logging = {
level = domoticz.LOG_INFO,
marker = 'template',
},
execute = function(domoticz, device)
domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
domoticz.log('New value counterToday is '..domoticz.devices(idxOfCounter).counterToday, domoticz.LOG_INFO)
end
}
-
- Posts: 5
- Joined: Monday 01 January 2024 21:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Domoticz & Gas usage on LCD
Thanks for your script- it works perfectly.
I send data to the LCD as in the attachment:
but if i tried to implement part of your script to take out counterToday parameter it doesn't work i suppose i have a mistake.
Can you give me any clues?
I send data to the LCD as in the attachment:
but if i tried to implement part of your script to take out counterToday parameter it doesn't work i suppose i have a mistake.
Can you give me any clues?
- Attachments
-
- script.txt
- (1.03 KiB) Downloaded 53 times
-
- Posts: 661
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Domoticz & Gas usage on LCD
It seems you are mixing dzVents with LUA. I am not familiar with LUA and don't know how to get the counterToday value in your LUA script.
But if you make this a dzVents script and then use the openURL command in dzVents, you could update your LCD in that way.
But if you make this a dzVents script and then use the openURL command in dzVents, you could update your LCD in that way.
-
- Posts: 5
- Joined: Monday 01 January 2024 21:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Domoticz & Gas usage on LCD
OK. I'll try clarify all problems 
So far some values like temperatures, pressure i send to LCD in lua.script as in the attachment and it's OK - i don't want to change it now,
Another part of data like relays status i send to LCD in another script (DZVents) - in attachment,
"*" means relay ON, "-" means OFF
But I don't know how send value of variable in dzVents script- in attachment
I've tried to modify script from you, but I still don't know how to send value of gas sending (counterToday), sending to log file obviously works well:
This parameter could be send like e.g. var12 or something another.
LCD Display i've made on ESP with tasmota
The part of tasmota rule is presented below:
ON event#BELL=1.000 DO backlog power2 1;ruletimer1 30;DisplayMode 0;DisplayText[l1c1]P;DisplayText[l1c2]%var12%[l1c7]%mem1%/[l1c12]%mem2%[l1c17]%mem4%[l2c1]OUT:[l2c7]%mem5%[l2c12]%mem6%hPa[l2c22]LP%var2%[l2c26]OS%var1%[l2c30]CO%var3%[l2c34]HW%var5%%var6%%var7%[l3c1]SALN: %mem10%/[l3c12]%mem11%[l3c17]%mem7% ENDON
If it works well I'll prepare it in one dzVents script

So far some values like temperatures, pressure i send to LCD in lua.script as in the attachment and it's OK - i don't want to change it now,
Another part of data like relays status i send to LCD in another script (DZVents) - in attachment,
"*" means relay ON, "-" means OFF
But I don't know how send value of variable in dzVents script- in attachment
I've tried to modify script from you, but I still don't know how to send value of gas sending (counterToday), sending to log file obviously works well:
This parameter could be send like e.g. var12 or something another.
LCD Display i've made on ESP with tasmota
The part of tasmota rule is presented below:
ON event#BELL=1.000 DO backlog power2 1;ruletimer1 30;DisplayMode 0;DisplayText[l1c1]P;DisplayText[l1c2]%var12%[l1c7]%mem1%/[l1c12]%mem2%[l1c17]%mem4%[l2c1]OUT:[l2c7]%mem5%[l2c12]%mem6%hPa[l2c22]LP%var2%[l2c26]OS%var1%[l2c30]CO%var3%[l2c34]HW%var5%%var6%%var7%[l3c1]SALN: %mem10%/[l3c12]%mem11%[l3c17]%mem7% ENDON
If it works well I'll prepare it in one dzVents script
- Attachments
-
- script2.txt
- (2.96 KiB) Downloaded 38 times
-
- Posts: 661
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Domoticz & Gas usage on LCD
The dzvents document shows two ways of calling the openURL:
1) the simple one, without callback:
domoticz.openURL('http://domain/path/to/something?withparameters=1')
2) the asynchronous one, with callback:
domoticz.openURL({
url = 'http://domain/path/to/something',
method = 'POST',
callback = 'mycallbackstring',
postData = {
paramA = 'something',
paramB = 'something else'
}
})
It seems you created a mix of the two.
1) the simple one, without callback:
domoticz.openURL('http://domain/path/to/something?withparameters=1')
2) the asynchronous one, with callback:
domoticz.openURL({
url = 'http://domain/path/to/something',
method = 'POST',
callback = 'mycallbackstring',
postData = {
paramA = 'something',
paramB = 'something else'
}
})
It seems you created a mix of the two.
-
- Posts: 5
- Joined: Monday 01 January 2024 21:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Domoticz & Gas usage on LCD
I give up.
i was trying to send data to LCD in the end of script in attachment, but without any results
I need help, please
i was trying to send data to LCD in the end of script in attachment, but without any results
I need help, please

- Attachments
-
- script3.txt
- (1.04 KiB) Downloaded 53 times
-
- Posts: 661
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Domoticz & Gas usage on LCD
The main thing is to get the URL correct first. If it is working in a browser, it should also work in the URL call.
I see that you have the round function within the quotes, so it will pass as a string.
That line should be
url = '192.168.1.205/control?cmd=event,lcd,1,2,'..round(gas_usage,1),
To be sure you could first assign the url to a variable and print the variable to the log file. In that way you can inspect the correctness of the url.
I see that you have the round function within the quotes, so it will pass as a string.
That line should be
url = '192.168.1.205/control?cmd=event,lcd,1,2,'..round(gas_usage,1),
To be sure you could first assign the url to a variable and print the variable to the log file. In that way you can inspect the correctness of the url.
Who is online
Users browsing this forum: No registered users and 1 guest