dummy device type "electricity usage" does not seem to calculate costs

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
renerene
Posts: 347
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

dummy device type "electricity usage" does not seem to calculate costs

Post by renerene »

dummy device type "electricity usage" does not seem to calculate costs, see legenda in screenhot below of fresh made device

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

Re: dummy device type "electricity usage" does not seem to calculate costs

Post by waltervl »

That is correct as it does not measure kWh but only Watt.
It is by the way not advised to use this type of device as it also has no history. Better use the Electricity (instant and counter) sensor as indicated in the wiki
https://wiki.domoticz.com/Dummy_for_vir ... lectricity
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
renerene
Posts: 347
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

Re: dummy device type "electricity usage" does not seem to calculate costs

Post by renerene »

thanks for the explanation Walter.
(my excuse: the advice to not use this device was not on on the dzVents wiki)

For this incidently user it is a bit overwelming and confusing.I was using you "Electricity (instant and counter) sensor" before, to monitor my airco that only reports current [amps]

A bit of topic is here my script to fill the "Electricity (instant and counter) sensor" Maybe you could be so kind to have a look?
the problem: it resulted in some negative values in the log for energy bars

Code: Select all

return {
	active = true,
	logging = {
		--level = domoticz.LOG_DEBUG, -- comment to use the dzVents global logging setting
		marker = 'dzOpenEvseKwh'
	},
	on = {
	   devices = {
	       'OpenEVSE - Amps'
	      --,'triggerhulp'
	   }
	},
	data = {
        vorigSec = { initial = 0 },
    },
    
    execute = function(dz, item, timer)
        if dz.data.vorigSec > 0 then -- niet de eerste keer / data leeg?
            secNu = os.time()
            secVerstreken = secNu - dz.data.vorigSec
	        stroom= dz.devices('OpenEVSE - Amps').current
            voltage = dz.devices('tuyaPlug2AircoOverloopVolt').voltage
            vermogen= stroom * voltage --power [Watt]
            energie=vermogen * secVerstreken/3600 -- energy [Wh]
            dz.devices ('openEvseKwh').updateElectricity (vermogen, energie) --updateElectricity(power, energy): Function. Supports command options.
            dz.log ('sec: '..secVerstreken, dz.LOG_INFO)
            dz.log ('stroom: '..stroom, dz.LOG_INFO)
            dz.log ('voltage: '..voltage, dz.LOG_INFO)
            dz.log ('vermogen [Watt]: '..vermogen, dz.LOG_INFO)
            dz.log ('energie [kWh]: '..energie, dz.LOG_INFO)
        else
            dz.log ('geen realistische tijdwaarde / eerste keer? ', dz.LOG_INFO)
        end
        
        dz.data.vorigSec = secNu
    end
}
renerene
Posts: 347
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

Re: dummy device type "electricity usage" does not seem to calculate costs

Post by renerene »

to answer my own post: problem solved, you need to pass TOTAL Wh, not delta Wh

correct script to convert Amps to power:

Code: Select all

return {
	active = true,
	logging = {
		level = domoticz.LOG_DEBUG, -- comment to use the dzVents global logging setting
		marker = 'dzMitsubishiAircoKwh'
	},
	on = {
	   devices = {
	       'MitsubishiAircoControl current power'
	      --,'triggerhulp'
	   }
	},
	data = {
        vorigSec = { initial = 0 },
    },
    
    execute = function(dz, item, timer)
        if dz.data.vorigSec > 0 then -- niet de eerste keer / data leeg?
            secNu = os.time()
            secVerstreken = secNu - dz.data.vorigSec
	        stroom= dz.devices('MitsubishiAircoControl current power').current
            voltage = dz.devices('tuyaPlug2AircoOverloopVolt').voltage --better than 230 solid value
            vermogen= stroom * voltage --power [W]
            oudeEnergie = dz.devices('mitsubishiAircoKwh').WhTotal
            energie=vermogen * secVerstreken/3600 --[Wh]
            dz.devices ('mitsubishiAircoKwh').updateElectricity (vermogen, energie + oudeEnergie) --updateElectricity(power, energy): Function. Supports command options.
            --dz.devices ('mitsubishiAircoKwh').updateEnergy(vermogen) --updateEnergy(energy): Function. In Watt.
            dz.log ('sec: '..secVerstreken, dz.LOG_INFO)
            dz.log ('stroom: '..stroom, dz.LOG_INFO)
            dz.log ('voltage: '..voltage, dz.LOG_INFO)
            dz.log ('vermogen [Watt]: '..vermogen, dz.LOG_INFO)
            dz.log ('oudeEnergie [Wh]: '..oudeEnergie, dz.LOG_INFO)
            dz.log ('energie [Wh]: '..energie, dz.LOG_INFO)
        else
            dz.log ('geen realistische tijdwaarde / eerste keer? ', dz.LOG_INFO)
        end
        
        dz.data.vorigSec = secNu
    end
}
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest