Ankündigung

Einklappen
Keine Ankündigung bisher.

Smart Plugin DLMS Multi Instanz ausführen

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Smart Plugin DLMS Multi Instanz ausführen

    Hallo zusammen,


    ich möchte gerne das DLMS Plugin in einer Multiinstanz ausführen sodass ich einmal die Zählerstände erhalte und mit der zweiten Instanz die Spannungs und Leistungsdaten erhalte

    wenn ich die Datei plugin.yaml wie folgt anpasse lädt SmartHomeNG die Plugins nicht mehr


    Code:
    dlms:
         class_name: DLMS
         class_path: plugins.dlms
         serialport: /dev/ttyUSB0
         baudrate: 300    # default 300
         update_cycle: 300    # default 20
         use_checksum: no    # default no
         reset_baudrate: no    # default no
         no_waiting: yes    # default yes
    Dies ist die Standart Ausführung

    Angepasst betreffend Multi Instanz



    Code:
    
    dlms:
         class_name: DLMS
         class_path: plugins.dlms
         instance: 0
         querycode: ?
         serialport: /dev/ttyUSB0
         baudrate: 300    # default 300
         update_cycle: 300    # default 20
         use_checksum: no    # default no
         reset_baudrate: no    # default no
         no_waiting: yes    # default yes
         instance: 1
         querycode: 2

    Könnte es daran liegen dass meine plugin.yaml noch im "alten Format" vorhanden ist?


    [CODE]


    # plugin.yaml
    # Der BackendServer stellt eine Übersicht zur Laufzeit dar und liefert Informationen ähnlich wie das CLI Plugin
    # Der Zugriff erfolgt über http://<IP oder Name des SmartHomeNG Servers bzw. ip>:<port>
    # port wird als Attribut weiter unten definiert
    # das Passwort ist zunächst im Klartext anzugeben. In neueren Versionen wird es eine Funktion im Backend geben,
    # die aus einem gegebenen Passwort einen Hash erzeugt. Wenn user oder password fehlen gibt es keine Abfrage
    BackendServer:
    class_name: BackendServer
    class_path: plugins.backend
    port: 8383
    updates_allowed: 'True'
    threads: 8
    user: '*******'
    password: '*****'
    language: de

    # KNX Verbindung via knxd
    knx:
    class_name: KNX
    class_path: plugins.knx
    host: 127.0.0.1
    port: 6720
    send_time: 600 # update date/time every 600 seconds, default none
    time_ga: 0/4/1 # default none
    # date_ga: 1/1/2 # default none

    # Bereitstellung eines Websockets zur Kommunikation zwischen SmartVISU und SmartHomeNG
    visu:
    class_name: WebSocket
    class_path: plugins.visu_websocket
    # ip: 0.0.0.0
    # port: 2424
    # tls: no
    wsproto: 4
    acl: rw

    # Autogenerierung von Webseiten für SmartVISU
    smartvisu:
    class_name: SmartVisu
    class_path: plugins.visu_smartvisu
    # '"neue" Linux Versionen (z.B. Debian > 8.x, Ubuntu > 14.x)'
    smartvisu_dir: /var/www/html/smartVISU

    # nur \"alte\" Linux-Variationen
    # smartvisu_dir: /var/www/smartVISU
    # generate_pages: True
    # handle_widgets: True
    # overwrite_templates: Yes
    # visu_style: blk

    # Command Line Interface
    # wichtig für Funktionsprüfungen solange keine Visu zur Verfügung steht
    cli:
    class_name: CLI
    class_path: plugins.cli
    ip: 0.0.0.0
    update: 'True'

    # SQL-Treiber, unterstützt auch die SmartVISU 2.8/2.9
    # dazu muß im websocket plugin zwingend die Protokollversion 4 eingetragen sein
    sql:
    class_name: SQL
    class_path: plugins.sqlite_visu2_8

    # Onewire Plugin
    # [ow]
    # class_name: OneWire
    # class_path: plugins.onewire

    Sonos:
    class_name: Sonos
    class_path: plugins.sonos
    tts: true # optional, default: false
    local_webservice_path: /var/tts # optional, default: empty. If 'tts' is enabled, this option is mandatory.
    # All tts files will be stored here.
    local_webservice_path_snippet: /var/snippet # optional, default: empty. For some reasons it could be necessary to have
    # separated paths for TTS files and your own snippet files. You can define the
    # local path for your snippets here. If 'tts' is enabled and
    # 'local_webservice_path_snippet' is empty, the value for
    # 'local_webservice_path' is used for your snippet audio files.
    webservice_ip: 192.168.178.54 # optional, default: automatic. You can set a specific ip address.
    # If you're using a docker container, you have to set the host
    # ip address here.
    webservice_port: 23500 # optional, default: 23500
    # discover_cycle: 120 # optional, default: 120 (in seconds)
    # speaker_ips: # optional. You can set static IP addresses for your Sonos speaker. This
    # - 192.168.1.10 # will disable auto-discovery. This is useful if you're using a
    # - 192.168.1.77 # containerized environment with restricted network access.

    # memlog:
    # class_name: MemLog
    # class_path: plugins.memlog
    # name: alert

    # ow:
    # class_name: OneWire
    # class_path: plugins.onewire
    # host: 127.0.0.1
    # port: 4304

    # apcups:
    # class_name: APCUPS
    # class_path: plugins.apcups
    # host: localhost
    # port: 3551

    # dmx1:
    # class_name: ArtNet
    # class_path: plugins.artnet
    # artnet_subnet: 0
    # artnet_net: 0
    # artnet_universe: 0
    # ip: 192.168.1.123
    # port: 6454

    # ast:
    # class_name: Asterisk
    # class_path: plugins.asterisk
    # username: admin
    # password: secret
    # host: 127.0.0.1 # default
    # port: 5038 # default

    # fb1:
    # class_name: AVM
    # class_path: plugins.avm
    # username: ... # optional
    # password: '...'
    # host: fritz.box
    # port: 49443
    # cycle: 300
    # ssl: True # use https or not
    # verify: False # verify ssl certificate
    # call_monitor: 'True'
    # call_monitor_incoming_filter: "... ## optional, don't set if you don't want to watch only one specific number with your call monitor"
    # avm_identifier: fritzbox_1

    # boxcar:
    # class_name: Boxcar
    # class_path: plugins.boxcar
    # apikey: abcdefghij123456 # Get it from your Boxcar Account
    # email: your@mail.org # Registered with Boxcar

    # comfoair:
    # class_name: ComfoAir
    # class_path: plugins.comfoair
    # kwltype: comfoair350 # Currently supported: comfoair350 and comfoair500
    # host: 192.168.123.6 # Provide host and port if you want to use TCP connection (for a TCP to serial converter)
    # port: 5555 # Port
    # serialport: /dev/ttyUSB0 # Enable this if you want to use a serial connection

    # datalog:
    # class_name: DataLog
    # class_path: plugins.datalog
    # path: var/log/data
    # filepatterns:
    # - default:{log}-{year}-{month}-{day}.csv
    # - yearly:{log}-{year}.csv
    # logpatterns: csv:{time};{item};{value}\n
    # cycle: 300

    #sml:
    # class_name: Sml
    # class_path: plugins.sml
    # serialport: /dev/ttyUSB0


    dlms:
    class_name: DLMS
    class_path: plugins.dlms
    serialport: /dev/ttyUSB0
    baudrate: 300 # default 300
    update_cycle: 300 # default 20
    use_checksum: no # default no
    reset_baudrate: no # default no
    no_waiting: yes # default yes


    # dmx:
    # class_name: DMX
    # class_path: plugins.dmx
    # tty: /dev/usbtty...
    # interface: nanodmx

    # DuW:
    # class_name: DuW
    # class_path: plugins.drexelundweiss
    # tty: /dev/ttyUSB0
    # Busmonitor: 1
    # LU_ID: 130
    # WP_ID: 140

    # squeezebox:
    # class_name: Squeezebox
    # class_path: plugins.squeezebox
    # host: squeezeserver
    # # port: <port>

    uzsu:
    class_name: UZSU
    class_path: plugins.uzsu

    # simulation:
    # class_name: Simulation
    # class_path: plugins.simulation
    # data_file: /usr/local/smarthome/var/db/simulation.txt

    # nw:
    # class_name: Network
    # class_path: plugins.network
    # ip: 0.0.0.0
    # port: 2727
    # http: 8765
    # tcp_acl:
    # - 127.0.0.1
    # - 192.168.0.34
    # udp: 'no'
    # udp_acl: '*'

    # wol:
    # class_name: WakeOnLan
    # class_path: plugins.wol

    # homematic:
    # class_name: Homematic
    # class_path: plugins.homematic
    # host: 192.168.50.250
    # port: 2001



    Danke


    Gruss Oliver
    Gruss Oliver

    Projektleiter Technische Gebäudeausrüstung

    #2
    Du musst DLMS 2x konfigurieren. Eine Section je Instanz. Etwa so:

    Code:
    dlms_1:
        plugin_name: dlms
        instance: dlms_inst1
        serialport: /dev/ttyUSB0
        update_cycle: 300 # default 20
    
    dlms_2:
        plugin_name: dlms
        instance: dlms_inst2
        serialport: /dev/ttyUSBx
        update_cycle: 300 # default 20
    Die Einstellungen, die Default Values enthalten habe ich weggelassen (weil überflüssig).

    Bei den Items muss man das entsprechend berücksichtigen, indem man mit angibt, auf welche Plugin Instanz sich das item bezieht.

    Also statt
    Code:
    myitems:
        item1:
            dlms_obis_code: 1-1:0.0.0(50871031)
    nun
    Code:
    myitems:
        item1:
            dlms_obis_code@dlms_inst1: 1-1:0.0.0(50871031)
    
        item2:
            dlms_obis_code@dlms_inst2: 1-1:1.2.1(0451.17*kW)

    Viele Grüße
    Martin

    There is no cloud. It's only someone else's computer.

    Kommentar


      #3
      Danke Martin ich werde dies gleich testen und evtl. log Ausgaben dann mit anfügen


      EDIT:

      Leider ohne funktion siehe LOG
      smarthome.log

      Code:
      2018-09-12  13:55:09 WARNING  __main__         SmartHomeNG stopped
      2018-09-12  13:55:09 WARNING  __main__         SmartHomeNG stopped
      2018-09-12  13:55:10 WARNING  __main__         --------------------   Init SmartHomeNG 1.5.1.master (cc1288de)   --------------------
      2018-09-12  13:55:10 WARNING  __main__         --------------------   Init SmartHomeNG 1.5.1.master (cc1288de)   --------------------
      2018-09-12  13:55:10 WARNING  __main__         Running in Python interpreter 'v3.5.3 final' on linux platform
      2018-09-12  13:55:10 WARNING  __main__         Running in Python interpreter 'v3.5.3 final' on linux platform
      2018-09-12  13:55:13 ERROR    __main__         Unhandled exception: invalid literal for int() with base 10: 'ng keys are not allowed here\n  in "<unicode string>", line 170, column 16:\n        querycode: ?\n                   ^ (line: 170'
      <class 'ValueError'>
        File "/usr/local/smarthome/bin/smarthome.py", line 1150, in <module>
          sh.start()
        File "/usr/local/smarthome/bin/smarthome.py", line 474, in start
          self.plugins = lib.plugin.Plugins(self, configfile=self._plugin_conf_basename)
        File "/usr/local/smarthome/lib/plugin.py", line 104, in __init__
          _conf = lib.config.parse_basename(configfile, configtype='plugin')
        File "/usr/local/smarthome/lib/config.py", line 63, in parse_basename
          config = parse(basename+YAML_FILE)
        File "/usr/local/smarthome/lib/config.py", line 116, in parse
          return parse_yaml(filename, config, addfilenames)
        File "/usr/local/smarthome/lib/config.py", line 297, in parse_yaml
          items = shyaml.yaml_load(filename, ordered=True)
        File "/usr/local/smarthome/lib/shyaml.py", line 126, in yaml_load
          line = convert_linenumber(line, 2)
        File "/usr/local/smarthome/lib/shyaml.py", line 79, in convert_linenumber
          linenew = str(int((int(lineold)+1)/2))
      
      2018-09-12  13:55:13 ERROR    __main__         Unhandled exception: invalid literal for int() with base 10: 'ng keys are not allowed here\n  in "<unicode string>", line 170, column 16:\n        querycode: ?\n                   ^ (line: 170'
      <class 'ValueError'>
        File "/usr/local/smarthome/bin/smarthome.py", line 1150, in <module>
          sh.start()
        File "/usr/local/smarthome/bin/smarthome.py", line 474, in start
          self.plugins = lib.plugin.Plugins(self, configfile=self._plugin_conf_basename)
        File "/usr/local/smarthome/lib/plugin.py", line 104, in __init__
          _conf = lib.config.parse_basename(configfile, configtype='plugin')
        File "/usr/local/smarthome/lib/config.py", line 63, in parse_basename
          config = parse(basename+YAML_FILE)
        File "/usr/local/smarthome/lib/config.py", line 116, in parse
          return parse_yaml(filename, config, addfilenames)
        File "/usr/local/smarthome/lib/config.py", line 297, in parse_yaml
          items = shyaml.yaml_load(filename, ordered=True)
        File "/usr/local/smarthome/lib/shyaml.py", line 126, in yaml_load
          line = convert_linenumber(line, 2)
        File "/usr/local/smarthome/lib/shyaml.py", line 79, in convert_linenumber
          linenew = str(int((int(lineold)+1)/2))
      2018-09-12  14:12:24 WARNING  plugins.dlms     Attribute '1.7.0' is a single argument, not a list
      2018-09-12  14:12:49 WARNING  plugins.dlms     Attribute '1.7.0' is a single argument, not a list

      items.yaml

      Code:
      Bezug:
          EnergieHT:
              type: num
              sqlite: 'yes'
              dlms_obis_code@dlms_inst1: 1-1:1.8.1          
          EnergieNT:
              type: num
              sqlite: 'yes'
              dlms_obis_code@dlms_inst1: 1-1:1.8.2
          Gesammt:
              type: num
              sqlite: 'yes'
              dlms_obis_code@dlms_inst1: 1-1:1.8.0
          Aktuell:
              type: num
              sqlite: 'yes'
              dlms_obis_code@dlms_inst2: 1-1:1.7.0
          OBIS_Read:
              type: str
              dlms_obis_readout@dlms_inst2: true

      plugin.yaml


      Code:
      dlms_1:
          plugin_name: dlms
          instance: dlms_inst1
          querycode: ?
          serialport: /dev/ttyUSB0
          update_cycle: 300 # default 20
      
      dlms_2:
          plugin_name: dlms
          instance: dlms_inst2
          querycode: 2
          serialport: /dev/ttyUSBx
          update_cycle: 300 # default 20
      Gruss

      Oliver
      Zuletzt geändert von jonny7792; 12.09.2018, 13:13.
      Gruss Oliver

      Projektleiter Technische Gebäudeausrüstung

      Kommentar


        #4
        Zitat von jonny7792 Beitrag anzeigen
        2018-09-12 13:55:13 ERROR __main__ Unhandled exception: invalid literal for int() with base 10: 'ng keys are not allowed here\n in "<unicode string>", line 170, column 16:\n querycode: ?\n ^ (line: 170' <class 'ValueError'>
        Die Meldung besagt, dass Du in der plugin.yaml einen ungültigen Key eingetragen hast. Um da weiterzuschauen müsstest Du die komplette plugin.yaml posten. Je nach Deinem Stand von shNG den Du einsetzt ist die Angabe der Zeilennummer evtl. nicht richtig. Der Fehler liegt entweder im Umfeld von Zeile 170 oder von Zeile 85.


        Viele Grüße
        Martin

        There is no cloud. It's only someone else's computer.

        Kommentar


          #5
          Zitat von Msinn Beitrag anzeigen

          Die Meldung besagt, dass Du in der plugin.yaml einen ungültigen Key eingetragen hast. Um da weiterzuschauen müsstest Du die komplette plugin.yaml posten. Je nach Deinem Stand von shNG den Du einsetzt ist die Angabe der Zeilennummer evtl. nicht richtig. Der Fehler liegt entweder im Umfeld von Zeile 170 oder von Zeile 85.

          habe nochmal geschaut


          Code:
            
           dlms_1:    
          plugin_name: dlms    
          instance: dlms_inst1    
          querycode: "?"    
          serialport: /dev/ttyUSB0    
          update_cycle: 300 # default 20  
          
          dlms_2:    
          plugin_name: dlms    
          instance: dlms_inst2    
          querycode: "2"    
          serialport: /dev/ttyUSB0    
          update_cycle: 300 # default 20  
          
          [U][B]Dort haben bei querycode die Anführungszeichen gefehlt[/B][/U]

          Die items.yaml habe ich auch wie folgt angepasst leider Schreibt er mir für OBIS Spannung L1,L2,L3 Ampere L1,L2,L3 PowerL1,L2,L3 und Aktuell jedoch kein Wert obwohl diese richtig definiert sind denn im OBIS read_out erhalte ich die Ausgaben im Webinterface


          Code:
            
          
          
          Bezug:    
          EnergieHT:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst1: 1-1:1.8.1              
          
          EnergieNT:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst1: 1-1:1.8.2    
          
          Gesammt:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst1: 1-1:1.8.0    
          
          Aktuell:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:1.7.0    
          
          OBIS_Read:        
          type: str        
          dlms_obis_readout@dlms_inst2: true    
          
          
          AmpereL1:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:31.7.0    
          
          AmpereL2:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:51.7.0    
          
          AmpereL3:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:71.7.0    
          
          SpannungL1:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:32.7.0    
          
          SpannungL2:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:52.7.0    
          
          SpannungL3:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:72.7.0    
          
          PowerL1:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:21.7.0    
          
          PowerL2:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:41.7.0    
          
          PowerL3:        
          type: num        
          sqlite: 'yes'        
          dlms_obis_code@dlms_inst2: 1-1:61.7.0
          Zuletzt geändert von jonny7792; 12.09.2018, 13:35.
          Gruss Oliver

          Projektleiter Technische Gebäudeausrüstung

          Kommentar


            #6
            Zu m Inhalt des Plugins kann ich Dir leider nichts sagen. Ich kenne das Plugin nicht. Ich konnte Dich nur zum Multi-Instance auf den richtigen Weg bringen.
            Viele Grüße
            Martin

            There is no cloud. It's only someone else's computer.

            Kommentar


              #7
              Zitat von Msinn Beitrag anzeigen
              Zu m Inhalt des Plugins kann ich Dir leider nichts sagen. Ich kenne das Plugin nicht. Ich konnte Dich nur zum Multi-Instance auf den richtigen Weg bringen.
              Schade, trotzdem vielen vielen Dank - Die multiinstanz funktioniert ja soweit bis auf die Items aber evtl liest ja jemand mit evtl bmx
              Gruss Oliver

              Projektleiter Technische Gebäudeausrüstung

              Kommentar


                #8
                Du fragst ein und dieselbe Schnittstelle mit zwei Instanzen zum fast gleichen Zeitpunkt ab. Nur einer wird gewinnen denke ich. Es müßte einen Versatz geben und nicht beides auf cycle: 300. Wie schon geschrieben es gibt derzeit noch keinen Präzendenzfall, wie man das mit einer Schnittstelle und zwei Instanzen lösen kann.

                Alternativ könnte man wechselseitig das jeweils andere Plugin deaktivieren durch eine Logik aber da fehlt mir momentan die Zeit für mich damit weiter zu befassen.

                Kommentar


                  #9
                  Zitat von bmx Beitrag anzeigen
                  Du fragst ein und dieselbe Schnittstelle mit zwei Instanzen zum fast gleichen Zeitpunkt ab. Nur einer wird gewinnen denke ich. Es müßte einen Versatz geben und nicht beides auf cycle: 300. Wie schon geschrieben es gibt derzeit noch keinen Präzendenzfall, wie man das mit einer Schnittstelle und zwei Instanzen lösen kann.

                  Alternativ könnte man wechselseitig das jeweils andere Plugin deaktivieren durch eine Logik aber da fehlt mir momentan die Zeit für mich damit weiter zu befassen.
                  Habe den Update cycle geändert

                  einmal 40 und einmal 130


                  Gruss Oliver

                  Projektleiter Technische Gebäudeausrüstung

                  Kommentar


                    #10
                    Wenn Du nur ein Gerät abfragst (selbe Schnittstelle für beide Plugin Instanzen), warum nutzt Du dann überhaupt mehrere Instanzen? Das ergibt für mich keinen Sinn.
                    Viele Grüße
                    Martin

                    There is no cloud. It's only someone else's computer.

                    Kommentar


                      #11
                      Zitat von Msinn Beitrag anzeigen
                      Wenn Du nur ein Gerät abfragst (selbe Schnittstelle für beide Plugin Instanzen), warum nutzt Du dann überhaupt mehrere Instanzen? Das ergibt für mich keinen Sinn.
                      Das sage ich dir gerne :


                      mit der ersten Instanz erhalte ich die Zählerstände

                      mit der Zweiten die elektrischen Leistungsdaten

                      da dies über getrennt Abfragen erfolgen muss über 2 Instanzen
                      Gruss Oliver

                      Projektleiter Technische Gebäudeausrüstung

                      Kommentar


                        #12
                        Man müßte dem Plugin für die beiden Abfragen unterschiedliche Parametersätze mitgeben und die dann nacheinander ausführen. Alternativ dem Plugin die Attribute zur Laufzeit anpassen. Wäre aber besser, wenn es da ein Pattern gäbe, was auch für andere ähnliche Plugins passen könnte.

                        Kommentar


                          #13
                          Zitat von bmx Beitrag anzeigen
                          Man müßte dem Plugin für die beiden Abfragen unterschiedliche Parametersätze mitgeben und die dann nacheinander ausführen. Alternativ dem Plugin die Attribute zur Laufzeit anpassen. Wäre aber besser, wenn es da ein Pattern gäbe, was auch für andere ähnliche Plugins passen könnte.
                          Ich habe es zum laufen gebracht

                          Ich habe den update_cycle angepasst sowie einen start verzögerer ! anbei die Screens


                          You do not have permission to view this gallery.
                          This gallery has 1 photos.
                          Gruss Oliver

                          Projektleiter Technische Gebäudeausrüstung

                          Kommentar

                          Lädt...
                          X