Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Hardware
    4. Lay-Z-Spa Wifi Control

    NEWS

    • Monatsrückblick - April 2025

    • Minor js-controller 7.0.7 Update in latest repo

    • Save The Date: ioBroker@Smart Living Forum Solingen, 14.06.

    Lay-Z-Spa Wifi Control

    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      Frissi @Nobody 0 last edited by

      @nobody-0 Habe gerade eine Bestellung mehrerer Platinen am laufen, müssen die nächsten Tage eintreffen.

      Einfach PN, wenn Du interesse hast...
      VG Alex

      F 1 Reply Last reply Reply Quote 0
      • F
        Frissi @Frissi last edited by Frissi

        Hallo zusammen,

        die bei JLCPCB bestellten Platinen sind heute eingetroffen.
        Aktuell habe ich noch 5 Stück davon übrig, 4- und 6-adrige JST-Kabel habe ich auch dazu.

        Edit: Alle Platinen haben ein neues Zuhause gefunden....

        Viele Grüße
        Alex

        1 Reply Last reply Reply Quote 0
        • B
          bischemer last edited by

          @frissi
          Hi Alex,
          sorry das ich über das Forum schreibe. Irgendwie hat das mit der PN nicht funktioniert. Hatte mal Chat versucht. Ist leider gerade der Wurm drinnen. Kurzum ich würde gerne eine Platine nehmen. Vielen Dank und
          vG
          Stephan

          F 1 Reply Last reply Reply Quote 0
          • F
            Frissi @bischemer last edited by

            @bischemer
            alles klar - ist reserviert - mit dem Chat hat nun funktioniert 😉

            1 Reply Last reply Reply Quote 0
            • N
              Nobody 0 last edited by

              Hallo Zusammen,

              nach einigen Anlaufproblemen und einer Kalten Lötstelle auf dem NodeMCU habe ich nun endlich das Programm drauf bekommen und alles Verlötet.

              Leider habe ich nun das nächste Problem, wenn ich das Modul anschliesse und wieder Strom drauf geben hört man aus dem inneren nur ein leises Klackern, aber nichts geht.

              Beim aufrufen der Webseite des Moduls bekomme ich folgenden Fehler:
              404: File Not Found

              Geht die Weboberfläche nur wenn das Modul mit der Pumpe verbunden ist?
              Wo könnte das Klappern herkommen?
              Ich habe einen Lay-Z.Spa AirJet Hawaii von 2020.

              Chris 5 Rocco Friedrich 2 Replies Last reply Reply Quote 0
              • Reiner Gönnenwein
                Reiner Gönnenwein @michisa86888 last edited by

                @michisa86888 Ich hätte auch Interesse an einer Platine

                1 Reply Last reply Reply Quote 0
                • Chris 5
                  Chris 5 last edited by

                  Habe mir inzwischen auf Basis eines Wemos D1 mini das Projekt nachgebaut. Funktioniert tatsächlich auch ohne level shifter und damit ohne Platine , Wiederstände usw. . Bauaufwand sind 15 Minuten und in der Bucht bekommt die JST SM 6 pin Stecker+6 pin Buchse für unter 3 EUR genau wie den Wemos.
                  Die genaue Beschreibung des Aufbaus ist bei github in der Diskussions unter dem Titel "LLC - Why bother... It works fine without..." zu finden. Habe das Ganze so gelöst das der WEMOS, sollte er absterben, einfach ausgetauscht werden kann.
                  Läuft seid einer Woche ohne Probleme in meinem MIAMI 2021.
                  An der Intergration per MQTT bin ich gerade dran, danke für die Vorarbeit!

                  1 Reply Last reply Reply Quote 0
                  • Chris 5
                    Chris 5 @Nobody 0 last edited by

                    @nobody-0
                    die Daten für das Webinterface werden im Filesystem des ESPs abgelegt und müssen daher separat hochgeladen werden.
                    Zitat aus der Beschreibung für platformio:

                    Upload LittleFS Data or you will get a 404! Click platformio icon,
                    go to PROJECT TASKS > nodemcuv2 > Platform and build filesystem image, then upload filesystem image.

                    Das geht dann auch schon vor integration in der Pumpe.
                    Viel Erfolg

                    1 Reply Last reply Reply Quote 0
                    • B
                      BruderBleistift last edited by

                      Habe seit ca. 2 Wochen das Problem, dass sich das Modul scheinbar aufhängt.
                      Es ist dann nicht mehr möglich den Pool über die Tasten zu bedienen und auch über das Webinterface ist es nicht mehr erreichbar.

                      Beheben lässt es sich, indem ich kurz den Strom kappe. Dann startet das Modul neu und es funktioniert wieder - für 1-2 Tage.

                      Hat das Problem noch jemand, oder Ideen woran es liegen könnte? Eventuell ein Überhitzungsproblem? Lässt sich auf dem ESP irgendwie ein Kühlkörper anbringen und würde das in dem geschlossenen Pumpengehäuse überhaupt etwas bringen?

                      Chris 5 1 Reply Last reply Reply Quote 0
                      • Chris 5
                        Chris 5 @BruderBleistift last edited by

                        @bruderbleistift
                        bei mir wird nachts die Außensteckdose komplett abgeschaltet, damit das Teil jeden Tag quasi zwangsgebootet. Am besten mal direkt mal bei visualapproach in den discussions nachfragen.
                        Ist die WLAN Verbindung gut? Ich musste das Teil nach dem Einbau nochmals verschieben / verdrehen da die WLAN Verbindung verloren ging - konnte dann aber weiterhin über die Tasten bedienen.
                        Die sauberste Löstung wäre die Intergration eines watchdog timers weiß aber nicht ob das im Code gehen würde bzw. zusätzliche Hardware notwendig macht. Eine Überhitzung kann ich mir aber eigendlich nicht vorstellen eher eine Kontaktproblematik auf der Platine die bei hoheren Temperaturen zu Problemen führt - vielleicht noch mal nachlöten / Kontakte und Kabel prüfen?
                        mehr fällt mir dazu auch nicht ein - viel Erfolg

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

                          Update um die Außentemperatur (Umgebungstemperatur) über ioBroker zur Berechnung der virtuellen Temperatur einzubinden.

                          const Messages =  
                          {
                            "CONTENT": "STATES",
                            "LCK": 0,
                            "PWR": 0,
                            "UNT": 1,
                            "AIR": 0,
                            "GRN": 0,
                            "RED": 0,
                            "FLT": 0,
                            "TGT": 22,
                            "TMP": 13,
                            "CH1": 32,
                            "CH2": 49,
                            "CH3": 51,
                            "HJT": 0,
                            "BRT": 7,
                            "AMBC": 22
                          }
                          const ID = '0_userdata.0.LazySpa';
                          const MQTTINSTANCE = 0;
                          const debug = true;
                          /*
                          {
                            "CONTENT": "TIMES",
                            "TIME": 1650746370,
                            "CLTIME": 1644734714,
                            "FTIME": 1644734719,
                            "UPTIME": 41660,
                            "PUMPTIME": 50,
                            "HEATINGTIME": 24,
                            "AIRTIME": 512,
                            "JETTIME": 4294966,
                            "COST": 0,
                            "FINT": 4294967295,
                            "CLINT": 4294967295,
                            "KWH": null,
                            "TTTT": -74677
                          }
                          */
                          const STATES=[
                              {
                                  _id: 'LCK',
                                  type: 'state',
                                  common: {
                                      name: 'lock',
                                      type: 'boolean',
                                      role: 'switch',
                                      read: true,
                                      write: false,
                                      desc: 'Lazy spa lock'
                                  },
                                  native: {}
                              },
                              {
                                  _id: 'PWR',
                                  type: 'state',
                                  common: {
                                      name: 'power',
                                      type: 'boolean',
                                      role: 'switch.power',
                                      read: true,
                                      write: true,
                                      desc: 'Lazy spa power'
                                  },
                                  native: {}
                              },
                              {
                              _id: 'UNT',
                              type: 'state',
                              common: {
                                  name: 'unit',
                                  type: 'number',
                                  role: 'value',
                                  read: true,
                                  write: true,
                                  max: 1,
                                  desc: 'Lazy spa unit',
                                  states: {
                          				0: 'Farenheit',
                          				1: 'Celsius'
                          			}
                              },
                              native: {}
                              },
                              {
                              _id: 'AIR',
                              type: 'state',
                              common: {
                                  name: 'bubbles',
                                  type: 'boolean',
                                  role: 'switch',
                                  read: true,
                                  write: true,
                                  desc: 'Lazy spa bubbles state'
                              },
                              native: {}
                              },
                              {
                              _id: 'GRN',
                              type: 'state',
                              common: {
                                  name: 'Heating green',
                                  type: 'boolean',
                                  role: 'switch',
                                  read: true,
                                  write: false,
                                  desc: 'reached target temp.'
                              },
                              native: {}
                              },
                              {
                              _id: 'RED',
                              type: 'state',
                              common: {
                                  name: 'Heating red',
                                  type: 'boolean',
                                  role: 'switch',
                                  read: true,
                                  write: false,
                                  desc: 'not reached target temp.'
                              },
                              native: {}
                              },
                              {
                              _id: 'FLT',
                              type: 'state',
                              common: {
                                  name: 'pump',
                                  type: 'boolean',
                                  role: 'switch',
                                  read: true,
                                  write: true,
                                  desc: 'pump state'
                              },    native: {}
                              },
                              {
                              _id: 'HEATER',
                              type: 'state',
                              common: {
                                  name: 'heater',
                                  type: 'boolean',
                                  role: 'switch',
                                  read: true,
                                  write: true,
                                  desc: 'heater state'
                              },
                              native: {}
                              },
                              {
                              _id: 'TGT',
                              type: 'state',
                              common: {
                                  name: 'target temp',
                                  type: 'number',
                                  role: 'level.temperature',
                                  min: 20,
                                  max: 40,
                                  steps: 1,
                                  read: true,
                                  write: true,
                                  desc: 'taget temp.'
                              },
                              native: {}
                              },
                              {
                              _id: 'TMP',
                              type: 'state',
                              common: {
                                  name: 'temp',
                                  type: 'number',
                                  role: 'value.temperature',
                                  read: true,
                                  write: false,
                                  unit: '°C',
                                  desc: 'temp.'
                              },
                              native: {}
                              },
                                  {
                              _id: 'VTM',
                              type: 'state',
                              common: {
                                  name: 'temp',
                                  type: 'number',
                                  role: 'value.temperature',
                                  read: true,
                                  write: false,
                                  unit: '°C',
                                  desc: 'vtemp.'
                              },
                              native: {}
                              },
                              {
                              _id: 'AMBC',
                              type: 'state',
                              common: {
                                  name: 'ambient temp',
                                  type: 'number',
                                  role: 'value.temperature',
                                  read: false,
                                  write: true,
                                  desc: 'Ambienttemp.'
                              },
                              native: {}
                              },
                          ]
                           
                           
                          init();
                          async function stateChange(obj){
                              let id = obj.id
                              let state = id.split('.').pop()
                              let value = obj.state.val
                              log('change Unit' + state)
                              switch (state) {
                                  case 'UNT':
                                      setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":1,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                      log('change Unit')
                                  break;
                                  case 'TGT':
                                      setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":0,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                      log('change target temp. to '+ value);
                                  break;
                                  case 'AIR':
                                      value = value ? 1: 0 ;
                                      setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":2,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                      log('set bubbles to '+ value);
                                  break;
                                  case 'HEATER':
                                      value = value ? 1: 0 ;
                                      setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":3,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                      log('set Heater to '+ value);
                                  break;
                                  case 'FLT':
                                      value = value ? 1: 0 ;
                                      setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":4,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                      log('set pump to '+ value);
                                  break;
                                  case 'AMBC':
                                      setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":14,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                      log('change ambient temp. to '+ value);
                                  break;
                           
                           
                            default:
                              // Anweisungen werden ausgeführt,
                              // falls keine der case-Klauseln mit expression übereinstimmt
                              break;
                          }
                           
                           
                           
                          }
                          async function init(){
                              await asyncForEach(STATES, async (obj, index) => {
                                  let id = ID +'.'+ obj._id
                                  if (!existsState(id)) {
                                      log('create state '+ id)
                                      await createStateAsync(id, obj.common)
                                  }
                                  else {
                                      log('skip state '+ id)
                                  }
                                  //set subscription
                                  if(obj.common.write){
                                      on({id: id, change:"any"} , function(obj) {
                                          if(!obj.state.ack){
                                              log('change state! '+ JSON.stringify(obj))
                                              stateChange(obj)
                                          }
                                      });
                                  }       
                              });
                              log('init done!')
                          }
                          async function setLazyStates(obj){
                              try{
                                      let states = JSON.parse(obj)
                                      for (const [key, value] of Object.entries(states)) {
                                          let statevalue = value
                                          const found = STATES.find(state => state._id === key);
                                          if(found){                 
                                              if (found.common.type === 'boolean'){
                                                  statevalue = value === 1
                                              }
                                              await setStateAsync(ID +'.'+ key,statevalue,true)
                                          }
                                      }
                                      //set heater state
                                      await setStateAsync(ID +'.HEATER',(states.GRN || states.RED) === 1,true)    
                              }
                              catch(e){
                                  console.log('Error in setting State '+ e)
                              }
                           
                          }
                           
                          async function asyncForEach(array, callback) {
                          	for (let index = 0; index < array.length; index++) {
                          		await callback(array[index], index, array);
                          	}
                          }
                          function log (msg){
                              if(debug) console.log (msg)
                          }
                           
                          on({id:'mqtt.'+ MQTTINSTANCE+'.layzspa.message', change:"ne"} , function(obj) {
                              log('Lazyspa reached message! '+ JSON.stringify(obj.state))
                              setLazyStates(obj.state.val)
                          });
                          

                          Die Variable AMBC update ich bei Änderung der Außentemperatur. Ich lese die Außentemperatur über Netatmo ein.

                          NinjaTurtle85 1 Reply Last reply Reply Quote 0
                          • T
                            topoff82 last edited by topoff82

                            Hallo zusammen,

                            ich hätte mal ne Frage ob das Skript auch mit einem externen MQTT broker funktioniert - bzw. was ich hier ändern muss?
                            Ich habe in IoBroker nur den MQTT Client installiert - broker ist auf einem anderen raspberry (Loxberry) - die Werte vom Modul bekomm ich über den client rein (Datenpunkte mit Json werden in der Client Instanz angelegt) wenn ich layzspa/# subscribe - aber da eben nur die Json mit der ich aufgrund fehlenden Kentnissen leider nix anfangen kann ....... Jetzt hab ich das so verstanden dass das Skript die Json in die and in der 0.userdata Werte reingeschrieben wird (und da auch geändert/gesteuert werden kann?) - die 0.userdata Objekte hab ich - aber eben ohne Werte....

                            MQTT client in IoBroker: Instanzeinstellungen: mqtt-client.0 v1.6.3
                            -> muss ich hier etwas bei const MQTTINSTANCE = 0; ändern?

                            edit
                            -> hab jetzt bei const MQTTINSTANCE die IP Adresse meines MQTT Brokers (externer Raspberry und alternative die IP des Pool Moduls) eingegeben - leider schreibt er die Werte immer noch nicht .....
                            const ID = '0_userdata.0.LazySpa';
                            const MQTTINSTANCE = '192.168.2.151';
                            const debug = true;

                            das log initialisiert (checkt die Objekte in unserdata) aber wenn ich etwas änder gibt es weder beim log noch bei den Werten Änderungen ... sprich es passiert nichts mehr nach init done!

                            17:13:09.805	info	javascript.0 (24696) Start javascript script.js.common.layzspa
                            17:13:09.814	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.LCK
                            17:13:09.814	info	javascript.0 (24696) script.js.common.layzspa: subscribe: {"pattern":{"id":"mqtt.192.168.2.151.layzspa.message","change":"ne","q":0},"name":"script.js.common.layzspa"}
                            17:13:09.815	info	javascript.0 (24696) script.js.common.layzspa: registered 1 subscription, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
                            17:13:09.815	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.PWR
                            17:13:09.815	info	javascript.0 (24696) script.js.common.layzspa: subscribe: {"pattern":{"id":"0_userdata.0.LazySpa.PWR","change":"any","q":0},"name":"script.js.common.layzspa"}
                            17:13:09.816	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.UNT
                            17:13:09.817	info	javascript.0 (24696) script.js.common.layzspa: subscribe: {"pattern":{"id":"0_userdata.0.LazySpa.UNT","change":"any","q":0},"name":"script.js.common.layzspa"}
                            17:13:09.817	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.AIR
                            17:13:09.817	info	javascript.0 (24696) script.js.common.layzspa: subscribe: {"pattern":{"id":"0_userdata.0.LazySpa.AIR","change":"any","q":0},"name":"script.js.common.layzspa"}
                            17:13:09.818	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.GRN
                            17:13:09.818	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.RED
                            17:13:09.818	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.FLT
                            17:13:09.818	info	javascript.0 (24696) script.js.common.layzspa: subscribe: {"pattern":{"id":"0_userdata.0.LazySpa.FLT","change":"any","q":0},"name":"script.js.common.layzspa"}
                            17:13:09.818	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.HEATER
                            17:13:09.818	info	javascript.0 (24696) script.js.common.layzspa: subscribe: {"pattern":{"id":"0_userdata.0.LazySpa.HEATER","change":"any","q":0},"name":"script.js.common.layzspa"}
                            17:13:09.819	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.TGT
                            17:13:09.819	info	javascript.0 (24696) script.js.common.layzspa: subscribe: {"pattern":{"id":"0_userdata.0.LazySpa.TGT","change":"any","q":0},"name":"script.js.common.layzspa"}
                            17:13:09.819	info	javascript.0 (24696) script.js.common.layzspa: skip state 0_userdata.0.LazySpa.TMP
                            17:13:09.819	info	javascript.0 (24696) script.js.common.layzspa: init done!
                            

                            Wenn mir hier jemand auf die Sprünge helfen könnte wäre Prima!
                            Danke vorab & Gruß
                            Tom

                            1 Reply Last reply Reply Quote 0
                            • Agria4800
                              Agria4800 @Agria4800 last edited by Agria4800

                              @agria4800 : Anbei das Script für die Leute mit dem Layz Hawaii oder Maldives (mit den Hydrojet Düsen) 😉

                              // https://forum.iobroker.net/topic/51603/lay-z-spa-wifi-control?_=1655490942180&lang=de
                              
                              /*Notes for me
                              
                              Last filter change was 0.00 day(s) ago.  RESET Button gedrückt!
                              {"CMD":10,"VALUE":0,"XTIME":1658859596,"INTERVAL":0}
                              
                              
                              Last chlorine add was 0.00 day(s) ago.
                              {"CMD":9,"VALUE":0,"XTIME":1658859652,"INTERVAL":0}
                              */
                              
                              const Messages =  
                              {
                               "CONTENT": "STATES",
                               "LCK": 0,
                               "PWR": 0,
                               "UNT": 1,
                               "AIR": 0,
                               "GRN": 0,
                               "RED": 0,
                               "FLT": 0,
                               "TGT": 22,
                               "TMP": 13,
                               "CH1": 32,
                               "CH2": 49,
                               "CH3": 51,
                               "HJT": 0,
                               "BRT": 7
                              }
                              const ID = '0_userdata.0.Layz-Hydro';
                              const MQTTINSTANCE = 0;
                              const debug = true;
                              /*
                              {
                               "CONTENT": "TIMES",
                               "TIME": 1650746370,
                               "CLTIME": 1644734714,
                               "FTIME": 1644734719,
                               "UPTIME": 41660,
                               "PUMPTIME": 50,
                               "HEATINGTIME": 24,
                               "AIRTIME": 512,
                               "JETTIME": 4294966,
                               "COST": 0,
                               "FINT": 4294967295,
                               "CLINT": 4294967295,
                               "KWH": null,
                               "TTTT": -74677
                              }
                              */
                              const STATES=[
                                 {
                                     _id: 'LCK',
                                     type: 'state',
                                     common: {
                                         name: 'lock',
                                         type: 'boolean',
                                         role: 'switch',
                                         read: true,
                                         write: false,
                                         desc: 'Lazy spa lock'
                                     },
                                     native: {}
                                 },
                                 {
                                     _id: 'PWR',
                                     type: 'state',
                                     common: {
                                         name: 'power',
                                         type: 'boolean',
                                         role: 'switch.power',
                                         read: true,
                                         write: true,
                                         desc: 'Lazy spa power'
                                     },
                                     native: {}
                                 },
                                 {
                                 _id: 'UNT',
                                 type: 'state',
                                 common: {
                                     name: 'unit',
                                     type: 'number',
                                     role: 'value',
                                     read: true,
                                     write: true,
                                     max: 1,
                                     desc: 'Lazy spa unit',
                                     states: {
                                 			0: 'Farenheit',
                                 			1: 'Celsius'
                                 		}
                                 },
                                    native: {}
                                 },
                                 {
                                 _id: 'HJT',
                                 type: 'state',
                                 common: {
                                     name: 'Hydrojet',
                                     type: 'boolean',
                                     role: 'switch',
                                     read: true,
                                     write: true,
                                     desc: 'Lazy spa Hydrojets state'
                                 },
                                    native: {}
                                 },
                                 {
                                 _id: 'AIR',
                                 type: 'state',
                                 common: {
                                     name: 'bubbles',
                                     type: 'boolean',
                                     role: 'switch',
                                     read: true,
                                     write: true,
                                     desc: 'Lazy spa bubbles state'
                                 },
                                 native: {}
                                 },
                                 {
                                 _id: 'GRN',
                                 type: 'state',
                                 common: {
                                     name: 'Heating green',
                                     type: 'boolean',
                                     role: 'switch',
                                     read: true,
                                     write: false,
                                     desc: 'reached target temp.'
                                 },
                                 native: {}
                                 },
                                 {
                                 _id: 'RED',
                                 type: 'state',
                                 common: {
                                     name: 'Heating red',
                                     type: 'boolean',
                                     role: 'switch',
                                     read: true,
                                     write: false,
                                     desc: 'not reached target temp.'
                                 },
                                 native: {}
                                 },
                                 {
                                 _id: 'FLT',
                                 type: 'state',
                                 common: {
                                     name: 'pump',
                                     type: 'boolean',
                                     role: 'switch',
                                     read: true,
                                     write: true,
                                     desc: 'pump state'
                                 },    native: {}
                                 },
                                 {
                                 _id: 'HEATER',
                                 type: 'state',
                                 common: {
                                     name: 'heater',
                                     type: 'boolean',
                                     role: 'switch',
                                     read: true,
                                     write: true,
                                     desc: 'heater state'
                                 },
                                 native: {}
                                 },
                                 {
                                 _id: 'TGT',
                                 type: 'state',
                                 common: {
                                     name: 'target temp',
                                     type: 'number',
                                     role: 'level.temperature',
                                     min: 20,
                                     max: 40,
                                     steps: 1,
                                     read: true,
                                     write: true,
                                     desc: 'taget temp.'
                                 },
                                 native: {}
                                 },
                                 {
                                 _id: 'TMP',
                                 type: 'state',
                                 common: {
                                     name: 'temp',
                                     type: 'number',
                                     role: 'value.temperature',
                                     read: true,
                                     write: false,
                                     unit: '°C',
                                     desc: 'temp.'
                                 },
                                 native: {}
                                 },
                              ]
                              
                              
                              init();
                              async function stateChange(obj){
                                 let id = obj.id
                                 let state = id.split('.').pop()
                                 let value = obj.state.val
                                 log('change Unit' + state)
                                 switch (state) {
                                     case 'UNT':
                                         setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":1,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                         log('change Unit')
                                     break;
                                     case 'TGT':
                                         setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":0,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                         log('change target temp. to '+ value);
                                     break;
                                     case 'AIR':
                                         value = value ? 1: 0 ;
                                         setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":2,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                         log('set bubbles to '+ value);
                                     break;
                                      case 'HJT':
                                         value = value ? 1: 0 ;
                                         setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":11,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                         log('set Hydrojets to '+ value);
                                     break;
                                     case 'HEATER':
                                         value = value ? 1: 0 ;
                                         setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":3,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                         log('set Heater to '+ value);
                                     break;
                                     case 'FLT':
                                         value = value ? 1: 0 ;
                                         setStateAsync('mqtt.'+ MQTTINSTANCE+'.layzspa.command','{"CMD":4,"VALUE":'+ value +',"XTIME":0,"INTERVAL":0}')
                                         log('set pump to '+ value);
                                     break;
                                  
                              
                              
                               default:
                                 // Anweisungen werden ausgeführt,
                                 // falls keine der case-Klauseln mit expression übereinstimmt
                                 break;
                              }
                              
                              
                              
                              }
                              async function init(){
                                 await asyncForEach(STATES, async (obj, index) => {
                                     let id = ID +'.'+ obj._id
                                     if (!existsState(id)) {
                                         log('create state '+ id)
                                         await createStateAsync(id, obj.common)
                                     }
                                     else {
                                         log('skip state '+ id)
                                     }
                                     //set subscription
                                     if(obj.common.write){
                                         on({id: id, change:"any"} , function(obj) {
                                             if(!obj.state.ack){
                                                 log('change state! '+ JSON.stringify(obj))
                                                 stateChange(obj)
                                             }
                                         });
                                     }       
                                 });
                                 log('init done!')
                              }
                              async function setLazyStates(obj){
                                 try{
                                         let states = JSON.parse(obj)
                                         for (const [key, value] of Object.entries(states)) {
                                             let statevalue = value
                                             const found = STATES.find(state => state._id === key);
                                             if(found){                 
                                                 if (found.common.type === 'boolean'){
                                                     statevalue = value === 1
                                                 }
                                                 await setStateAsync(ID +'.'+ key,statevalue,true)
                                             }
                                         }
                                         //set heater state
                                         await setStateAsync(ID +'.HEATER',(states.GRN || states.RED) === 1,true)    
                                 }
                                 catch(e){
                                     console.log('Error in setting State '+ e)
                                 }
                              
                              }
                              
                              async function asyncForEach(array, callback) {
                                 for (let index = 0; index < array.length; index++) {
                                 	await callback(array[index], index, array);
                                 }
                              }
                              function log (msg){
                                 if(debug) console.log (msg)
                              }
                              
                              on({id:'mqtt.'+ MQTTINSTANCE+'.layzspa.message', change:"ne"} , function(obj) {
                                 log('Lazyspa reached message! '+ JSON.stringify(obj.state))
                                 setLazyStates(obj.state.val)
                              });
                              
                              

                              Und so siehts dann aus...Bildschirmfoto 2022-08-12 um 21.17.52.png

                              Grüße

                              Agria4800 S M B T 6 Replies Last reply Reply Quote 0
                              • Agria4800
                                Agria4800 @Agria4800 last edited by

                                @agria4800
                                Hiermit bekommt man die Zeiten ausgelesen:

                                var Souce_other, Source, RSSI, Times, Chlortime, Filtertime, Uptime, Pumptime, Heating, Airtime, Hydrojet_Time, Costs, Verbrauch;
                                
                                
                                on({id: [].concat(['mqtt.0.layzspa.other']), change: "ne"}, async function (obj) {
                                 var value = obj.state.val;
                                 var oldValue = obj.oldState.val;
                                 Souce_other = getState("mqtt.0.layzspa.other").val;
                                 await wait(100);
                                 RSSI = getAttr(Souce_other, 'RSSI');
                                 setState("0_userdata.0.LazySpa.RSSI-Wifi"/*RSSI-Wifi*/, parseFloat(RSSI), true);
                                });
                                on({id: [].concat(['mqtt.0.layzspa.times']), change: "ne"}, async function (obj) {
                                 var value = obj.state.val;
                                 var oldValue = obj.oldState.val;
                                 Source = getState("mqtt.0.layzspa.times").val;
                                 await wait(100);
                                 Times = getAttr(Source, 'TIME');
                                 setState("0_userdata.0.LazySpa.Times.Time"/*Time*/, parseFloat(Times), true);
                                 Chlortime = getAttr(Source, 'CLTIME');
                                 setState("0_userdata.0.LazySpa.Times.Chlor_Time"/*Chlor_Time*/, Chlortime, true);
                                 Filtertime = getAttr(Source, 'FTIME');
                                 setState("0_userdata.0.LazySpa.Times.Filter_Time"/*Filter_Time*/, parseFloat(Filtertime), true);
                                 Uptime = getAttr(Source, 'UPTIME');
                                 setState("0_userdata.0.LazySpa.Times.Up_Time"/*Up_Time*/, parseFloat(Uptime), true);
                                 Pumptime = getAttr(Source, 'PUMPTIME');
                                 setState("0_userdata.0.LazySpa.Times.Pump_Time"/*Pump_Time*/, parseFloat(Pumptime), true);
                                 Heating = getAttr(Source, 'HEATINGTIME');
                                 setState("0_userdata.0.LazySpa.Times.Heating_Time"/*Heating Time*/, parseFloat(Heating), true);
                                 Airtime = getAttr(Source, 'AIRTIME');
                                 setState("0_userdata.0.LazySpa.Times.Air_Time"/*Air_Time*/, parseFloat(Airtime), true);
                                 Hydrojet_Time = getAttr(Source, 'JETTIME');
                                 setState("0_userdata.0.LazySpa.Times.Hydrojet_Time"/*Hydrojet_Time*/, parseFloat(Hydrojet_Time), true);
                                 Costs = getAttr(Source, 'COST');
                                 setState("0_userdata.0.LazySpa.Times.Cost"/*Cost*/, parseFloat(Costs), true);
                                 Verbrauch = getAttr(Source, 'KWH');
                                 setState("0_userdata.0.LazySpa.Times.Verbrauch"/*Verbrauch*/, parseFloat(Verbrauch), true);
                                });
                                
                                
                                

                                und hiermit werden sie umgeschrieben analog !Bildschirmfoto 2022-08-12 um 21.15.48.png

                                var Dauer, tage, std, min, sec;
                                
                                
                                // https://forum.iobroker.net/topic/13488/vorlage-blockly-umrechnung-von-sekunden-in-stunden-minuten-und-sekunden/11
                                
                                on({id: "0_userdata.0.LazySpa.Times.Up_Time"/*Up_Time*/, change: "ne"}, async function (obj) {
                                 var value = obj.state.val;
                                 var oldValue = obj.oldState.val;
                                 Dauer = getState("0_userdata.0.LazySpa.Times.Up_Time").val;
                                 tage = Math.floor(parseFloat(Dauer) / 86400);
                                 Dauer = parseFloat(Dauer) - parseFloat(tage) * 86400;
                                 std = Math.floor(parseFloat(Dauer) / 3600);
                                 Dauer = parseFloat(Dauer) - parseFloat(std) * 3600;
                                 min = Math.floor(parseFloat(Dauer) / 60);
                                 Dauer = parseFloat(Dauer) - parseFloat(min) * 60;
                                 sec = Math.floor(parseFloat(Dauer) / 1);
                                 setState("0_userdata.0.LazySpa.Times.Format-Up-Time"/*Format-Up-Time*/, ([tage,'D -  ',std,'h:',min,'min:',sec,'sec'].join('')));
                                });
                                on({id: "0_userdata.0.LazySpa.Times.Air_Time"/*Air_Time*/, change: "ne"}, async function (obj) {
                                 var value = obj.state.val;
                                 var oldValue = obj.oldState.val;
                                 Dauer = getState("0_userdata.0.LazySpa.Times.Air_Time").val;
                                 tage = Math.floor(parseFloat(Dauer) / 86400);
                                 Dauer = parseFloat(Dauer) - parseFloat(tage) * 86400;
                                 std = Math.floor(parseFloat(Dauer) / 3600);
                                 Dauer = parseFloat(Dauer) - parseFloat(std) * 3600;
                                 min = Math.floor(parseFloat(Dauer) / 60);
                                 Dauer = parseFloat(Dauer) - parseFloat(min) * 60;
                                 sec = Math.floor(parseFloat(Dauer) / 1);
                                 setState("0_userdata.0.LazySpa.Times.Format-Air-Time"/*Format-Air-Time*/, ([tage,'D -  ',std,'h:',min,'min:',sec,'sec'].join('')));
                                });
                                on({id: "0_userdata.0.LazySpa.Times.Heating_Time"/*Heating Time*/, change: "ne"}, async function (obj) {
                                 var value = obj.state.val;
                                 var oldValue = obj.oldState.val;
                                 Dauer = getState("0_userdata.0.LazySpa.Times.Heating_Time").val;
                                 tage = Math.floor(parseFloat(Dauer) / 86400);
                                 Dauer = parseFloat(Dauer) - parseFloat(tage) * 86400;
                                 std = Math.floor(parseFloat(Dauer) / 3600);
                                 Dauer = parseFloat(Dauer) - parseFloat(std) * 3600;
                                 min = Math.floor(parseFloat(Dauer) / 60);
                                 Dauer = parseFloat(Dauer) - parseFloat(min) * 60;
                                 sec = Math.floor(parseFloat(Dauer) / 1);
                                 setState("0_userdata.0.LazySpa.Times.Format-Heating-Time"/*Format-Heating-Time*/, ([tage,'D -  ',std,'h:',min,'min:',sec,'sec'].join('')));
                                });
                                on({id: "0_userdata.0.LazySpa.Times.Pump_Time"/*Pump_Time*/, change: "ne"}, async function (obj) {
                                 var value = obj.state.val;
                                 var oldValue = obj.oldState.val;
                                 Dauer = getState("0_userdata.0.LazySpa.Times.Pump_Time").val;
                                 tage = Math.floor(parseFloat(Dauer) / 86400);
                                 Dauer = parseFloat(Dauer) - parseFloat(tage) * 86400;
                                 std = Math.floor(parseFloat(Dauer) / 3600);
                                 Dauer = parseFloat(Dauer) - parseFloat(std) * 3600;
                                 min = Math.floor(parseFloat(Dauer) / 60);
                                 Dauer = parseFloat(Dauer) - parseFloat(min) * 60;
                                 sec = Math.floor(parseFloat(Dauer) / 1);
                                 setState("0_userdata.0.LazySpa.Times.Format-Pump-Time"/*Format-Pump-Time*/, ([tage,'D -  ',std,'h:',min,'min:',sec,'sec'].join('')));
                                });
                                
                                on({id: "0_userdata.0.LazySpa.Times.Hydrojet_Time"/*Hydrojet_Time*/, change: "ne"}, async function (obj) {
                                 var value = obj.state.val;
                                 var oldValue = obj.oldState.val;
                                 Dauer = getState("0_userdata.0.LazySpa.Times.Hydrojet_Time").val;
                                 tage = Math.floor(parseFloat(Dauer) / 86400);
                                 Dauer = parseFloat(Dauer) - parseFloat(tage) * 86400;
                                 std = Math.floor(parseFloat(Dauer) / 3600);
                                 Dauer = parseFloat(Dauer) - parseFloat(std) * 3600;
                                 min = Math.floor(parseFloat(Dauer) / 60);
                                 Dauer = parseFloat(Dauer) - parseFloat(min) * 60;
                                 sec = Math.floor(parseFloat(Dauer) / 1);
                                 setState("0_userdata.0.LazySpa.Times.Format-Hydrojet-Time"/*Format-Hydrojet-Time*/, ([tage,'D -  ',std,'h:',min,'min:',sec,'sec'].join('')));
                                });
                                

                                Z 1 Reply Last reply Reply Quote 0
                                • A
                                  anderl last edited by

                                  Hallo zusammen, hat irgendjemand noch eine Platine abzugeben? Leider unbedarft, trotzdem neue Herausforderung gesucht 😀 Danke und Grüße Andy

                                  R 1 Reply Last reply Reply Quote 0
                                  • Bjoern Weiss
                                    Bjoern Weiss last edited by

                                    Hallo zusammen,
                                    ich habe ein kleines Problem. Hat jemand eine Idee, warum mir in dem Anzeigefeld keine Temperatur angezeigt wird?
                                    Wenn es einen Fehler wie beispielsweise E02 etc gibt, wird dieser dort aber angezeigt.
                                    Lazy.jpg

                                    Ist ein Vegas (54112), allerdings mit 4-adrigen Verkabelung statt wie angegeben 6 Adern.

                                    Hab übrigends noch Platinen übrig wenn jemand noch eine benötigt.

                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      Rickman @anderl last edited by

                                      @anderl
                                      Ich habe gestern die PCB v2 bestellt. Wollte für den Winter auch schon mal was zum basteln haben.
                                      Sobald die da sind, kann ich Dir Bescheid geben.

                                      Falls noch jemand welche benötigt - habe dann immer noch 3 übrig. 😉

                                      Gruß,
                                      Richy

                                      allesautomatisch 1 Reply Last reply Reply Quote 0
                                      • allesautomatisch
                                        allesautomatisch @Rickman last edited by

                                        @rickman
                                        Ich würde Dir ein v2 PCB abnehmen.

                                        Vielen Dank und Gruß,
                                        Michael

                                        R 1 Reply Last reply Reply Quote 0
                                        • R
                                          Rickman @allesautomatisch last edited by

                                          @allesautomatisch
                                          Hast ne Chatnachricht... 🙂

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

                                            Ich habe noch 4 Platinen V1 da und einen Satz mit 6 poligen JST-SM. Wenn Interesse besteht bitte PN.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            660
                                            Online

                                            31.6k
                                            Users

                                            79.4k
                                            Topics

                                            1.3m
                                            Posts

                                            71
                                            202
                                            26124
                                            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