Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. [gelöst]: Wie bringt man den Status in eine IF-Abfrage?

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst]: Wie bringt man den Status in eine IF-Abfrage?

    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      pingo last edited by pingo

      Diese Zeile meines Scripts erzeugt eine orange Warnung und scheint nicht zu funktionieren: (abgefragt wird die Variable Einspeisung und der Status einer Klimaanlage)

      <if(Einspeisung <= 100 && getState("daikin.0.control.power" == true )>

      Wie wäre bitte die korrekte Formulierung?

      Danke

      bahnuhr paul53 2 Replies Last reply Reply Quote 0
      • bahnuhr
        bahnuhr Forum Testing Most Active @pingo last edited by

        @pingo sagte in Wie bringt man den Status in eine IF-Abfrage?:

        getState("daikin.0.control.power"

        so auf den ersten Blick:

        richtig ist wohl:
        getState("daikin.0.control.power").val

        ansonsten mehr Infos !

        P 1 Reply Last reply Reply Quote 0
        • paul53
          paul53 @pingo last edited by

          @pingo sagte: korrekte Formulierung?

          if(Einspeisung <= 100 && getState("daikin.0.control.power").val) 
          
          B 1 Reply Last reply Reply Quote 0
          • B
            badsnoopy667 @paul53 last edited by badsnoopy667

            Hab gerade aus Spaß mal ChatGPT gefragt was hier nicht stimmt und er sagt die Klammer ist falsch gesetzt bei
            getState("daikin.0.control.power" == true )

            Versuch doch mal:

            if (Einspeisung <= 100 && getState("daikin.0.control.power") == true) {
              // some code here
            }
            
            bahnuhr paul53 OliverIO 3 Replies Last reply Reply Quote 0
            • bahnuhr
              bahnuhr Forum Testing Most Active @badsnoopy667 last edited by

              @badsnoopy667

              Das klappt nicht.

              Paul und ich haben die Lösung schon gepostet.
              Bei dir fehlt das "val"

              1 Reply Last reply Reply Quote 2
              • paul53
                paul53 @badsnoopy667 last edited by

                @badsnoopy667 sagte: ChatGPT gefragt was hier nicht stimmt

                ChatGPT muss offenbar noch viel lernen, wenn das die Antwort war.

                B 1 Reply Last reply Reply Quote 1
                • B
                  badsnoopy667 @paul53 last edited by

                  @paul53 Ja, ich glaube auch 😄

                  1 Reply Last reply Reply Quote 0
                  • P
                    pingo @bahnuhr last edited by

                    @bahnuhr said in Wie bringt man den Status in eine IF-Abfrage?:

                    @pingo sagte in Wie bringt man den Status in eine IF-Abfrage?:

                    getState("daikin.0.control.power"

                    so auf den ersten Blick:

                    richtig ist wohl:
                    getState("daikin.0.control.power").val

                    ansonsten mehr Infos !

                    Top. Das funktioniert so. Danke!

                    1 Reply Last reply Reply Quote 0
                    • OliverIO
                      OliverIO @badsnoopy667 last edited by

                      @badsnoopy667 sagte in [gelöst]: Wie bringt man den Status in eine IF-Abfrage?:

                      Versuch doch mal:
                      if (Einspeisung <= 100 && getState("daikin.0.control.power") == true) { // some code here }

                      dann sollte chatGPT mal über truthy und falsy was lesen.
                      getState gibt ein Objekt zurück
                      wenn das objekt existiert ist es true
                      also ist der 2.Teil immer wahr

                      https://developer.mozilla.org/en-US/docs/Glossary/Truthy
                      https://developer.mozilla.org/en-US/docs/Glossary/Falsy

                      aber wahrscheinlich weiß chatgpt auch nicht was die funktion zurück

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post

                      Support us

                      ioBroker
                      Community Adapters
                      Donate

                      785
                      Online

                      31.8k
                      Users

                      80.0k
                      Topics

                      1.3m
                      Posts

                      5
                      9
                      268
                      Loading More Posts
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes
                      Reply
                      • Reply as topic
                      Log in to reply
                      Community
                      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                      The ioBroker Community 2014-2023
                      logo