How to use updateQuiet

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
joostvanderlinde
Posts: 44
Joined: Tuesday 23 June 2015 23:06
Target OS: Linux
Domoticz version: 2023.2
Location: NL + SE
Contact:

How to use updateQuiet

Post 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.
Last edited by joostvanderlinde on Saturday 19 October 2024 11:50, edited 1 time in total.
Domoticz on BPI-M2-Pro (compiled on Ubuntu 22.04) and RPI (binary on Raspian 10)
RFXCom, Sonoff Zigbee stick, eBusd Adapter 5, P1, S0, Husdata H60 integration
Zigbee2MQTT AD, MQTT local, AirconWithMe, Ebusd, VolvoRecharge, PSA Car Controller
joostvanderlinde
Posts: 44
Joined: Tuesday 23 June 2015 23:06
Target OS: Linux
Domoticz version: 2023.2
Location: NL + SE
Contact:

Re: How to use updateQuiet

Post 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
Domoticz on BPI-M2-Pro (compiled on Ubuntu 22.04) and RPI (binary on Raspian 10)
RFXCom, Sonoff Zigbee stick, eBusd Adapter 5, P1, S0, Husdata H60 integration
Zigbee2MQTT AD, MQTT local, AirconWithMe, Ebusd, VolvoRecharge, PSA Car Controller
joostvanderlinde
Posts: 44
Joined: Tuesday 23 June 2015 23:06
Target OS: Linux
Domoticz version: 2023.2
Location: NL + SE
Contact:

Re: How to use updateQuiet

Post 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

Domoticz on BPI-M2-Pro (compiled on Ubuntu 22.04) and RPI (binary on Raspian 10)
RFXCom, Sonoff Zigbee stick, eBusd Adapter 5, P1, S0, Husdata H60 integration
Zigbee2MQTT AD, MQTT local, AirconWithMe, Ebusd, VolvoRecharge, PSA Car Controller
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest