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: states nach funktionen ausprinten

    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: states nach funktionen ausprinten

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

      Hallo Zusammen,

      ich stehe mal wieder auf dem Schlauch.

      Ich haben eine Function angelegt und member reingepackt:

      e2b5d0b4-9e29-4dd9-9ae6-d0805469d067-image.png

      Nun will ich diese via getEnums anzeigen:

      const homeAssistantDevices = getEnums('enum.functions.homeassistent_enabled');
      
      if (homeAssistantDevices && homeAssistantDevices.members) {
          console.log('Devices with homeassistent_enabled function:');
          homeAssistantDevices.members.forEach(deviceId => {
              const deviceObj = getObject(deviceId);
              console.log(`- ${deviceObj.common.name} ${deviceId}`);
         });
      } else {
          console.log('No devices found with homeassistent_enabled function');
      }
      

      Leider findet mein schickes (von chatGPT und Perplexity) unterstützes Script die Geräte nicht:

      javascript.0	18:21:03.077	info	Stopping script script.js.in_Entwicklung.Skript_122
      javascript.0	18:21:03.164	info	Start JavaScript script.js.in_Entwicklung.Skript_122 (Javascript/js)
      javascript.0	18:21:03.175	info	script.js.in_Entwicklung.Skript_122: No devices found with homeassistent_enabled function
      javascript.0	18:21:03.175	info	script.js.in_Entwicklung.Skript_122: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
      

      Kann mir jemand helfen?

      M paul53 2 Replies Last reply Reply Quote 0
      • M
        MCU @flachdachdecker last edited by MCU

        @flachdachdecker sagte in states nach funktionen ausprinten:

        getEnums('enum.functions.homeassistent_enabled')

        Das gibt es nicht, nur getEnums('functions')

        https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md#getenums

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

          @flachdachdecker sagte: via getEnums anzeigen

          Das ist die falsche Funktion, um die "Members" zu ermitteln.

          const homeAssistantDevices = getObject('enum.functions.homeassistent_enabled');
           
          if (homeAssistantDevices && homeAssistantDevices.common.members) {
          
          F 1 Reply Last reply Reply Quote 0
          • F
            flachdachdecker @paul53 last edited by

            Danke euch beiden!

            falls jemand anders sucht - so gehts:

            const homeAssistantDevices = getObject('enum.functions.homeassistent_enabled');
             
            if (homeAssistantDevices) {
                console.log('Devices with homeassistent_enabled function:');
                homeAssistantDevices.common.members.forEach(deviceId => {
                    const deviceObj = getObject(deviceId);
                    console.log(`- ${deviceObj.common.name} ${deviceId}`);
               });
            } else {
                console.log('No devices found with homeassistent_enabled function');
            }
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post

            Support us

            ioBroker
            Community Adapters
            Donate

            563
            Online

            31.9k
            Users

            80.2k
            Topics

            1.3m
            Posts

            3
            4
            182
            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