dzVents, update svalue only and do not update the device description

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
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

dzVents, update svalue only and do not update the device description

Post by averter »

I'm trying to use the dombusEVSE to charge my electric vehicle in solar mode. The mode requires that a grid power device svalue is updated to keep track of how much power can be used to charge the EV, and I am using a dzvents script to feed this value to the device. The main problem is that as I update the svalue using the `setValues`function (see https://www.domoticz.com/wiki/DzVents:_ ... ll_devices) the function also updates the device description, and that forces the dombus plugin to send a new configuration to the dombus EVSE module (and it ends up never starting to charge the EV). So the question is if there is a dzvents function which updates the svalues only and leaves the device description untouched?

A MWE of the dzvents script is shown below

Code: Select all

return {
    active = true,
	on = {
		devices = {
			'Solax - Grid Power',
			'Solax - Battery Power',
		}
	},
	execute = function(domoticz, device)
        local GP = domoticz.devices('Solax - Grid Power')                   -- Power from/to grid
        local BP = domoticz.devices('Solax - Battery Power')                -- Battery charge
        local EVSEGRIDMETER = domoticz.devices('dombus - (1.c) Grid Power') -- EVSE device
        EVSEGRIDMETER.setValues(0,tostring(-GP.actualWatt - BP.actualWatt)..';0')
	end
}
and the relevant portion of the dombus log is shown below

Code: Select all

2024-07-29 11:33:02.565  dombus: onDeviceModified: device description=ID=1.c,CUSTOM,TypeName=kWh
2024-07-29 11:33:02.565  dombus: DEBUG:Parse Description field for device 1.c
2024-07-29 11:33:02.565  dombus: DEBUG:opt=ID=1.c
2024-07-29 11:33:02.565  dombus: DEBUG:opt=CUSTOM
2024-07-29 11:33:02.565  dombus: DEBUG:opt=CUSTOM setType=2147483648 typeName=Switch
2024-07-29 11:33:02.565  dombus: DEBUG:opt=TypeName=kWh
2024-07-29 11:33:02.566  dombus: INFO: Config device 0x1: type=0x80000000 typeName=kWh Options={'EnergyMeterMode': '1', 'SignedWatt': '1'}
2024-07-29 11:33:02.566  dombus: INFO: TypeName='kWh', nValue=0, sValue='-4499.858;-6.2175', Description='ID=1.c,CUSTOM,TypeName=kWh', Options={'EnergyMeterMode': '1', 'SignedWatt': '1'}
2024-07-29 11:33:02.578  dombus: DUMP: TX frame: P:2 3a 0000 -> 0001 12 DCMDCFG 0c 00 | CFG 0c 80 00 00 00 00 00 00 | c4 
2024-07-29 11:33:02.678  dombus: DUMP: RX frame: P:2 3a 0001 -> 0000 03 A-CFG 0c 80 | d3 
2024-07-29 11:33:04.080  dombus: DUMP: TX frame: P:2 3a 0000 -> 0001 03 DCMDCFG 0c 00 | 2b 
Note the line `dombus: DEBUG:Parse Description field for device 1.c` which indicates the root cause of the problem.
`
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by waltervl »

Better ask the plugin author why the plugin updates the description also.... So the plugin does something strange and the you have to modify the dvents normal way?

But just using dzvents updateEnergy() function should also work.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by averter »

waltervl wrote: Monday 29 July 2024 12:47 Better ask the plugin author why the plugin updates the description also.... So the plugin does something strange and the you have to modify the dvents normal way?

But just using dzvents updateEnergy() function should also work.
That is what I've tried before the setValues function: using the updateElectricity function. updateEnergy does not work, so it is probably not suited for this type of device. None of these solutions work. :(

I've asked this question to the plugin's author, but he's more familiar with lua than dzvents (hence why I decided to post the question to the community).

For reference, I'm putting below a MWE in lua, created by the plugin's author, which works/does not update the description field of the device. I'm not using such script because 1) I want it to be in dzvents, and 2) it's just a MWE, it does not actually correspond to the power that I want to send to the device. The key issue is the updating process of the device, which works as intended with the below script but not with the one that I've shown previously.

Code: Select all

GRIDMETERS={"Solax - Grid Power", "Solax - Battery Power"}			-- List of meters which power should be summed (1 or more meters can be specified)
EVSEGRIDMETER="dombus - (1.c) Grid Power"					-- Name of the virtual device on DomBusEVSE

commandArray={}

function getPowerValue(devValue)
    -- extract the power value from string "POWER;ENERGY...."
    for str in devValue:gmatch("[^;]+") do
        return tonumber(str)
    end
end

-- scan the list of devices that has changed
for devName,devValue in pairs(devicechanged) do
	for j,name in pairs(GRIDMETERS) do
		-- print("devName="..devName.." name="..name)
		if (devName == name) then
			-- one of the GRIDMETERS value has changed
			totalPower=0
			for k,meter in pairs(GRIDMETERS) do
			    -- print(otherdevices_lastupdate[meter])
				totalPower=totalPower + getPowerValue(otherdevices[meter])
				-- print("totalPower="..totalPower)
			end
			commandArray[EVSEGRIDMETER]=tostring(totalPower)..';0'
			return commandArray
		end
	end
end
return commandArray
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by waltervl »

What kind of device is it? See menu Setup - Devices

Then check what the appropriate update command is in dzvents wiki.
Also it seems that neither Set commands should change the description too. So something is strange here.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by averter »

waltervl wrote: Monday 29 July 2024 15:08 What kind of device is it? See menu Setup - Devices

Then check what the appropriate update command is in dzvents wiki.
Also it seems that neither Set commands should change the description too. So something is strange here.
I agree that it is strange. The device is shown in the figure, general kWh, and so updateElectricity ought to work?
Attachments
Untitled.png
Untitled.png (80.83 KiB) Viewed 797 times
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by waltervl »

Yes indeed, updateElectricity(power, energy) should work and not change the description.
What is the description being modified in? Is it being emptied or changed into something else?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by averter »

waltervl wrote: Monday 29 July 2024 15:38 Yes indeed, updateElectricity(power, energy) should work and not change the description.
What is the description being modified in? Is it being emptied or changed into something else?
According to the above log and what I see in the actual device is "ID=1.c,CUSTOM,TypeName=kWh"
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by waltervl »

So what is the description of you update the power values with dzvents?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by averter »

waltervl wrote: Monday 29 July 2024 20:01 So what is the description of you update the power values with dzvents?
Everything indicates that updateEnergy is updating the description of the device although it does not actually changes its contents: the creator of the plugin confirms that 1) this is what is happening based on the log that is shown above, and 2) "ID=1.c,CUSTOM,TypeName=kWh" is the description that came originally with the device (I'm exchanging emails with him).
Could it be that these updating commands from dzvents read and feedthrough all the other fields than the actual power value (description, nvalue/svalue, etc.) during the update process?
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by waltervl »

That could well be. But if the description does not change, what is the problem?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by averter »

waltervl wrote: Tuesday 30 July 2024 7:50 That could well be. But if the description does not change, what is the problem?
Note that I'm not overly familiar with the inner functioning of the plugin but, I know that some of its parameters need to be configured by editing the description of the devices and then saving them (example in figure below). What Paolo from Creasol said is that when the description is updated that forces the dombus plugin to constantly be sending a new configuration to the dombus EVSE module, and the end result is that the plugin ends up never starting to charge the EV when in solar mode. In other words, it seems that this problem triggers a constant restart of the EVSE module.
Attachments
Untitled.png
Untitled.png (107.79 KiB) Viewed 714 times
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by waltervl »

You could try to add .silent() to the .updateElectricity() statement but I doubt it will help.

Code: Select all

EVSEGRIDMETER.updateElectricity(-GP.actualWatt - BP.actualWatt,0).silent()
Else you have to use the lua script...
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: dzVents, update svalue only and do not update the device description

Post by averter »

Thanks for the suggestion and all your help. I've tested it just now, and unfortunately it doesn't work.

Guess it has to be done with lua, which is a bit disappointing, but oh well.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest