How to use "Hichi" IR head with new energy dashboard?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
imautohuttraeger
Posts: 172
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Germany
Contact:

How to use "Hichi" IR head with new energy dashboard?

Post by imautohuttraeger »

I have a “Hichi IR reading head” (Tasmota) attached to my electricity meter. Today I have three devices as shown in the Screenshot. All other Tasmota idx numbers are sending nothing.

Now I want to merge everything to use it in the (phantastic) new Energy Dashboard - but how?

Thanks in advance for any hint.
Attachments
Screenshot 2024-07-11 170246.png
Screenshot 2024-07-11 170246.png (58.66 KiB) Viewed 1853 times
imautohuttraeger
Posts: 172
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Germany
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by imautohuttraeger »

OK, so let me simplify my question: Is it possible to use the data of a smart meter with infrared-reading rather than P1?
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by waltervl »

You will have to make a dummy P1 meter and make a dzvents script that is combining the data of import and export and actual watt into this dummy P1 device.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
imautohuttraeger
Posts: 172
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Germany
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by imautohuttraeger »

Thx! Will try to deep dive into this. Is there any sample code for combining devices that I can use and make amendements?
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by waltervl »

Something like this (not tested and could have type errors

Code: Select all

return {

	on = {
	    timer = { 'every 1 minutes' }
	},
	
	execute = function(domoticz, item)
	    
	    local importcounter = domoticz.devices(111) 
	    local exportcounter= domoticz.devices(222) 
	    local poweractual= domoticz.devices(333)
	    local dummyP1 = domoticz.devices(444)
	    local actualusage = 0
	    local actualprod = 0
	            
	    if poweractual.actualWatt < 0 then 
	                actualprod = 0 - poweractual.actualWatt
	        else
	                 actualusage = poweractual.actualWatt 
	     end
	    dummyP1.updateP1(importcounter.WhTotal,0,
	    exportcounter.WhTotal,0,actualusage,actualprod)
	    
    end
}
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
imautohuttraeger
Posts: 172
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Germany
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by imautohuttraeger »

I am afk now but saw your reply on the smartphone. Wow! Thank you very much. Will adopt this maybe even tomorrow and give feedback. I am pretty sure that you have saved my live (once again).
imautohuttraeger
Posts: 172
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Germany
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by imautohuttraeger »

I have added the hardware "P1 Smart Meter with LAN interface" with the IP-adresse of the tasmota IR reading head and Port 80 (8080 like shown in the wiki gives an error in the logfile) - Screenshot attached

Then I have created the dummy P1 device and it looks OK (still with zero values of course) - Screenshot attached

But the following error occurs:
Error: GetJSonDevices: exception occurred : 'stoull'

When I then activate the script (I only replaced the idx numbers, see code), Domoticz is freezed.
I have to restart Domoticz via SSH terminal and quickly deactivate the script in Domoticz to avoid further freezing. The dummy P1 device then has a reduced appearance - Screenshot attached.

Code: Select all

return {

	on = {
	    timer = { 'every 1 minutes' }
	},
	
	execute = function(domoticz, item)
	    
	    local importcounter = domoticz.devices(367) 
	    local exportcounter= domoticz.devices(362) 
	    local poweractual= domoticz.devices(447)
	    local dummyP1 = domoticz.devices(448)
	    local actualusage = 0
	    local actualprod = 0
	            
	    if poweractual.actualWatt < 0 then 
	                actualprod = 0 - poweractual.actualWatt
	        else
	                 actualusage = poweractual.actualWatt 
	     end
	    dummyP1.updateP1(importcounter.WhTotal,0,
	    exportcounter.WhTotal,0,actualusage,actualprod)
	    
    end
}
And after the restart of Domoticz, a new error occurs (every 5 minutes):
Error: UpdateMultiMeter: Error converting sValue values! (IDX: 448, sValue: 'nil;0;nil;0;502.6;0', dType: 250, sType: 1)

Sorry that I can only provide this amateurish information... Any idea?
Attachments
Hardware_Screenshot 2024-07-13 120859.png
Hardware_Screenshot 2024-07-13 120859.png (76.84 KiB) Viewed 1778 times
Device_initially_Screenshot 2024-07-13 121217.png
Device_initially_Screenshot 2024-07-13 121217.png (17.36 KiB) Viewed 1778 times
Device_after_freeze_Screenshot 2024-07-13 122230.png
Device_after_freeze_Screenshot 2024-07-13 122230.png (9.9 KiB) Viewed 1778 times
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by waltervl »

The P1 hardware gateway is not needed you can remove it. It will automatically remove the associated P1 device. You only need the dummy P1 device.

Also make sure you fill in the correct device IDX numbers.
Also it seems the export device uses negative counter values, a P1 cannot handle that. So perhaps also invert that to a positivevalue ( 0 - negativevalue).
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
imautohuttraeger
Posts: 172
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Germany
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by imautohuttraeger »

Merci!

OK, I have deleted the P1 hardware gateway.

Meanwhile I have made some trial an errors an found out, that

actualusage and actualprod and poweractual

are working fine and the dashboard flows as expected. Only the counters

importcounter and exportcounter

are causing domoticz to crash. Eleminating the negative value for export is not the cause. Maybe it's because the counters only count up whole numbers step by step. But I can't find where to change that.
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by waltervl »

Ah, I think I made a mistake here, these counters are real counters and not electric devices

Modify the updateP1 command into

Code: Select all

dummyP1.updateP1(importcounter.counter,0,
	    exportcounter.counter,0,actualusage,actualprod)
It still could give negative values for export counter so perhaps this could also work

Code: Select all

dummyP1.updateP1(importcounter.counter,0,
	    (exportcounter.counter * -1),0,actualusage,actualprod)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
imautohuttraeger
Posts: 172
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Germany
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by imautohuttraeger »

Bingo! This was the essential hint. Rather than .counter I took .counterToday and now everything is perfekt.

In case someone somewhen is stumbling over this post and needs inspiration, I wright down the final code that works in my case:

Code: Select all

return {
    
    on = {
		devices = {
			367, 362, 447
		}
	},
	
	execute = function(domoticz, item)
	    
	    local importcounter = domoticz.devices(367) 
	    local exportcounter = domoticz.devices(362) 
	    local poweractual = domoticz.devices(447)
	    local dummyP1 = domoticz.devices(453)
	    local actualusage = 0
	    local actualprod = 0
	            
	    if poweractual.actualWatt < 0 then 
	                actualprod = 0 - poweractual.actualWatt
	        else
	                 actualusage = poweractual.actualWatt 
	     end
	    dummyP1.updateP1((importcounter.counterToday * 1000),0,
	    (exportcounter.counterToday * 1000),0,actualusage,actualprod)
	
	    
    end
}
waltervl: I am so grateful that you almost instantly helped me with your expert knowledge - thank you!
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by waltervl »

Do not use Countertoday!!!
It will give weird results on midnight. Use counter
And probably the * 1000 is also not needed unless counter is giving kWh instead of Wh.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
imautohuttraeger
Posts: 172
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Germany
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by imautohuttraeger »

But ".counter" gives (at least in my case) the total meter reading that has ever been measured since the meter was installed by the electricity supply company. Without any relation to a certain period of time. So ".counterTody" works here. Will watch what happes at midnight.

Maybe the basic data from my Domoticz counters that are fed by the Tasmota infrared reading head are different from the normal standard of P1 ...

According to multiplication by 1000: In the general setting for meters/counters I have to set a divider of 1000, otherwise the kWh figure of the house item in the energy dashboard is weird.

Everything seems to be a little bit confused in my system ...
Attachments
Energy_Dashboard_working.png
Energy_Dashboard_working.png (77.69 KiB) Viewed 1697 times
House_weird_kWh_WITHOUT_divider_1000.png
House_weird_kWh_WITHOUT_divider_1000.png (14.1 KiB) Viewed 1697 times
House_NOT_weird_kWh_WITH_divider_1000.png
House_NOT_weird_kWh_WITH_divider_1000.png (12.7 KiB) Viewed 1697 times
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by waltervl »

counter should be updating during the days. Domoticz needs those rolling counters. It will calculate the daily values itself.
The first day you will get en extremely high value (the total unmeasured before). You can delete that high value after a couple of days so you will get normal graphs again.
Delete value with shift-click on the value in the graph
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
imautohuttraeger
Posts: 172
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Germany
Contact:

Re: How to use "Hichi" IR head with new energy dashboard?

Post by imautohuttraeger »

Yes, the counter update seems to work and went to Zero at midnight. Let's see during the next days how the rolling count will work.

And I was even already able to delete the starting value with shift click.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 1 guest