logo elektroda
logo elektroda
X
logo elektroda

Deta Dimmer autoexec.bat: Why isnt alias check_all updating Channel 2 to Channel 3?

rohanb 81 1
ADVERTISEMENT
  • #1 21605974
    rohanb
    Level 2  
    Hi
    I am having an issue with scripting on a Deta Dimmer
    Below is my autoexec.bat contents

    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    waitFor MQTTState 1

    setChannelType 1 toggle
    setChannelType 2 dimmer1000
    setChannelType 3 TextField

    tuyaMcu_setDimmerRange 100 1003

    setChannelLabel 1 "Power"
    setChannelLabel 2 "Dimmer"
    setChannelLabel 3 "Min Light Dimmer"

    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2
    linkTuyaMCUOutputToChannel 3 2 3

    alias check_all if $CH2 < $CH3 then setChannel 2 $CH3

    addEventHandler OnChannelChange 1 setChannel 201 $CH1
    addEventHandler OnChannelChange 2 setChannel 202 $CH2
    addEventHandler OnChannelChange 3 setChannel 203 $CH3
    addEventHandler OnChannelChange 2 check_all
    //addEventHandler OnChannelChange 3 check_all

    // On start
    addRepeatingEvent 5 1 backlog setChannel 1 $CH201; setChannel 2 $CH202; setChannel 3 $CH203

    The issue is that this line does not seem to work
    alias check_all if $CH2 < $CH3 then setChannel 2 $CH3
    If we assume the value of channel 3 is 100 if I set the slider of Channel 2 to 50
    I would think this line would reset it to 100 but it does not seem to run
    I know the channel 3 value is text but I still thought it would have worked
    What am I missing
    Thanks
  • ADVERTISEMENT
  • #2 21606339
    p.kaczmarek2
    Moderator Smart Home
    That's probably because our "if" expects a single token with no spaces as condition, so try:
    
    alias check_all if $CH2<$CH3 then setChannel 2 $CH3
    


    Added after 31 [seconds]:

    we also have up to 64 channels I think
    Helpful post? Buy me a coffee.
ADVERTISEMENT