Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Hardware
    4. SONOFF NSPanel mit Lovelace UI

    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.

    SONOFF NSPanel mit Lovelace UI

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

      @peoples sagte in SONOFF NSPanel mit Lovelace UI:

      ist es möglich bspw. bei Licht zwei verschiedene Symbole für On und Off zu verwenden?

      Bei den Gerätetypen Steckdose und Licht kannst du auch ein icon2 im pageItem mitgeben. Für die anderen Licht-Gerätetypen habe ich es noch nicht übernommen, wäre aber ebenfalls sinnvoll...

      1 Reply Last reply Reply Quote 0
      • J
        Julez318 @Armilar last edited by

        @armilar
        wollte gerade meinen javascript Adapter auch auf die 6.1.3 updaten. Nur leider ist bei mir seit der installierten Version 6.0.3 kein Update mehr verfügbar.

        Hat das Problem hier auch schon jemand gehabt?

        Vumer Thomas Braun 2 Replies Last reply Reply Quote 0
        • Vumer
          Vumer @Julez318 last edited by Vumer

          @julez318
          fdc4ae1a-6f29-41bf-970b-14a5f54075af-grafik.png
          9918737e-3b76-4562-b330-4390dcf1dc15-grafik.png

          1 Reply Last reply Reply Quote 1
          • J
            jprisum.de last edited by

            wie kann ich Berry-Driver Update durchführen?
            NSPanel-Update.jpg
            Ein Click auf ja langt nicht, es verschwindet zwar die Anzeige aber ein paar Std später ist es wieder da.

            Armilar 1 Reply Last reply Reply Quote 0
            • Thomas Braun
              Thomas Braun Most Active @Julez318 last edited by

              @julez318 sagte in SONOFF NSPanel mit Lovelace UI:

              Hat das Problem hier auch schon jemand gehabt?

              Das ist kein Problem, das sind einfach die zur Zeit in den einzelnen Repos verfübaren Versionen.

              javascript
              github:	6.1.3
              latest:	6.1.3 for 7 days
              stable:	6.0.3 for 58 days
              
              D 1 Reply Last reply Reply Quote 0
              • D
                danny_v1 @Thomas Braun last edited by

                So ich habe gerade alles nach Anleitung installiert. Ich habe das PanelTs ohne Beispiele verwendet und bekomme beim Start des Skriptes folgende Fehlermeldung:

                javascript.0 (13719) script.js.common.NSPanel_DEV.NSPanelTs: TypeScript compilation failed: await createAliasAsync(config.weatherEntity + '.ICON', 'accuweather.0.Current.WeatherIcon', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ICON' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(config.weatherEntity + '.TEMP', 'accuweather.0.Current.Temperature', true, <iobJS.StateCommon>{ type: 'number', role: 'value.temperature', name: 'TEMP' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(config.weatherEntity + '.TEMP_MIN', 'accuweather.0.Daily.Day1.Temperature.Minimum', true, <iobJS.StateCommon>{ type: 'number', role: 'value.temperature.forecast.0', name: 'TEMP_MIN' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(config.weatherEntity + '.TEMP_MAX', 'accuweather.0.Daily.Day1.Temperature.Maximum', true, <iobJS.StateCommon>{ type: 'number', role: 'value.temperature.max.forecast.0', name: 'TEMP_MAX' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Dimmode.brightnessDay.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Dimmode.brightnessDay.SET', NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Dimmode.hourDay.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_hourDay', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Dimmode.hourDay.SET', NSPanel_Path + 'NSPanel_Dimmode_hourDay', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Dimmode.brightnessNight.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Dimmode.brightnessNight.SET', NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Dimmode.hourNight.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_hourNight', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Dimmode.hourNight.SET', NSPanel_Path + 'NSPanel_Dimmode_hourNight', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'autoUpdate.ACTUAL', NSPanel_Path + 'NSPanel_autoUpdate', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'autoUpdate.SET', NSPanel_Path + 'NSPanel_autoUpdate', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'SET' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'ipAddress.ACTUAL', NSPanel_Path + 'NSPanel_ipAddress', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Display.BerryDriver.ACTUAL', NSPanel_Path + 'Berry_Driver.currentVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Uptime.ACTUAL', NSPanel_Path + 'Tasmota.Uptime', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Version.ACTUAL', NSPanel_Path + 'Tasmota.Version', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Hardware.ACTUAL', NSPanel_Path + 'Tasmota.Hardware', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Wifi.AP.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.AP', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Wifi.SSId.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.SSId', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Wifi.BSSId.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.BSSId', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Wifi.Channel.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Channel', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Wifi.Mode.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Mode', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Wifi.RSSI.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.RSSI', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Tasmota.Wifi.Signal.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Signal', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Display.TFTVersion.ACTUAL', NSPanel_Path + 'Display_Firmware.currentVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Display.Model.ACTUAL', NSPanel_Path + 'NSPanel_Version', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.ACTUAL', dpPath + '.Player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'value.volume', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.ALBUM', dpPath + '.Player.currentAlbum', true, <iobJS.StateCommon>{ type: 'string', role: 'media.album', name: 'ALBUM' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.ARTIST', dpPath + '.Player.currentArtist', true, <iobJS.StateCommon>{ type: 'string', role: 'media.artist', name: 'ARTIST' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.TITLE', dpPath + '.Player.currentTitle', true, <iobJS.StateCommon>{ type: 'string', role: 'media.title', name: 'TITLE' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.NEXT', dpPath + '.Player.controlNext', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.next', name: 'NEXT' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.PREV', dpPath + '.Player.controlPrevious', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.prev', name: 'PREV' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.PLAY', dpPath + '.Player.controlPlay', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.play', name: 'PLAY' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.PAUSE', dpPath + '.Player.controlPause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.pause', name: 'PAUSE' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.STOP', dpPath + '.Commands.deviceStop', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.stop', name: 'STOP' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.STATE', dpPath + '.Player.currentState', true, <iobJS.StateCommon>{ type: 'boolean', role: 'media.state', name: 'STATE' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.VOLUME', dpPath + '.Player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'level.volume', name: 'VOLUME' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.ACTUAL', dpPath + 'player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'value.volume', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.ALBUM', dpPath + 'player.album', true, <iobJS.StateCommon>{ type: 'string', role: 'media.album', name: 'ALBUM' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.ARTIST', dpPath + 'player.artistName', true, <iobJS.StateCommon>{ type: 'string', role: 'media.artist', name: 'ARTIST' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.TITLE', dpPath + 'player.trackName', true, <iobJS.StateCommon>{ type: 'string', role: 'media.title', name: 'TITLE' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.CONTEXT_DESCRIPTION', dpPath + 'player.contextDescription', true, <iobJS.StateCommon>{ type: 'string', role: 'media.station', name: 'CONTEXT_DESCRIPTION' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.NEXT', dpPath + 'player.skipPlus', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.next', name: 'NEXT' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.PREV', dpPath + 'player.skipMinus', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.prev', name: 'PREV' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.PLAY', dpPath + 'player.play', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.play', name: 'PLAY' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.PAUSE', dpPath + 'player.pause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.pause', name: 'PAUSE' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.STOP', dpPath + 'player.pause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.stop', name: 'STOP' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.STATE', dpPath + 'player.isPlaying', true, <iobJS.StateCommon>{ type: 'boolean', role: 'media.state', name: 'STATE' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.VOLUME', dpPath + 'player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'level.volume', name: 'VOLUME' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.ACTUAL', dpPath + '.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'value.volume', name: 'ACTUAL' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.ALBUM', dpPath + '.current_album', true, <iobJS.StateCommon>{ type: 'string', role: 'media.album', name: 'ALBUM' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.ARTIST', dpPath + '.current_artist', true, <iobJS.StateCommon>{ type: 'string', role: 'media.artist', name: 'ARTIST' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.TITLE', dpPath + '.current_title', true, <iobJS.StateCommon>{ type: 'string', role: 'media.title', name: 'TITLE' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.CONTEXT_DESCRIPTION', dpPath + '.current_station', true, <iobJS.StateCommon>{ type: 'string', role: 'media.station', name: 'CONTEXT_DESCRIPTION' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.NEXT', dpPath + '.next', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.next', name: 'NEXT' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.PREV', dpPath + '.prev', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.prev', name: 'PREV' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.PLAY', dpPath + '.play', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.play', name: 'PLAY' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.PAUSE', dpPath + '.pause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.pause', name: 'PAUSE' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.STOP', dpPath + '.stop', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.stop', name: 'STOP' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.STATE', dpPath + '.state_simple', true, <iobJS.StateCommon>{ type: 'boolean', role: 'media.state', name: 'STATE' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(id + '.VOLUME', dpPath + '.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'level.volume', name: 'VOLUME' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Sensor.ANALOG.Temperature.ACTUAL', NSPanel_Path + 'Sensor.ANALOG.Temperature', true, <iobJS.StateCommon>{ type: 'number', 'unit': '°C' }); ^ ERROR: Cannot find name 'createAliasAsync'. await createAliasAsync(AliasPath + 'Sensor.ESP32.Temperature.ACTUAL', NSPanel_Path + 'Sensor.ESP32.Temperature', true, <iobJS.StateCommon>{ type: 'number', 'unit': '°C' }); ^ ERROR: Cannot find name 'createAliasAsync'.
                

                leigt bestimmt am anlegen der Wetterdatenpunkte.

                Armilar 1 Reply Last reply Reply Quote 0
                • Armilar
                  Armilar Most Active Forum Testing @danny_v1 last edited by

                  @danny_v1

                  Nein, liegt daran, dass du die TS-Version 3.5.0.5 benutzt, aber nicht den JavaScript-Adapter in der Version 6.1.3

                  1 Reply Last reply Reply Quote 0
                  • Armilar
                    Armilar Most Active Forum Testing @jprisum.de last edited by

                    @jprisum-de

                    Manuelle Updates auf false stellen (oben im Script) oder in der 0_userdata.0. eine 4 eintragen...

                    4666709e-8e5e-44a4-882c-338c68480d69-image.png

                    D J 2 Replies Last reply Reply Quote 0
                    • D
                      danny_v1 @Armilar last edited by

                      @armilar ich hab javaskript 6.0.3. Zeigt mir auch keine Aktualisierung an.

                      denk manuelle updates sind aus

                      let manually_Update = false;
                      

                      aber die Datenpunkte aus deinem Bild existieren bei mir nicht.

                      Armilar 1 Reply Last reply Reply Quote 0
                      • Armilar
                        Armilar Most Active Forum Testing @danny_v1 last edited by Armilar

                        @danny_v1 nee, für dich war nicht der Post mit den manuellen Updates

                        Sie mal ein paar Posts zurück. Da steht was über das Beta-Repository

                        https://forum.iobroker.net/post/890251

                        D 1 Reply Last reply Reply Quote 0
                        • D
                          danny_v1 @Armilar last edited by danny_v1

                          @armilar ok mit dem update vom skriptadapter läufts! Aber der Nextion editor warte immer noch auf content

                          Edit: hab gerade gemerkt mit fehlt der Datenpunkt customSend.

                          Edit2: Datenpunkt ist jetzt angelegt, jetzt kommt der Berry-Driver Update Bildschirm aber agal was ich mache "ja", "nein" oder "x" nichts passiert

                          Edit3: Nextion Editor neu gestartet jetzt hab ich wieder Waiting for content und im CustomSend steht Timeout 20

                          Armilar 1 Reply Last reply Reply Quote 0
                          • Armilar
                            Armilar Most Active Forum Testing @danny_v1 last edited by

                            @danny_v1 diese Lösung steht 4 Posts zurück

                            D 1 Reply Last reply Reply Quote 0
                            • D
                              danny_v1 @Armilar last edited by

                              @armilar ok 4 ist eingetragen, aber ich hänge mal wieder im waiting for content

                              Armilar 1 Reply Last reply Reply Quote 0
                              • Armilar
                                Armilar Most Active Forum Testing @danny_v1 last edited by

                                @danny_v1

                                Ich habe die Vermutung, dass deine autoexec.be im Tasmota auf 0 kb steht. Sieh mal nach und wenn es so ist, dann erneuere sie nochmals

                                D 1 Reply Last reply Reply Quote 0
                                • D
                                  danny_v1 @Armilar last edited by

                                  @armilar autoexec.be steht auf 3720 aber ich spiel sie noch mal neu ein

                                  Armilar 1 Reply Last reply Reply Quote 0
                                  • Armilar
                                    Armilar Most Active Forum Testing @danny_v1 last edited by Armilar

                                    @danny_v1

                                    Moment bist du mit der Emu unterwegs oder mit dem Original-Panel? Das sind zwei unterschiedliche Berry Treiber

                                    Der wäre für das Original-Panel
                                    https://github.com/joBr99/nspanel-lovelace-ui/blob/main/tasmota/autoexec.be

                                    Der nachfolgende für die Emulation:

                                    # Nextion Serial Protocol driver by joBr99 + nextion upload protocol 1.2 (the fast one yay) implementation using http range and tcpclient
                                    # based on;
                                    # Sonoff NSPanel Tasmota driver v0.47 | code by blakadder and s-hadinger
                                     
                                    class Nextion : Driver
                                     
                                        var ser
                                    	var flash_size
                                    	var flash_mode
                                    	var flash_skip
                                    	var flash_current_byte
                                    	var tftd
                                    	var progress_percentage_last
                                    	static header = bytes('55BB')
                                     
                                        def init()
                                            log("NSP: Initializing Driver")
                                            self.ser = serial(3, 1, 115200, serial.SERIAL_8N1)
                                            self.flash_mode = 0
                                    		self.flash_skip = false
                                    		tasmota.add_driver(self)
                                        end
                                    	
                                        def crc16(data, poly)
                                          if !poly  poly = 0xA001 end
                                          # CRC-16 MODBUS HASHING ALGORITHM
                                          var crc = 0xFFFF
                                          for i:0..size(data)-1
                                            crc = crc ^ data[i]
                                            for j:0..7
                                              if crc & 1
                                                crc = (crc >> 1) ^ poly
                                              else
                                                crc = crc >> 1
                                              end
                                            end
                                          end
                                          return crc
                                        end
                                    	
                                        def split_55(b)
                                          var ret = []
                                          var s = size(b)   
                                          var i = s-2   # start from last
                                          while i > 0
                                            if b[i] == 0x55 && b[i+1] == 0xBB           
                                              ret.push(b[i..s-1]) # push last msg to list
                                              b = b[(0..i-1)]   # write the rest back to b
                                            end
                                            i -= 1
                                          end
                                          ret.push(b)
                                          return ret
                                        end
                                     
                                    	# encode using custom protocol 55 BB [payload length] [payload] [crc] [crc]
                                        def encode(payload)
                                          var b = bytes()
                                          b += self.header
                                          b.add(size(payload), 2)   # add size as 1 byte
                                          b += bytes().fromstring(payload)
                                          var msg_crc = self.crc16(b)
                                          b.add(msg_crc, 2)       # crc 2 bytes, little endian
                                          return b
                                        end
                                    	
                                    	# send a nextion payload
                                    	def encodenx(payload)
                                    		var b = bytes().fromstring(payload)
                                    		b += bytes('FFFFFF')
                                    		return b
                                    	end
                                    	
                                    	def sendnx(payload)
                                    		var payload_bin = self.encodenx(payload)
                                    		self.ser.write(payload_bin)
                                    		 print("NSP: Sent =", payload_bin)
                                    		log("NSP: Nextion command sent = " + str(payload_bin), 3)
                                    	end
                                      
                                        def send(payload)
                                            var payload_bin = self.encode(payload)
                                            if self.flash_mode==1
                                                log("NSP: skipped command becuase still flashing", 3)
                                            else 
                                                self.ser.write(payload_bin)
                                                log("NSP: payload sent = " + str(payload_bin), 3)
                                            end
                                        end
                                    		
                                    	def every_100ms()
                                            import string
                                            if self.ser.available() > 0
                                                var msg = self.ser.read()
                                                if size(msg) > 0
                                                    print("NSP: Received Raw =", msg)
                                                    if self.flash_mode==1
                                                        log("no flashing in this version")
                                                    else
                                    					# Recive messages using custom protocol 55 BB [payload length] [payload length] [payload] [crc] [crc]
                                    					if msg[0..1] == self.header
                                    						var lst = self.split_55(msg)
                                    						for i:0..size(lst)-1
                                    							msg = lst[i]
                                    							#var j = msg[2]+2
                                    							var j = size(msg) - 3
                                    							msg = msg[4..j]
                                    							if size(msg) > 2
                                    								var jm = string.format("{\"CustomRecv\":\"%s\"}",msg.asstring())
                                    								tasmota.publish_result(jm, "RESULT")
                                    							end
                                    						end
                                    					elif msg == bytes('000000FFFFFF88FFFFFF')
                                    						log("NSP: Screen Initialized")
                                    					else
                                                            var jm = string.format("{\"nextion\":\"%s\"}",str(msg[0..-4]))
                                    						tasmota.publish_result(jm, "RESULT")
                                    					end       			
                                                    end
                                                end
                                            end
                                        end
                                    end
                                     
                                    var nextion = Nextion()
                                     
                                    def send_cmd(cmd, idx, payload, payload_json)
                                        nextion.sendnx(payload)
                                        tasmota.resp_cmnd_done()
                                    end
                                     
                                    tasmota.add_cmd('Nextion', send_cmd)
                                     
                                    def send_cmd2(cmd, idx, payload, payload_json)
                                        nextion.send(payload)
                                        tasmota.resp_cmnd_done()
                                    end
                                     
                                    tasmota.add_cmd('CustomSend', send_cmd2)
                                    

                                    D 1 Reply Last reply Reply Quote 0
                                    • D
                                      danny_v1 @Armilar last edited by

                                      @armilar ne bin noch im emu

                                      Armilar 1 Reply Last reply Reply Quote 0
                                      • Armilar
                                        Armilar Most Active Forum Testing @danny_v1 last edited by

                                        @danny_v1

                                        Emu im Nextion-Editor?

                                        1 Reply Last reply Reply Quote 0
                                        • D
                                          danny_v1 last edited by

                                          @armilar richtig. Autoexec.be passt hab deine noch mal kopiert und komme wieder auf 3720

                                          1 Reply Last reply Reply Quote 0
                                          • Armilar
                                            Armilar Most Active Forum Testing last edited by

                                            @danny_v1

                                            Im Nextion-Editor unter Debug:
                                            Dort unten links von Keyboard Input auf User MCU Input umstellen, den COM-Port des ESP auswählen und die Baud-Rate auf 115200 stellen. Mit Start verbindet man sich nun zum ESP.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            867
                                            Online

                                            31.6k
                                            Users

                                            79.4k
                                            Topics

                                            1.3m
                                            Posts

                                            lovelace ui nspanel sonoff
                                            260
                                            7128
                                            4288702
                                            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