Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Entwicklung
  4. Adapterentwicklung/Funktion wird nicht ausgeführt

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    3.4k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.1k

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.5k

Adapterentwicklung/Funktion wird nicht ausgeführt

Scheduled Pinned Locked Moved Entwicklung
5 Posts 4 Posters 468 Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NemoN
    wrote on last edited by
    #1

    Moin zusammen,

    ich bin gerade dabei mich in die Adapter-Entwicklung einzuarbeiten. Ich starte mit einem ganz einfachen "scheduled" Test-Adapter. Soweit so gut. Leider wird meine Funktion queryHomeServer() nicht ausgeführt. Habe ich da ein Denk-Fehler??

    home.0	2019-06-19 23:40:00.310	info	config password: test1234
    home.0	2019-06-19 23:40:00.310	info	config email: 123@test.com
    home.0	2019-06-19 23:40:00.302	info	starting. Version 0.0.1 in /opt/iobroker/node_modules/iobroker.home, node: v8.16.0
    home.0	2019-06-19 23:40:00.206	debug	statesDB connected
    home.0	2019-06-19 23:40:00.193	debug	objectDB connected
    host.iobrokerdev	2019-06-19 23:40:00.011	info	instance system.adapter.home.0 started with pid 30801
    

    Eigentlich sollte doch dann noch "entering queryHomeServer" ausgegeben werden und der Adapter beendet werden. Passiert aber nicht. Der Adapter bleibt im Speicher. Auch

    this.log.debug("should never should reach this point. Exiting!")
    this.stop(); // stop adapter right here (on schedule mode)
    

    wird nicht erreicht :white_frowning_face:

    "use strict";
    
    /*
     * Created with @iobroker/create-adapter v1.15.1
     */
    
    // The adapter-core module gives you access to the core ioBroker functions
    // you need to create an adapter
    const utils = require("@iobroker/adapter-core");
    
    class Home extends utils.Adapter {
    
    	/**
    	 * @param {Partial<ioBroker.AdapterOptions>} [options={}]
    	 */
    	constructor(options) {
    		super({
    			...options,
    			name: "home",
    		});
    
    		this.on("ready", this.onReady.bind(this));
    		this.on("unload", this.onUnload.bind(this));
    	}
    
    	/**
    	 * Is called when databases are connected and adapter received configuration.
    	 */
    	async onReady() {
    		// Initialize your adapter here
    
    		// The adapters config (in the instance object everything under the attribute "native") is accessible via
    		// this.config:
    		this.log.info("config email: " + this.config.email);
    		this.log.info("config password: " + this.config.password);
    
    		if (!this.config.email) {
    			this.log.warn("email is empty. Exiting!");
    			this.stop();
    		} else if (!this.config.password) {
    			this.log.warn("password empty. Exiting!");
    			this.stop();
    		}
    
    		queryHomeServer();
    
    		this.log.debug("should never should reach this point. Exiting!")
    		this.stop(); // stop adapter right here (on schedule mode)
    	}
    	
    	/**
    	 * Is called when adapter shuts down - callback has to be called under any circumstances!
    	 * @param {() => void} callback
    	 */
    	onUnload(callback) {
    		try {
    			this.log.info("cleaned everything up...");
    			callback();
    		} catch (e) {
    			callback();
    		}
    	}
    	
    	/**
    	 * queryHomeServer
    	 */
    	queryHomeServer() {
    		 this.log.debug("entering queryHomeServer");
    
    		 this.stop(); // stop adapter right here (on shedule mode)
    	}
    }
    
    // @ts-ignore parent is a valid property on module
    if (module.parent) {
    	// Export the constructor in compact mode
    	/**
    	 * @param {Partial<ioBroker.AdapterOptions>} [options={}]
    	 */
    	module.exports = (options) => new Home(options);
    } else {
    	// otherwise start the instance directly
    	new Home();
    }
    
    
    AlCalzoneA 1 Reply Last reply
    0
    • arteckA Offline
      arteckA Offline
      arteck
      Developer Most Active
      wrote on last edited by
      #2

      setzte die klammer aus Zeile 72 auf Zeile 63..

      zigbee hab ich, zwave auch, nuc's genauso und HA auch

      1 Reply Last reply
      0
      • N Offline
        N Offline
        NemoN
        wrote on last edited by
        #3

        Danke für die schnelle Hilfe. Klappt. Gut zu wissen das die Funktionen außerhalb der "class" definiert werden müssen. Ich hatte mich an den onUnload / onReady Methoden orientiert...

        Jey CeeJ 1 Reply Last reply
        0
        • N NemoN

          Danke für die schnelle Hilfe. Klappt. Gut zu wissen das die Funktionen außerhalb der "class" definiert werden müssen. Ich hatte mich an den onUnload / onReady Methoden orientiert...

          Jey CeeJ Online
          Jey CeeJ Online
          Jey Cee
          Developer
          wrote on last edited by
          #4

          @NemoN sagte in Adapterentwicklung/Funktion wird nicht ausgeführt:

          Gut zu wissen das die Funktionen außerhalb der "class" definiert werden müssen.

          Nein müssen sie nicht, es geht auch innerhalb der Class.

          this.queryHomeServer()
          

          Persönlicher Support
          Spenden -> paypal.me/J3YC33

          1 Reply Last reply
          1
          • N NemoN

            Moin zusammen,

            ich bin gerade dabei mich in die Adapter-Entwicklung einzuarbeiten. Ich starte mit einem ganz einfachen "scheduled" Test-Adapter. Soweit so gut. Leider wird meine Funktion queryHomeServer() nicht ausgeführt. Habe ich da ein Denk-Fehler??

            home.0	2019-06-19 23:40:00.310	info	config password: test1234
            home.0	2019-06-19 23:40:00.310	info	config email: 123@test.com
            home.0	2019-06-19 23:40:00.302	info	starting. Version 0.0.1 in /opt/iobroker/node_modules/iobroker.home, node: v8.16.0
            home.0	2019-06-19 23:40:00.206	debug	statesDB connected
            home.0	2019-06-19 23:40:00.193	debug	objectDB connected
            host.iobrokerdev	2019-06-19 23:40:00.011	info	instance system.adapter.home.0 started with pid 30801
            

            Eigentlich sollte doch dann noch "entering queryHomeServer" ausgegeben werden und der Adapter beendet werden. Passiert aber nicht. Der Adapter bleibt im Speicher. Auch

            this.log.debug("should never should reach this point. Exiting!")
            this.stop(); // stop adapter right here (on schedule mode)
            

            wird nicht erreicht :white_frowning_face:

            "use strict";
            
            /*
             * Created with @iobroker/create-adapter v1.15.1
             */
            
            // The adapter-core module gives you access to the core ioBroker functions
            // you need to create an adapter
            const utils = require("@iobroker/adapter-core");
            
            class Home extends utils.Adapter {
            
            	/**
            	 * @param {Partial<ioBroker.AdapterOptions>} [options={}]
            	 */
            	constructor(options) {
            		super({
            			...options,
            			name: "home",
            		});
            
            		this.on("ready", this.onReady.bind(this));
            		this.on("unload", this.onUnload.bind(this));
            	}
            
            	/**
            	 * Is called when databases are connected and adapter received configuration.
            	 */
            	async onReady() {
            		// Initialize your adapter here
            
            		// The adapters config (in the instance object everything under the attribute "native") is accessible via
            		// this.config:
            		this.log.info("config email: " + this.config.email);
            		this.log.info("config password: " + this.config.password);
            
            		if (!this.config.email) {
            			this.log.warn("email is empty. Exiting!");
            			this.stop();
            		} else if (!this.config.password) {
            			this.log.warn("password empty. Exiting!");
            			this.stop();
            		}
            
            		queryHomeServer();
            
            		this.log.debug("should never should reach this point. Exiting!")
            		this.stop(); // stop adapter right here (on schedule mode)
            	}
            	
            	/**
            	 * Is called when adapter shuts down - callback has to be called under any circumstances!
            	 * @param {() => void} callback
            	 */
            	onUnload(callback) {
            		try {
            			this.log.info("cleaned everything up...");
            			callback();
            		} catch (e) {
            			callback();
            		}
            	}
            	
            	/**
            	 * queryHomeServer
            	 */
            	queryHomeServer() {
            		 this.log.debug("entering queryHomeServer");
            
            		 this.stop(); // stop adapter right here (on shedule mode)
            	}
            }
            
            // @ts-ignore parent is a valid property on module
            if (module.parent) {
            	// Export the constructor in compact mode
            	/**
            	 * @param {Partial<ioBroker.AdapterOptions>} [options={}]
            	 */
            	module.exports = (options) => new Home(options);
            } else {
            	// otherwise start the instance directly
            	new Home();
            }
            
            
            AlCalzoneA Offline
            AlCalzoneA Offline
            AlCalzone
            Developer
            wrote on last edited by
            #5

            @NemoN queryHomeServer ist eine Instanz-Methode und muss daher wie log und stop mit this. aufgerufen werden.

            Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            Support us

            ioBroker
            Community Adapters
            Donate

            328

            Online

            32.7k

            Users

            82.4k

            Topics

            1.3m

            Posts
            Community
            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
            ioBroker Community 2014-2025
            logo
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Home
            • Recent
            • Tags
            • Unread 0
            • Categories
            • Unreplied
            • Popular
            • GitHub
            • Docu
            • Hilfe