-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python libmbus #126
Comments
Hi cibermailer, Could you test this code ?
|
I created a file test.py on Documents folder. Set chmod a+x on this file. Runned this file by I'm getting this error:
|
ohhh is this raspi 3 problem because of disabled access from login shell? ...i give it a try --> IT WASN'T ... so problem exists...have i anything do previous that this communication will work? |
I've read a lot now -> can it be that there is some kind of problem because of: non-ASCII characters (e.g., French or German OR some kind of timing OR Python Bug because with php it works on my raspberry 3 (raspbian). ALSO: your posts script does not make my slave led on Relay PW3 going on. Therefore there is realy no request to it. My script makes the slave led going on and receiving data...i have both scripts checked but cannot find what can cause that error on your script... On my script i'm now getting this: |
I do not think this will help, but you can try putting the utf8 encoding in the file.
Could you print the output and error variable ?? |
the returning mbus frame is correct (the hex) ... on bash the hex code is the same like in python. On bash libmbus does concert the frame automatically. With this function: mbus_frame_print: Dumping M-Bus frame [type 4, 136 bytes] Calling mbus from python does only give the hex code. this error:
should mean there is something wrong, or that the hex can't be handled...some information on the ned do something like wrapping the output: + output + i'm little confused...is there a way to transform the hex to human readable content stuff? |
Yes, the test directory contains the program mbus_parse_hex, which isn't compiled per default. So you must call make within the test directory. |
Hi, In the example code, I see an Mbus instance being initialised in line 16 I would like to have Mbus on serial port /dev/TTYAMA0. |
Your question isn't specific to libmbus. Please create a new issue in python-mbus repo. |
I want to call the bash command from python. I got a response but not that well formated as i'm doing the command directly in bash. Is this normal?
The response from python script:
[2017-07-26 11:34:48] SEND (005): 10 40 FD 3D 16 [2017-07-26 11:34:48] SEND (005): 10 40 FD 3D 16 [2017-07-26 11:34:49] SEND (005): 10 5B 0A 65 16 [2017-07-26 11:34:49] RECV (136): 68 82 82 68 08 0A 72 10 00 00 00 2D 2C 01 04 46 00 00 00 0C 07 50 77 40 00 0C 16 01 52 08 00 0C 22 65 17 03 00 0C 59 30 27 00 00 0C 5D 91 25 00 00 0C 61 39 01 00 00 0C 2E 00 00 00 00 0C 3C 00 00 00 00 4C 07 10 71 32 00 4C 16 51 85 06 00 42 6C 1F 2C 0F 10 00 00 00 00 00 62 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 41 04 00 00 00 00 02 26 07 17 00 32 16
Without xml formating...
But response directly from bash:
`init_slaves: debug: sending init frame #1
[2017-07-26 11:34:17] SEND (005): 10 40 FD 3D 16
init_slaves: debug: sending init frame #2
[2017-07-26 11:34:17] SEND (005): 10 40 FD 3D 16
[2017-07-26 11:34:17] SEND (005): 10 5B 0A 65 16
[2017-07-26 11:34:18] RECV (136): 68 82 82 68 08 0A 72 10 00 00 00 2D 2C 01 04 45 00 00 00 0C 07 50 77 40 00 0C 16 01 52 08 00 0C 22 65 17 03 00 0C 59 30 27 00 00 0C 5D 91 25 00 00 0C 61 39 01 00 00 0C 2E 00 00 00 00 0C 3C 00 00 00 00 4C 07 10 71 32 00 4C 16 51 85 06 00 42 6C 1F 2C 0F 10 00 00 00 00 00 62 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 41 04 00 00 00 00 02 26 07 17 00 31 16
mbus_frame_print: Dumping M-Bus frame [type 4, 136 bytes]: 68 82 82 68 08 0A 72 10 00 00 00 2D 2C 01 04 45 00 00 00 0C 07 50 77 40 00 0C 16 01 52 08 00 0C 22 65 17 03 00 0C 59 30 27 00 00 0C 5D 91 25 00 00 0C 61 39 01 00 00 0C 2E 00 00 00 00 0C 3C 00 00 00 00 4C 07 10 71 32 00 4C 16 51 85 06 00 42 6C 1F 2C 0F 10 00 00 00 00 00 62 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 41 04 00 00 00 00 02 26 07 17 00 31 16
I'm doing:
`#!/usr/bin/python
from xml.dom import minidom
from pdb import set_trace as bkp
import subprocess
bashCommand = "mbus-serial-request-data -d -b 2400 /dev/serial0 10"
process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
#mbusdata = minidom.parseString(output)
`
Maybe little thinking problem...thx for support.
The text was updated successfully, but these errors were encountered: