Help for dimming time script  [Solved]

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

Moderator: leecollings

User avatar
djdevil
Posts: 101
Joined: Friday 26 July 2019 18:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Help for dimming time script

Post by djdevil »

Thx for reply.
Given the importance in daily use of my scripts, I think the fix will happen first in the beta right? so should I activate the reception of the beta version? thanks
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Help for dimming time script

Post by waaren »

djdevil wrote: Tuesday 28 April 2020 15:43 Thx for reply.
Given the importance in daily use of my scripts, I think the fix will happen first in the beta right? so should I activate the reception of the beta version? thanks
Yes the fix will happen first in beta. Up to you if you want to switch to beta and help testing new features / bugfixes. I cannot recommend this if bad things will happen if domoticz does show issues. In fact I would not set the check for updates at all in such a system and wait until you see something on the forum and/or on the version wiki page and update controlled and after making a backup of your domoticz directory.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
djdevil
Posts: 101
Joined: Friday 26 July 2019 18:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Help for dimming time script

Post by djdevil »

you have been very clear, so for now I will have to wait for the next stable version not to create mess! I will wait anxiously! thanks for everything
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Help for dimming time script

Post by waaren »

djdevil wrote: Tuesday 28 April 2020 15:59 you have been very clear, so for now I will have to wait for the next stable version not to create mess! I will wait anxiously! thanks for everything
I created a Pull request to solve this issue. When OK it will be merged into a next Beta.
Next stable where the fix will be in might be taking some time to arrive.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
djdevil
Posts: 101
Joined: Friday 26 July 2019 18:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Help for dimming time script

Post by djdevil »

waaren wrote: Tuesday 28 April 2020 18:55
djdevil wrote: Tuesday 28 April 2020 15:59 you have been very clear, so for now I will have to wait for the next stable version not to create mess! I will wait anxiously! thanks for everything
I created a Pull request to solve this issue. When OK it will be merged into a next Beta.
Next stable where the fix will be in might be taking some time to arrive.
thanks for the work done!

In the meantime, since the problem seems to affect the z-wave and zigbee devices, I created a virtual switch that follows the main switch and modified the code in this way. Now everything works as before!

Code: Select all

return
{
   on =
   {
      devices = { 'SDB' },
   },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'dim based on time'
    },

   execute = function(dz, item)

        dz.log('SDB state: ' .. item.state,dz.LOG_DEBUG)

        if item.active and dz.devices('VIRTUAL DEVICE').lastUpdate.secondsAgo > 4 then 
                if dz.time.matchesRule('at 06:30-21:30') then
                    item.dimTo(100).silent()
                else
                    item.dimTo(20).silent()
                end
        elseif and dz.devices('VIRTUAL DEVICE').lastUpdate.secondsAgo > 4 then
            item.dimTo(0).silent()
        end
    end
}  
hestia
Posts: 361
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: Help for dimming time script

Post by hestia »

I created a virtual switch that follows the main switch and modified the code in this way
I could you explain how you did this pls? "follow"
User avatar
waltervl
Posts: 5729
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Help for dimming time script

Post by waltervl »

hestia wrote: Monday 25 October 2021 21:23
I created a virtual switch that follows the main switch and modified the code in this way
I could you explain how you did this pls? "follow"
What is your problem? This should be fixed in stable 2020.2 and so also in 2021.1
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
djdevil
Posts: 101
Joined: Friday 26 July 2019 18:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Help for dimming time script

Post by djdevil »

hestia wrote: Monday 25 October 2021 21:23
I created a virtual switch that follows the main switch and modified the code in this way
I could you explain how you did this pls? "follow"
Yes this problem fix with new version of Domoticz!
hestia
Posts: 361
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: Help for dimming time script

Post by hestia »

waltervl wrote: Tuesday 26 October 2021 9:40
hestia wrote: Monday 25 October 2021 21:23
I created a virtual switch that follows the main switch and modified the code in this way
I could you explain how you did this pls? "follow"
What is your problem? This should be fixed in stable 2020.2 and so also in 2021.1
My problem was well explained in this post viewtopic.php?f=6&t=27607&p=224799#p224799 but it disappeared from the forum :-(
Discussed also here viewtopic.php?p=228875#p228875
My understanding of this problem is about .silent() that doesn't really work for devices like zwave and generate false trigger when a switch is switched on or off. This thing about ".silent()" is not solved for me and the ".lastUpdate.secondsAgo > 4" workaround is not good in all cases
hestia
Posts: 361
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: Help for dimming time script

Post by hestia »

djdevil wrote: Tuesday 26 October 2021 10:06
hestia wrote: Monday 25 October 2021 21:23
I created a virtual switch that follows the main switch and modified the code in this way
I could you explain how you did this pls? "follow"
Yes this problem fix with new version of Domoticz!
My request was just to understand how it was done, perhaps it could be useful for other workaround, and also to understand something I could not figure out ;-)
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Help for dimming time script

Post by rrozema »

My guess is that this behavior for z-wave devices is most likely a result of the way openzwave works: when a value gets set using openzwave, that value is stored in memory and it is sent to the device. Then when the device has accepted the value, the device responds by sending the new value back to the controller (i.e. domoticz). Both setting the value and the device's response normally trigger domoticz to call the script's execute function. When you add the silent() function, only the set value gets the silent() functionality applied, i.e. the call to execute the script is skipped. When the device's response is received however, that value change still triggers the script to be called.
hestia
Posts: 361
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: Help for dimming time script

Post by hestia »

That's possible indeed. I did some testing some time ago and it was not always the same pattern , perhaps due to other issues with OWZ.
I also did some simple testing with zwavejs2mqtt and I'm afraid that it could be the same... I'll do more testing in a while.
That's why I'd like to know what was the work around found in this topic...
Post Reply

Who is online

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