logo elektroda
logo elektroda
X
logo elektroda

Error in Rule1 syntax for Tasmot on ESP8266 - correct configuration

opaaa 1086 13
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20681192
    opaaa
    Level 4  
    I just wrote such a role for Tasmot on the ESP8266
    20:53:15.897 CMD: Rule1 ON Time 20:54 DO POWER0 0 ENDON
    20:53:15.902 RUL: Stored uncompressed, would compress from 31 to 30 (-4%)
    20:53:15.905 RSL: RESULT = {"Rule1":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":31,"Free":480,"Rules":"ON Time 20:54 DO POWER0 0 ENDON"}}

    But it doesn't work. Why? What did I write wrong

    The GPIO0 output is configured as a relay but I also tried as an LED.
  • ADVERTISEMENT
  • #2 20681331
    p.kaczmarek2
    Moderator Smart Home
    Hello, where did you get this piece of writing:
    
    ON Time 20:54
    

    In Tasmota's documentation I only see:
    Screenshot of a table listing different time triggers in the Time# format, with Time#Minute241 highlighted in a red box.
    https://tasmota.github.io/docs/Rules/#rule-trigger
    By the way:
    https://github.com/tasmota/docs-7.1/blob/mast...a-luminance-triggered-switch-only-in-mornings
    Helpful post? Buy me a coffee.
  • #3 20681367
    opaaa
    Level 4  
    p.kaczmarek2 wrote:
    Hello, where did you get this bit of notation:
    
    ON Time 20:54
    
    In Tasmota's documentation I only see the following:
    Screenshot of a table listing different time triggers in the Time# format, with Time#Minute241 highlighted in a red box. https://tasmota.github.io/docs/Rules/#rule-trigger
    By the way:
    https://github.com/tasmota/docs-7.1/blob/mast...a-luminance-triggered-switch-only-in-mornings

    If you mean a record of this type
    Rule1 ON Time#Minute=1379 DO POWER0 0 ENDON
    this does not work.
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #6 20681559
    p.kaczmarek2
    Moderator Smart Home
    What is POWER15 ? Are you trying to get to GPIO15 in this way? This is not how it works. POWER is not supposed to have a GPIO index, only a slot, channel index.

    So as you have:
    Screenshot of Tasmota configuration showing pin (GPIO) assignments to specific functions on a Generic module.
    This relay:
    Screenshot of Tasmota configuration with the D2 GPIO4 field highlighted, set as Relay with index 3.
    This is POWER3 (because it is assigned number 3) and not POWER4 (because GPIO4)

    Do a dry test - turn on the Tasmota console and enter your POWER15 TOGGLE and see if it works:
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #7 20681641
    opaaa
    Level 4  

    @p.kaczmarek2 you are right. Since I have as in the attached screenshot I should use POWER1. And in the console POWER1 1 works fine, while such a rule
    Rule2 ON Time#Minute=610 DO POWER1 1 ENDON
    does not work. Even after typing .
  • Helpful post
    #8 20681666
    p.kaczmarek2
    Moderator Smart Home
    Checked. With me it works:
    Screenshot of Tasmota console logs showing time settings, rule configuration, and failed MQTT connection attempts.
    Log as text:
    
    09:31:10.552 CMD: Time
    09:31:10.557 RSL: RESULT = {"Time":"2023-08-05T09:31:10"}
    09:31:55.575 CMD: Rule1 ON Time#Minute=574 DO POWER OFF ENDON
    09:31:55.581 RUL: Stored uncompressed, would compress from 37 to 35 (-6%)
    09:31:55.584 RSL: RESULT = {"Rule1":{"State":"OFF","Once":"OFF","StopOnError":"OFF","Length":37,"Free":474,"Rules":"ON Time#Minute=574 DO POWER OFF ENDON"}}
    09:32:00.587 CMD: Rule1 1
    09:32:00.593 RSL: RESULT = {"Rule1":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":37,"Free":474,"Rules":"ON Time#Minute=574 DO POWER OFF ENDON"}}
    09:33:01.373 MQT: Attempting connection...
    09:33:01.601 MQT: Connect failed to wwqewqeqw:1883, rc -2. Retry in 120 sec
    09:33:50.086 RSL: STATE = {"Time":"2023-08-05T09:33:50","Uptime":"22T19:41:14","UptimeSec":1971674,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"POWER1":"ON","POWER2":"OFF","POWER3":"ON","Wifi":{"AP":1,"SSId":"MY_WIFI_SSID","BSSId":"28:87:BA:A0:F5:6D","Channel":1,"Mode":"11n","RSSI":74,"Signal":-63,"LinkCount":1,"Downtime":"0T00:01:02"}}
    09:34:00.044 RUL: TIME#MINUTE=574 performs "POWER OFF"
    09:34:00.051 RSL: RESULT = {"POWER1":"OFF"}
    09:34:00.053 RSL: POWER1 = OFF
    
    I will add that I previously typed Time in the console to see the time, which was offset by 1h in the case of my Tasmota. What does the command Time show in your case? Maybe you've also got that 1h offset and don't know it?

    EDIT: Those 610s look like you didn't include that 1h offset. I guess we should both configure summer/winter time correctly in our Tasmoths....
    Helpful post? Buy me a coffee.
  • #10 20681684
    opaaa
    Level 4  
    I have no idea what the issue is, I copied from you
    Rule1 ON Time#Minute=574 DO POWER OFF ENDON
    changed the minutes to the current ones and it works.
  • Helpful post
    #11 20681692
    p.kaczmarek2
    Moderator Smart Home
    I don't know if it's case sensitive, it's worth checking, I'd also bet that since @opaaa a previously typed 610 and it didn't work and now he's typed 574 and it's ok, that means he was typing a time that is "an hour away" so the rule would work, it would just attach later than @opaaa would expect

    Writing the command Time in the console helps because it dispels doubts about the time that Tasmota sees

    It remains then to configure the time zone correctly (in my case too):
    https://tasmota.github.io/docs/Timezone-Table/
    Screenshot from Tasmota timezone table with the Europe/Warsaw line highlighted and its configuration code visible. .
    Helpful post? Buy me a coffee.
  • #12 20681859
    opaaa
    Level 4  
    That's right, I used to set "timezone 99" but you can see something has gone awry. And is it possible to save the trigger in some more friendly form and not how many minutes have to pass from midnight for something to work?
  • #13 20681926
    raks0
    Level 30  
    opaaa wrote:
    As it is possible to write the trigger in some more friendly form and not how many minutes have to pass since midnight for something to take effect?
    You could use a Timer
    Timer1 {"Enable":1,"Mode":0,"Time":"08:00","Days":"1111111","Repeat":1,"Action":3}
    Rule2 On clock#Timer=1 do power1 0 endon
    .
  • #14 20681945
    opaaa
    Level 4  
    raks0 wrote:
    opaaa wrote:
    Are you able to write the trigger in some more friendly form and not how many minutes have to pass since midnight for something to work?

    You can use a Timer
    Timer1 {"Enable":1,"Mode":0,"Time":"08:00","Days":"1111111","Repeat":1,"Action":3}
    Rule2 On clock#Timer=1 do power1 0 endon

    Well, yes, I understand, however just turning something on and off there is just indirect combining in my case. Ultimately, what I want to do is to make the PWM control in such a way that from 13:00 it starts to increase the filling smoothly in such a way that at 15:00 it reaches the maximum, i.e. 1023 (if I read it correctly on the internet). Then for a few hours the filling is 100% and then for 2 hours it decreases from 1023 to 0. If he can suggest how to go about it, I would be happy to read.

Topic summary

The discussion revolves around an error in the syntax of a Tasmota rule for the ESP8266, specifically regarding the configuration of GPIO outputs for controlling a relay. Users explore various aspects of the rule syntax, including the correct use of uppercase and lowercase letters, the proper identification of GPIO pins, and the necessity of enabling the rule. The conversation highlights troubleshooting steps, such as checking the time zone settings and testing commands in the Tasmota console. Additionally, suggestions are made for using timers to achieve more complex control scenarios, such as PWM (Pulse Width Modulation) for gradual changes in output.
Summary generated by the language model.
ADVERTISEMENT