Ankündigung

Einklappen
Keine Ankündigung bisher.

groupreadresponse

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

    groupreadresponse

    Hallo Liebe Leute!

    how do i convert the value returned from a "groupreadresponse" ?
    in PYTHON.
    when i use struct.unpack:

    var = call(["groupreadresponse","ip:127.0.0.1","4/2/0"])
    print(var) -> it's always "0"

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

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

    Danke im Vorraus.
    Jonas

    #2
    well i did and this i how.

    pipe = Popen(["groupreadresponse","ip:127.0.0.1","4/2/0"], stdout=PIPE)
    value, error = pipe.communicate()
    print(value)
    walue = value.replace(" ","")
    walue = walue[-9:-1]
    var = struct.unpack('!f', walue.decode('hex'))[0]
    print(var)

    36.2599983215 Watt

    gruss
    jonas

    Kommentar

    Lädt...
    X