Ankündigung

Einklappen
Keine Ankündigung bisher.

eval how-to?

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

    eval how-to?

    Hello Guys.

    How does the Eval function work? I'm a bit confused after reading around and reading: https://github.com/mknx/smarthome/wiki/Eval-Syntax

    If i want to evaluate on two sensors, both of them must be OFF to set another bool to ON - normally in logics that would be:

    if sensor_a == False and sensor_b == False: Light(True) else: Light(false).....

    But this doesn't work in the eval - what should the syntax be here? I know i shouldn't have the sh. before the items used...

    #2
    Hi,

    der Syntax im eval ist Python Sytax.

    Das müsste ungefähr so aussehen:
    Code:
    eval true if (sensor_a == False and sensor_b == False) else false
    Das sah für mich anfangs auch merkwürdig aus, ist aber Standardsysntax von Python.
    Viele Grüße
    Martin

    There is no cloud. It's only someone else's computer.

    Kommentar


      #3
      Zitat von Msinn Beitrag anzeigen
      Hi,

      der Syntax im eval ist Python Sytax.

      Das müsste ungefähr so aussehen:
      Code:
      eval true if (sensor_a == False and sensor_b == False) else false
      Das sah für mich anfangs auch merkwürdig aus, ist aber Standardsysntax von Python.
      Thanks alot - i will test it

      Kommentar


        #4
        Sorry for my answer in german. I didn't notice you were writing in english.
        Viele Grüße
        Martin

        There is no cloud. It's only someone else's computer.

        Kommentar


          #5
          Look for PEP308 in Python.
          Umgezogen? Ja! ... Fertig? Nein!
          Baustelle 2.0 !

          Kommentar

          Lädt...
          X