Ankündigung

Einklappen
Keine Ankündigung bisher.

group(s)write

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

    group(s)write

    Guten tag,

    ich kann in der Kommandozeile:
    groupswrite ip:127.0.0.1 0/2/1 1
    und
    in logic/*.py
    sh.knx.groupswrite('0/2/1',1,'1')

    Dies ist kein Problem und arbeitet ok

    jetzt mein problem!
    wie kann ich dies tun in meinem eigenen Skript Zufalls

    Entschuldigungen für meine wunderbare Deutsch
    Vielen Dank im Voraus,
    jonas

    #2
    Please try in English - don't get what you want

    Gesendet von meinem GT-I9100 mit Tapatalk

    Kommentar


      #3
      In english

      i'm trying to create a random script where i can do a groups-read or -write to a specific groups address.

      But when i do this in my script "groupswrite" or "sh.knx.groupwrite" i get a syntax error or invallid command.

      in de logics/*.py , sh.knx.groupwrite works becauze is it loaded from smarthome. And groupswrite works only in command line :s.

      I've a project running next to "smarthome.py" where i want use these command in a script, so i can import this script in my project and read/write to the knx.

      Thx

      Kommentar


        #4
        ok, and your script is written in which language? Shell/Bash, Batch, Python,...?

        You have an example or a part of your script which fail?

        Kommentar


          #5
          Its writen in python ( and no errors ), just as smarhome.py.

          It's based on the plugins/knx/__init__.py , there is the groups-read and write defined.
          I've also imported some libs just as smarthome did.
          I don't even know if this is possible but i tought i went close.
          Despite i've no errors, it does nothing when i run it

          Kommentar


            #6
            this is part of my script:

            #!/usr/bin/env python

            import signal
            import sys
            import os
            import subprocess
            import asyncore

            import dpts
            from configobj import ConfigObj
            import lib.my_asynchat

            KNXREAD = 0x00
            KNXRESP = 0x40
            KNXWRITE = 0x80

            class KnxReadWrite(lib.my_asynchat.AsynChat):
            _plugin_conf = BASE + '/etc/plugin.conf'
            socket_map = {}

            def __init__(self, host='127.0.0.1', port=6720):
            lib.my_asynchat.AsynChat.__init__(self, self, host, port)
            #lib.my_knxchat.AsynChat.__init__(self, self, host, port)
            self.gal = {}
            self.gar = {}
            self._init_ga = []
            self.alive = True

            while self.alive:
            if self.socket_map != {}:
            asyncore.loop(timeout=1, count=1, map=self.socket_map)
            else:
            time.sleep(2)

            def _send(self, data):
            def groupwrite(self, ga, payload, dpt, flag='write'):
            def groupread(self, ga):
            def encode(self, data, dpt):
            def decode(self, data, dpt):

            def main(self,argv):
            if argv == '-r':
            print('lets read')
            self.groupread('3/3/20')
            elif argv == '-won':
            print('lets make some light')
            self.groupwrite('3/3/20',1,'1')
            elif argv == '-woff':
            print('lets put off the light')
            self.groupwrite('3/3/20',0,'1')
            elif argv == 'test':
            print('works so far')
            else:
            print '*'
            print 'usage: licht.py -r <read> | -won <write_on> | -woff <write_off>'
            print '*'

            if __name__ == "__main__":
            objName = KnxReadWrite()
            if len(sys.argv) == 1:
            sys.exit("usage: licht.py -r <read> | -won <write_on> | -woff <write_off>")
            else:
            objName.main(sys.argv[1])

            Kommentar


              #7
              Hi Jonas,

              puhh, sorry there are to many mistakes to help you in my limited time.

              Why don't you use the shell command groupwrite(s) from the eibd?
              Or SH.py with the network plugin, or....

              Good luck.

              so long

              Marcus

              Kommentar


                #8
                hi,

                thanks u still had some time to read my post

                i managed to write a message with:

                from subprocess import call
                call(["groupswrite","ip:127.0.0.1","3/3/20","1"])

                but how can i read one ?
                because "groupsread" doesn't return a value?

                thx

                Kommentar


                  #9
                  hi,

                  I'm still struggling here.

                  I need the value of a groupsadres in my "random.py" script.

                  ( this is to make control in my own websocket server. My Raspberry is the client and here i need the value to send it to my server)

                  But groupsread doesn't return a value, only triggers a read request.
                  And will be received by smarthome.py en send by the VISU websocket plugin ( if i'm right ).

                  Gruss,
                  jonas

                  Kommentar


                    #10
                    To get the answer you have to type "groupsreadresponse".
                    Umgezogen? Ja! ... Fertig? Nein!
                    Baustelle 2.0 !

                    Kommentar


                      #11
                      thx very much "groupreadresponse" gave actual a response.

                      but when i do:
                      var = call(["groupreadresponse","ip:127.0.0.1","4/2/0"])
                      print(var)
                      it's always "0"

                      I probably have to struct.unpack () this:

                      Response from 3.1.3: 42 15 0A 3D
                      print(struct.unpack('>l',var))
                      struct.error: unpack requires a string argument of length 4

                      Response from 3.0.1: 01
                      print(struct.unpack('>c',var))
                      struct.error: unpack requires a string argument of length 1

                      Kommentar


                        #12
                        I'll make a new post for it,
                        i guess it would be easier.

                        https://knx-user-forum.de/smarthome-...tml#post359827

                        Kommentar

                        Lädt...
                        X