Ankündigung

Einklappen

Serverwartung 21.2.



Am 21.2. im Laufe des späten Abends wird eine Serverwartung durchgeführt. Das Forum ist dadurch für gut zwei Stunden nicht erreichbar.
Es wird eine Wartungsseite geschaltet.

Mehr anzeigen
Weniger anzeigen

logic.last_time()

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    logic.last_time()

    Hello to all,
    according to documentation I can use the logic object an some attributes and functions:

    -logic.name: with the name of the logic as specified in logic.conf
    -logic.last_time(): this function provides the last run of this logic (before the recent one)
    -logic.prio: read and set of the current priority of this logic.

    I can use with no problem name and prio attributes, but no way to get last_time() working.

    For example if I write:

    Code:
    #!/usr/bin/env python
    #
    logger.info("Hello World!")
    logger.info(logic.name)
    logger.info(logic.prio)
    logger.info(logic.last_time())
    I tried with and without parenthesis, but I always get:


    Code:
    2014-10-26 16:46:43,123 INFO     hello        Hello World! -- hello.py:<module>:3
    2014-10-26 16:46:43,128 INFO     hello        hello -- hello.py:<module>:4
    2014-10-26 16:46:43,133 INFO     hello        3 -- hello.py:<module>:5
    2014-10-26 16:46:43,146 ERROR    hello        Logic: hello, File: /usr/smarthome/logics/hello.py, Line: 6, Method: <module>, Exception: 'Logic' object has no attribute 'last_time' -- scheduler.py:_task:334
    Traceback (most recent call last):
      File "/usr/smarthome/lib/scheduler.py", line 327, in _task
        exec(obj.bytecode)
      File "/usr/smarthome/logics/hello.py", line 6, in <module>
        logger.info(logic.last_time())
    AttributeError: 'Logic' object has no attribute 'last_time'
    How can I solve?

    Thanks in advance

    #2
    Hi,

    it seems the documentation is wrong. The Feature is long gone.

    What is the use case behind it? For what do you need it.

    so long

    Marcus

    Kommentar


      #3
      Hi Marcus, thanks for your support, and sorry for the late, maybe I missed notification email about your reply... -.-'

      I'm studying about load management logic to be implemented in Smarthome, and I want to use this function to posticipate the triggering of some logic, according to the last time it triggered.

      Maybe there is better ways to to that..

      Thanks

      Kommentar

      Lädt...
      X