Closed JanLue4 closed 1 year ago
There's a bug in the code. You have to create the file manually. Here is the expected content:
{ "host": "192.168.1.10", "password": "", "port": 1883, "user_name": "" }
After creating the file you can uses pysmartmeter to edit it.
(Or use my pull request. I have a fix in there.)
Thanks a lot! Now I was able to store my settings, too. Unfortunately it returns "serial not found" but "detect-serial" delivers values.
Ok. Here is my temporary solution. It's working in most cases, but I'm still working on it. In "detect_serial.py" you have to replace the following code:
if verbose:
print(f'Read from {ser}...', end=' ', flush=True)
try:
data = ser.readline()
except Exception as err:
if verbose:
print(f'ERROR: {err}')
continue
else:
if verbose:
print(data)
if data.endswith(terminator):
return ser
with:
if verbose:
print(f'Read from {ser}...', end=' ', flush=True)
for i in range(1,4):
try:
data = ser.readline()
except Exception as err:
if verbose:
print(f'ERROR: {err}')
continue
else:
if verbose:
print(data)
if data.endswith(terminator):
return ser
time.sleep (0.5)
You also need to import the "time" module.
You also need to import the "time" module.
What do you mean with this? Your code is returing the following error, but the missing "time module" could be the reason?
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/pysmartmeter/pysmartmeter/__main__.py", line 5, in <module>
from pysmartmeter import cli
File "/pysmartmeter/pysmartmeter/cli.py", line 14, in <module>
from pysmartmeter.detect_serial import print_detect_serial
File "/pysmartmeter/pysmartmeter/detect_serial.py", line 53
for i in range(1,4):
^
IndentationError: unindent does not match any outer indentation level
It' a formatting problem. I have attached the full file here. detect_serial.zip
By the way, I am also only a user of this project. I noticed problems during my tests for which I built a workaround. This does not have to work in every environment. In parallel, I am currently working on expanding the project. It should also be able to process binary SML telegrams. But that still takes time ...
Yes I know, that you are an user like me. I will try your attached file later.
Thanks for Bug report. Will try to fix it soon
It's fixed and released as v0.2.1
I get an error ERROR: File not found: [Errno 2] No such file or directory: '/root/.pysmartmeter' at ./cli.sh store-settings