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.
    • 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 2 Replies 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.

                  Edit 2 - Es gab noch eine Diskrepanz zwischen State und Ihrem Datentyp (numerisch) -> ping @Solardach
                  Edit 3 - Nochmal korrigiert

                  const gwIp = '192.168.x.y';    // IP of your Sensaphone Web600
                  const deviceId = 13443;           // Device ID of your WFC01
                  const model = 1;                  // Model = 1 for WFC01
                  const version = '1.0.0';          // Script version
                  const request = require('request');
                  
                  const enableLogging = true;
                  const statePrefix = 'javascript.0.WFC01'; // ioBroker state prefix
                  
                  function logDebug(msg) {
                      if (enableLogging) log(msg);
                  }
                  
                  // Log script version on start
                  logDebug(`Starting WFC01 script, version ${version}`);
                  
                  // Recreate or update ioBroker state - Async version to avoid type errors
                  async function recreateState(id, value, meta) {
                      const fullId = `${statePrefix}.${id}`;
                  
                      if (!(await existsStateAsync(fullId))) {
                          await createStateAsync(fullId, value, {
                              type: meta.type,
                              role: meta.role,
                              read: true,
                              write: false,
                              unit: meta.unit || ''
                          });
                          logDebug(`Created state: ${fullId}`);
                      }
                  
                      await setStateAsync(fullId, { val: value, ack: true });
                      logDebug(`Updated ${fullId} → ${value}${meta.unit || ''}`);
                  }
                  
                  // Metadata definitions for each field
                  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' },
                      water_volume:   { unit: 'L',     type: 'number', role: 'value' },
                      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' },
                      publish_time:   { unit: 's',     type: 'number', role: 'value.time' },
                      timeutc:        { unit: 's',     type: 'number', role: 'value.time' },
                      water_action:   {                type: 'number', role: 'value' },
                      water_running:  {                type: 'number', role: 'indicator.running' }
                  };
                  
                  // Poll the WFC01 device (async version)
                  async function pollDeviceData() {
                      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, async (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];
                  
                              if (!d) {
                                  logDebug('No device data in response.');
                                  return;
                              }
                  
                              // Parse and update all standard fields asynchronously
                              await recreateState('flow_velocity', parseFloat(d.flow_velocity), fieldDefinitions.flow_velocity);
                              await recreateState('water_total', parseFloat(d.water_total), fieldDefinitions.water_total);
                              await recreateState('happen_water', parseFloat(d.happen_water), fieldDefinitions.happen_water);
                              await recreateState('water_status', parseInt(d.water_status), fieldDefinitions.water_status);
                              await recreateState('water_temp', parseFloat(d.water_temp), fieldDefinitions.water_temp);
                              await recreateState('battery', parseInt(d.wfc01batt), fieldDefinitions.battery);
                              await recreateState('signal', parseInt(d.rssi), fieldDefinitions.signal);
                              await recreateState('warning', parseInt(d.warning), fieldDefinitions.warning);
                              await recreateState('run_time', parseInt(d.run_time), fieldDefinitions.run_time);
                              await recreateState('publish_time', parseInt(d.publish_time), fieldDefinitions.publish_time);
                              await recreateState('timeutc', parseInt(d.timeutc), fieldDefinitions.timeutc);
                              await recreateState('water_action', parseInt(d.water_action), fieldDefinitions.water_action);
                              await recreateState('water_running', parseInt(d.water_running), fieldDefinitions.water_running);
                  
                              // Calculated water_volume
                              const waterTotal = parseFloat(d.water_total);
                              const happenWater = parseFloat(d.happen_water);
                              const waterVolume = waterTotal - happenWater;
                              await recreateState('water_volume', waterVolume, fieldDefinitions.water_volume);
                  
                          } catch (e) {
                              logDebug(`JSON parse error: ${e.message}`);
                          }
                      });
                  }
                  
                  // Run initially and set interval to 1 minute
                  pollDeviceData();
                  setInterval(pollDeviceData, 60 * 1000);
                  
                  
                  
                  S 1 Reply Last reply Reply Quote 0
                  • S
                    Solardach @Rand last edited by

                    @rand
                    Kann es sein das jetzt ein altes Skript drin steht ?
                    Es verursacht mehr Probleme mit den Datentypen, und es fehlen die Werte water_happen und Volume.

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

                      @solardach
                      Ja. Der nachteil von ChatGPT, man muss immer alles doppelt und dreifach prüfen 😞
                      Ich repariere es nachher.

                      Edit: Habe es nochmal korrigiert, ich hoffe es tut nun

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

                        @boronsbruder Hallo,
                        leider aktualisieren sich die Werte nicht.
                        Die Bodenfeuchtesensoren DP100, 1 bis 9 aktualisieren sich, 10 bis 16 nach der Installation von 3.5.1 nicht mehr.
                        Es gab die erste richtige übertragung nach der Installation vor einer Woche, aber dann kamen keine Neuen Werte mehr...
                        Woran könnte dies liegen?
                        Danke
                        Shaki

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

                          @shakira1972
                          Da müssen wir @SBorg fragen.
                          Was is da los? 😆

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

                            @rand Prima ! Funktioniert.

                            1 Reply Last reply Reply Quote 0
                            • MassiveAttack
                              MassiveAttack last edited by

                              Kann mir bitte jemand helfen, diesen Fehler wegzubekommen? Der kommt mittlerweile ~ alle 30 Sekunden und spammt mir das Log voll:

                              sourceanalytix.0
                              	2025-07-24 11:23:34.128	error	Input value for javascript.0.Wetterstation.Regen_Jahr, type = string but should be a number, cannot handle calculation
                              

                              Der Type ist aber mixed bzw. auch number. Nur der Zustand hat Typ string. Wie kann ich das ändern?
                              a48c6706-3dc6-4b79-b029-8765e864bca6-{DA22C1B4-E01C-4BE4-9DAE-6EEE45755A3A}.png

                              1 Reply Last reply Reply Quote 0
                              • Stefan81 0
                                Stefan81 0 last edited by

                                Hallo Liebe Community,
                                ich glaube ich brauche mal eure Hilfe.
                                Ich habe meine Wlan-Wetterstation WH6000 auf dem Dach installiert, und nun möchte ich natürlich die Daten auch im iobroker zur Verfügung stellen.
                                Ich stehe glaube ich kurz vorm Ziel, aber irgendwo hakt es noch denke ich.
                                das hier ist meine Info die ich geben kann.
                                Vielleicht sieht ja einer das Problem, bin leider kein IT Profi.

                                WLAN-Wetterstation V3.5.1 - (c)2019-2025 by SBorg
                                Config-Version: V3.5.1
                                Sub-Version : V3.5.1

                                'bc' installiert: [✓]
                                'jq' installiert: [✓]

                                'dc' installiert: [✓]

                                [sudo] password for wetter:
                                'nc' in der Openbsd-Variante installiert: [✓]
                                'netcat' in Openbsd-Variante aktiv, alles korrekt [✓]

                                Connection to 192.168.178.XX 8093 port [tcp/*] succeeded!
                                parse error: Invalid numeric literal at line 1, column 10
                                (standard_in) 1: syntax error
                                (standard_in) 1: syntax error
                                /home/wetter/wetterstation/wetterstation.sub: line 858: [: : integer expression expected

                                Messwerteblock:
                                Nicht alle Werte werden unterstützt (abhängig vom Modell der Wetterstation und dem verwendeten Protokoll)!

                                Temperatur Innen : °C
                                Temperatur Aussen : °C
                                Taupunkt : °C
                                Gefühlte Temperatur : °C
                                Luftfeuchte Innen : %
                                Luftfeuchte Aussen : %
                                Windgeschwindigkeit : km/h
                                Windgeschwindigkeit 10min : km/h
                                Windböengeschwindigkeit : km/h
                                Windböe max. : km/h
                                Windrichtung : °
                                Windrichtung :
                                Windrichtung 10min : °
                                Luftdruck absolut : hPa
                                Luftdruck relativ : hPa
                                Regenrate : mm/h
                                Regenstatus :
                                Regen seit Regenbeginn : mm
                                Regen Stunde : mm
                                Regen Tag : mm
                                Regen Woche : mm
                                Regen Monat : mm
                                Regen Jahr : mm
                                Regen Gesamt : mm
                                Sättigungsdefizit : kPa
                                Sonnenstrahlung : W/m²
                                UV-Index :
                                Zeitstempel :
                                Firmware :
                                Batteriestand: :
                                Gateway-Modell :
                                Zusatzsensoren: keine
                                Datenstring für ioBroker:
                                DATA von Wetterstation:
                                Debug VAR:
                                Installationsverzeichnis: /home/wetter/wetterstation
                                IPP: 192.168.178.XX:8093 WS_PORT: 1080 WS_POLL: 30 PRE_DP: 0_userdata.0.Wetterstation
                                WEB: HTTP WS_PROT: Wunderground
                                Zusatzsensoren:
                                DP10/35/40/50/60/70/100/200/250/300: 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
                                WH31: 1 || WS90: 0
                                Bresser: 7009999 [0]
                                Script-Version: V3.5.1 Config-Version: V3.5.1 Sub-Version: V3.5.1
                                Kommunikationsfehler!
                                Kommunikationsfehler! Stimmt die WS_ID in der Konfiguration mit der der WS View-App überein?

                                Ich habe schon gecheckt ob es die gleiche ID ist, die sollte passen soweit.
                                Als App nutze ich auch die richtige denke ich. Die weisse App mit der Station als Bild, WS View nennt die sich.

                                Falls noch Infos benötigt werden, kann ich gerne nachliefern.
                                Ich hoffe es kann mir jemand helfen.

                                Beste Grüße Stefan

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

                                  @stefan81-0
                                  Die weisse Wsview ist die Alte. Die neue heisst WsView Plus. Das sollte aber nichts ändern.
                                  Hilfreich wäre die Config des Skripts.

                                  Dort aber die Passwörter unkenntlich machen!

                                  Und ein Screenshot der Einstellungsseite "Weather Services" der App:
                                  74135e5f-3579-4734-b45b-0d566e93872a-grafik.png

                                  Ich persönlich benutze immer das Ecowitt-Protokoll und nicht Wunderground. Da das bei mir Probleme machte.

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

                                    @boronsbruder
                                    ach ok danke schon mal. Werde das mal ausprobieren.
                                    Die Daten kann ich vermutlich erst morgen oder Samstag nachliefern.

                                    Aber auf jeden Fall schon mal DANKE. ✌

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

                                    Support us

                                    ioBroker
                                    Community Adapters
                                    Donate

                                    661
                                    Online

                                    31.9k
                                    Users

                                    80.2k
                                    Topics

                                    1.3m
                                    Posts

                                    linux shell-script wetterstation wlan-wetterstation
                                    148
                                    5577
                                    3349927
                                    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