Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Praktische Anwendungen (Showcase)
    4. [Linux Shell-Skript] WLAN-Wetterstation

    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

    [Linux Shell-Skript] WLAN-Wetterstation

    This topic has been deleted. Only users with topic management privileges can see it.
    • SBorg
      SBorg Forum Testing Most Active @Negalein last edited by

      @negalein sagte in [Linux Shell-Skript] WLAN-Wetterstation:

      @sborg sagte in [Linux Shell-Skript] WLAN-Wetterstation:

      Kommen die Daten jetzt noch immer regelmäßig an?

      nein, seit Mittwoch 19 Uhr tot

      Dann stelle es wieder zurück, ev. geht es wieder und war ein längeres Problem bei Windy bzgl. Österreich.
      Ich kann es nicht nachstellen und habe außer Geocaching keine Idee mehr. Hast du einen VPN und könntest notfalls den Zugang auf bspw. Deutschland verbiegen?

      1 Reply Last reply Reply Quote 0
      • SBorg
        SBorg Forum Testing Most Active @icebear last edited by

        @icebear sagte in [Linux Shell-Skript] WLAN-Wetterstation:

        jetzt hab ich mir mal die wetterstation.conf angesehen und festgestellt das bei den Zusatzsensoren die WS80, WH40H und WH/WN32 nicht explizit aufgeführt sind.

        Liegt schlichtweg daran, dass noch keiner einen der Sensoren hatte. Da ich keinen Support von Ecowitt habe, weiß ich einfach nicht wie die Bezeichner lauten. Wenn du/jemand den String postet kann ich sie auch implementieren 🙂

        1 Reply Last reply Reply Quote 0
        • SBorg
          SBorg Forum Testing Most Active @Negalein last edited by

          @negalein sagte in [Linux Shell-Skript] WLAN-Wetterstation:

          ich kann seit heute Vormittag nichts mehr an Awekas schicken.

          Hatte ich schon Samstag Morgen bei Awekas gemeldet und geht seit aktuell ca. 4 Stunden wieder.

          1 Reply Last reply Reply Quote 0
          • S
            Shakira1972 @Shakira1972 last edited by

            @shakira1972 sagte in [Linux Shell-Skript] WLAN-Wetterstation:

            @boronsbruder sagte in [Linux Shell-Skript] WLAN-Wetterstation:

            @sborg meinte die Kommandozeile ./wetterstation.sh --data ausführen und die Ausgabe der Sensoren, ohne den ganzen Krismkrams darum, posten:

            Ok, ich hoffe das sind nun die richtigen Werte...

            soilmoisture1=50&soilad1=240&soilmoisture2=47&soilad2=249&soilmoisture3=35&soilad3=196&soilmoisture4=46&soilad4=245&soilmoisture5=50&soilad5=260&soilmoisture6=47&soilad6=247&soilmoisture7=41&soilad7=225&soilmoisture8=38&soilad8=222&soilmoisture9=50&soilad9=250&soilmoisture10=48&soilad10=238&soilmoisture11=58&soilad11=282&soilmoisture12=52&soilad12=248&soilmoisture13=54&soilad13=257&soilmoisture14=50&soilad14=239&soilmoisture15=53&soilad15=255&soilmoisture16=56&soilad16=261
            

            Wenn ich das richtig verstehe, dann zeigt es hier, im Gegensatz zu den Werten in IoBroker, die richtigen Werte an.
            Aktuell in IoBroker:
            0f813add-e6a0-44ac-87c8-12eedcfdb69f-image.png
            Danke für Eure Hilfe!

            Niemand eine Idee, woran es liegen könnte?
            Danke
            Shaki

            1 Reply Last reply Reply Quote 0
            • Boronsbruder
              Boronsbruder @SBorg last edited by

              @Shakira1972

              @sborg sagte in [Linux Shell-Skript] WLAN-Wetterstation:

              Da ich einen gedanklichen Fehler bei der V3.5.0 bei der Erhöhung der Sensoranzahl auf 16 Stück beim DP100 hatte:

              Neues Bugfix-Release des Wetterstation WLAN-Skriptes auf GitHub V3.5.1

              • ~ Fix falsche Messwerte bei DP100 Sensor Nr.1 wenn mehr als 10 Sensoren vorhanden sind

              Wie immer zu finden im GitHub


              Update-Routine von Vorgängerversion:

              • aktuellen WS-Updater nutzen

                wget -O ws_updater.sh https://raw.githubusercontent.com/SBorg2014/WLAN-Wetterstation/master/ws_updater.sh
              • ./ws_updater.sh im Installationsverzeichnis ausführen
              • Menüpunkt "4" wählen und die Fragen beantworten

              Update enthält lediglich einen Fix für mehr als 9 Stück DP100 Sensoren, ist also optional.

              S 1 Reply Last reply Reply Quote 0
              • S
                Shakira1972 @Boronsbruder last edited by

                @boronsbruder Super, hat funktioniert!
                Danke!

                R 1 Reply Last reply Reply Quote 0
                • R
                  Rand @Shakira1972 last edited by

                  Leicht OT, aber vieleicht hilft es ja jemanden 🙂

                  Hatte ja nach einem Weg gesucht den WFC01 auszulesen und nun ein einfaches JS basteln lassen:

                  const gwIp = '192.168.x.y'; // Replace with your actual GW2000 IP
                  const deviceId = 13443;      // Your WFC01 device ID
                  const model = 1;             // Always 1 for WFC01
                  const request = require('request');
                  
                  const enableLogging = true;
                  const statePrefix = 'javascript.0.WFC01';
                  
                  function logDebug(msg) {
                      if (enableLogging) log(msg);
                  }
                  
                  function createAndSetState(id, value, unit = '', type = 'number') {
                      const fullId = `${statePrefix}.${id}`;
                      if (!existsState(fullId)) {
                          createState(fullId, value, {
                              type: type,
                              read: true,
                              write: false,
                              unit: unit
                          });
                          logDebug(`Created state: ${fullId}`);
                      }
                      setState(fullId, value, true);
                      logDebug(`Updated ${fullId} → ${value}${unit}`);
                  }
                  
                  const options = {
                      url: `http://${gwIp}/parse_quick_cmd_iot`,
                      method: 'POST',
                      headers: {
                          'Content-Type': 'application/json'
                      },
                      body: JSON.stringify({
                          command: [{
                              cmd: "read_device",
                              id: deviceId,
                              model: model
                          }]
                      }),
                      timeout: 5000
                  };
                  
                  logDebug('Sending POST request to WFC01...');
                  request(options, (error, response, body) => {
                      if (error) {
                          logDebug(`Request error: ${error}`);
                          return;
                      }
                  
                      if (response.statusCode !== 200) {
                          logDebug(`Unexpected status code: ${response.statusCode}`);
                          logDebug(`Response body: ${body}`);
                          return;
                      }
                  
                      if (!body) {
                          logDebug('Empty response body');
                          return;
                      }
                  
                      try {
                          const data = JSON.parse(body);
                          logDebug(`Parsed JSON data: ${JSON.stringify(data)}`);
                  
                          const d = data.command[0];
                  
                          createAndSetState('flow_velocity', parseFloat(d.flow_velocity), 'L/min');
                          createAndSetState('water_total', parseFloat(d.water_total), 'L');
                          createAndSetState('water_status', parseInt(d.water_status));
                          createAndSetState('water_temp', parseFloat(d.water_temp), '°C');
                          createAndSetState('battery', parseInt(d.wfc01batt));
                          createAndSetState('signal', parseInt(d.rssi));
                          createAndSetState('warning', parseInt(d.warning));
                          createAndSetState('run_time', parseInt(d.run_time), 's');
                  
                      } catch (e) {
                          logDebug(`JSON parse error: ${e.message}`);
                      }
                  });
                  
                  

                  Habs ohne >request< nicht hinbekommen, da hat er den call nicht sauber gemacht.
                  Die Infos dazu stammen aus dem Ecowitt API document welches sie auf Anfrage verschicken (Local IOT API 20240828.docx in meinem Fall).

                  S 2 Replies Last reply Reply Quote 0
                  • S
                    Solardach @Rand last edited by

                    @rand Hallo !
                    Vielen Dank für das Skript, 👍 👏
                    Danach hatte ich schon länger gesucht.
                    Ich habe es installiert und läuft bei mir mit der WS3900A Wetterstation als Gateway.
                    Den Punkt "happen_water" habe ich noch dazu gesetzt.

                    water volume when water program starts. (L = water_total - happen_water)

                    1 Reply Last reply Reply Quote 0
                    • S
                      Solardach @Rand last edited by

                      @rand
                      Das Problem mit dem Skript ist, das es keinen Trigger gibt.
                      Es werden nur einmalig beim Skript Start die Werte eingelesen und das wars.
                      Vieleicht kann man noch einen Trigger mit einbauen ?

                      R 1 Reply Last reply Reply Quote 0
                      • R
                        Rand @Solardach last edited by Rand

                        @solardach

                        Klar, danke, hätte vieleicht vorher prüfen sollen ob alles tut, aber es war spät;)
                        Es wird auch ohne saubere Werte angelegt (nur als State, das habe ich auch noch gemacht (machen lassen ;))

                        Edit: So Water_happen sollte mit drin sein, hat es beim ersten durchlauf gestern scheinbar ignoriert, aber ist auch bei mir vorhanden.

                        const gwIp = '192.168.x.y'; // Replace with your actual GW2000 IP
                        const deviceId = 13443;        // Your WFC01 device ID
                        const model = 1;               // Always 1 for WFC01
                        const request = require('request');
                        
                        const enableLogging = true;
                        const statePrefix = 'javascript.0.WFC01';
                        
                        // Define what to create
                        const fieldDefinitions = {
                            flow_velocity:  { unit: 'L/min', type: 'number', role: 'value.flow' },
                            water_total:    { unit: 'L',     type: 'number', role: 'value.total' },
                            happen_water:   { unit: 'L',     type: 'number', role: 'value.total' },
                            water_volume:   { unit: 'L',     type: 'number', role: 'value.volume' },
                            water_status:   {                type: 'number', role: 'value.status' },
                            water_temp:     { unit: '°C',    type: 'number', role: 'value.temperature' },
                            battery:        {                type: 'number', role: 'value.battery' },
                            signal:         {                type: 'number', role: 'value.signal' },
                            warning:        {                type: 'number', role: 'value.warning' },
                            run_time:       { unit: 's',     type: 'number', role: 'value.interval' }
                        };
                        
                        function logDebug(msg) {
                            if (enableLogging) log(msg);
                        }
                        
                        // Delete + recreate state with correct role/type/unit (once)
                        function recreateState(id, value, unit = '', type = 'number', role = 'value') {
                            const fullId = `${statePrefix}.${id}`;
                            if (!existsState(fullId)) {
                                createState(fullId, value, {
                                    type: type,
                                    role: role,
                                    read: true,
                                    write: false,
                                    unit: unit
                                });
                                logDebug(`Created state: ${fullId}`);
                            }
                            setState(fullId, value, true);
                            logDebug(`Updated ${fullId} → ${value}${unit}`);
                        }
                        
                        function queryDevice() {
                            const options = {
                                url: `http://${gwIp}/parse_quick_cmd_iot`,
                                method: 'POST',
                                headers: { 'Content-Type': 'application/json' },
                                body: JSON.stringify({
                                    command: [{
                                        cmd: "read_device",
                                        id: deviceId,
                                        model: model
                                    }]
                                }),
                                timeout: 5000
                            };
                        
                            logDebug('Sending POST request to WFC01...');
                            request(options, (error, response, body) => {
                                if (error) {
                                    logDebug(`Request error: ${error}`);
                                    return;
                                }
                        
                                if (response.statusCode !== 200) {
                                    logDebug(`Unexpected status code: ${response.statusCode}`);
                                    logDebug(`Response body: ${body}`);
                                    return;
                                }
                        
                                if (!body) {
                                    logDebug('Empty response body');
                                    return;
                                }
                        
                                try {
                                    const data = JSON.parse(body);
                                    const d = data.command[0];
                        
                                    logDebug(`Parsed JSON data: ${JSON.stringify(d)}`);
                        
                                    recreateState('flow_velocity', parseFloat(d.flow_velocity),  ...Object.values(fieldDefinitions.flow_velocity));
                                    recreateState('water_total', parseFloat(d.water_total),      ...Object.values(fieldDefinitions.water_total));
                                    recreateState('happen_water', parseFloat(d.happen_water),    ...Object.values(fieldDefinitions.happen_water));
                                    recreateState('water_status', parseInt(d.water_status),      ...Object.values(fieldDefinitions.water_status));
                                    recreateState('water_temp', parseFloat(d.water_temp),        ...Object.values(fieldDefinitions.water_temp));
                                    recreateState('battery', parseInt(d.wfc01batt),              ...Object.values(fieldDefinitions.battery));
                                    recreateState('signal', parseInt(d.rssi),                    ...Object.values(fieldDefinitions.signal));
                                    recreateState('warning', parseInt(d.warning),                ...Object.values(fieldDefinitions.warning));
                                    recreateState('run_time', parseInt(d.run_time),              ...Object.values(fieldDefinitions.run_time));
                        
                                    // Calculate water volume used during current watering run
                                    const total = parseFloat(d.water_total);
                                    const happen = parseFloat(d.happen_water);
                                    const volume = total - happen;
                        
                                    if (!isNaN(volume) && volume >= 0 && volume < 10000) {
                                        recreateState('water_volume', parseFloat(volume.toFixed(2)), ...Object.values(fieldDefinitions.water_volume));
                                    } else {
                                        logDebug(`Skipped invalid water volume: ${volume}`);
                                    }
                        
                                } catch (e) {
                                    logDebug(`JSON parse error: ${e.message}`);
                                }
                            });
                        }
                        
                        // Initial call on script start
                        queryDevice();
                        
                        // Schedule query every 60 seconds
                        schedule("*/1 * * * *", () => {
                            queryDevice();
                        });
                        
                        
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        591
                        Online

                        31.9k
                        Users

                        80.1k
                        Topics

                        1.3m
                        Posts

                        linux shell-script wetterstation wlan-wetterstation
                        147
                        5568
                        3346384
                        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