Page 1 of 1

How to use updateQuiet

Posted: Saturday 19 October 2024 11:25
by joostvanderlinde
I have a device of type 'switch' defined that I want to use to control the preconditioning of my EV.
Triggering the device submits an API call to the car to switch the preconditioning on or off.

At the same time I have a script that collects the actual status of the car (including precontitioning) that updates about 10 devices (e.g. mileage, SoC).

Because the preconditioning can also be set from the carÅ› mobile app, I want to update the state of my preconditioning device in Domoticz to be updated (to sync the status of my Domoticz device and the actualk car status in case of a difference), while avoiding (jin this particular case) that it submits the API call to the car.

From https://www.domoticz.com/wiki/DzVents:_ ... object_API " the "updateQuiet" function should be applicable. I think I could use something like:

Code: Select all

                               if (carPreconditioning) then 
                                    domoticz.devices(idxPreconditionng).updateQuiet('On')
                                else
                                    domoticz.devices(idxPreconditionng).updateQuiet('Off')
                                end
 
But when I try this, I get an error "attempt to call a nil value (field 'updateQuiet')"
As "updateQuiet" should be a function to the device this error message puzzles me even more.

Re: How to use updateQuiet

Posted: Saturday 19 October 2024 11:35
by joostvanderlinde
Oh well forget about the above error. Talking about blindness of your own code.
I happened to mis-type the variable of the device idx: idxPreconditionng should be idxPreconditioning

BUT: still my device state is not updated with this corrected code, so any help is still appreciated!

Code: Select all

				if (carPreconditioning) then 
                                    domoticz.devices(idxPreconditioning).updateQuiet('On')
                                else
                                    domoticz.devices(idxPreconditioning).updateQuiet('Off')
                                end

Re: How to use updateQuiet

Posted: Saturday 19 October 2024 12:47
by joostvanderlinde
OK, apparently dzVents does not work as described here.

Generally it appears that when using .updateQuiet, you have to provide the nValue, i.e 1 instead of 'On' and 0 instead of 'Off'
This applies to other type of devices as well. E.g. for a Doorlock you have to use 1 instead of 'Locked' and 0 instead of 'Unlocked'
Using the sValue does not trigger an error, it simply does not update the device!

Alternatively, for Switch type devices, you can also use .quietOn() and .quietOff():

Code: Select all

                                if (carPreconditioning) then 
                                    domoticz.devices(idxPreconditioning).quietOn()
                                else
                                    domoticz.devices(idxPreconditioning).quietOff()
                                end