Page 2 of 2

Re: Help for dimming time script

Posted: Tuesday 28 April 2020 15:43
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

Re: Help for dimming time script

Posted: Tuesday 28 April 2020 15:53
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.

Re: Help for dimming time script

Posted: Tuesday 28 April 2020 15:59
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

Re: Help for dimming time script

Posted: Tuesday 28 April 2020 18:55
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.

Re: Help for dimming time script

Posted: Wednesday 29 April 2020 11:31
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
}  

Re: Help for dimming time script

Posted: Monday 25 October 2021 21:23
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"

Re: Help for dimming time script

Posted: Tuesday 26 October 2021 9:40
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

Re: Help for dimming time script

Posted: Tuesday 26 October 2021 10:06
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!

Re: Help for dimming time script

Posted: Wednesday 27 October 2021 22:41
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

Re: Help for dimming time script

Posted: Wednesday 27 October 2021 22:42
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 ;-)

Re: Help for dimming time script

Posted: Monday 01 November 2021 19:53
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.

Re: Help for dimming time script

Posted: Wednesday 03 November 2021 10:34
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...