Skip to content
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

Testing with Logarex LK13BE606739 and RS485 #224

Open
Blowfly69 opened this issue Oct 27, 2023 · 1 comment
Open

Testing with Logarex LK13BE606739 and RS485 #224

Blowfly69 opened this issue Oct 27, 2023 · 1 comment

Comments

@Blowfly69
Copy link

Blowfly69 commented Oct 27, 2023

Actually, it looks that this is exactly the piece of software I'd need to connect my new LK13BE606739 power meters (3 of them) via RS485 on a Raspi 2B with Home Assistant and I'd love to test it.
Unfortunately, I'm already failing with installation. poetry install takes forever (no progress for hours), obviously there is an issue with installing pyparsing :

admin@autoberry:~/Logarex/py-power-meter-monitor-main $ poetry install -vvv
Loading configuration file /home/admin/.config/pypoetry/config.toml
Using virtualenv: /home/admin/.cache/pypoetry/virtualenvs/py-power-meter-monitor-Oi_2Xx_V-py3.9
Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 35 installs, 0 updates, 0 removals, 10 skipped

  • Installing pyparsing (2.4.7): Pending...
[keyring.backend] Loading KWallet
[keyring.backend] Loading SecretService
[keyring.backend] Loading Windows
[keyring.backend] Loading chainer
[keyring.backend] Loading libsecret
[keyring.backend] Loading macOS
^C
^C
^CException ignored in: <module 'threading' from '/usr/lib/python3.9/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 1415, in _shutdown
    atexit_call()
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 31, in _python_exit
    t.join()
  File "/usr/lib/python3.9/threading.py", line 1033, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.9/threading.py", line 1049, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt:

My active coding time ended with Delphi a long time ago, so I'm not really familiar with modern concepts and languages like Python. Chances are high that I missed or did something wrong. But after some recherching it looks like there is a common issue poetry has with resolving of dependencies. Do you have a hint what I might be doing wrong or what to do?
Thanks a lot!

@Blowfly69
Copy link
Author

I now got it running, but there is an error with mqtt popping up, preventing further exeution:

py-power-meter-monitor --config-file ./logarex-config.toml
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:py_power_meter_monitor.commands:Opened serial connection /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0P5R4Z-if00-port0 with 9600 baud.
Traceback (most recent call last):
  File "/home/admin/.local/lib/python3.9/site-packages/asyncio_mqtt/client.py", line 195, in connect
    await loop.run_in_executor(
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/admin/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 914, in connect
    return self.reconnect()
  File "/home/admin/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1044, in reconnect
    sock = self._create_socket_connection()
  File "/home/admin/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
    return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
  File "/usr/lib/python3.9/socket.py", line 822, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.9/socket.py", line 953, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
OSError: Int or String expected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/admin/.local/bin/py-power-meter-monitor", line 8, in <module>
    sys.exit(app())
  File "/home/admin/.local/lib/python3.9/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/admin/.local/lib/python3.9/site-packages/typer/main.py", line 532, in wrapper
    return callback(**use_params)  # type: ignore
  File "/home/admin/.local/lib/python3.9/site-packages/py_power_meter_monitor/cli.py", line 31, in run
    asyncio.run(
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/admin/.local/lib/python3.9/site-packages/py_power_meter_monitor/commands/monitor_serial.py", line 45, in run_monitor_serial
    async with asyncio_mqtt.Client(
  File "/home/admin/.local/lib/python3.9/site-packages/asyncio_mqtt/client.py", line 535, in __aenter__
    await self.connect()
  File "/home/admin/.local/lib/python3.9/site-packages/asyncio_mqtt/client.py", line 206, in connect
    raise MqttError(str(error))
asyncio_mqtt.error.MqttError: Int or String expected

Setting mqtt_enabled to false in the config didn't help. Any idea? Thank you!

Her my config file (parity ="N" quotes were necessary, they were missing in the demo config).

[logging]
level = 10 # error level (see built-in python logging levels)

[mqtt]
enabled = true
configuration_topic_template = "homeassistant/sensor/{entity_id}/config"
state_topic_template = "homeassistant/sensor/{entity_id}/state"

[mqtt.broker]
hostname = "192.168.XXX.YYY" 
port = 1883

[mqtt.device]
id = "power-meter-0"
name = "Power Meter 0"
manufacturer = "Logarex"
model = "LK13BE606739"

[serial_port]
port_url = "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0P5R4Z-if00-port0"
baud_rate = 9600
byte_size = 8
parity = "N"

[obis]

[[obis.data_sets]]
id = [1, 0, 96, 1, 0, 255]
name = "Meter Id"
value_type = "string"

[[obis.data_sets]]
id = [1, 0, 0, 2, 0, 255]
name = "Meter Program Version"
value_type = "string"

[[obis.data_sets]]
id = [1, 0, 97, 97, 0, 255]
name = "Meter Error Flags"
value_type = "string"

[[obis.data_sets]]
id = [1, 0, 1, 8, 0, 255]
name = "Positive Active Power Integral Total"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 2, 8, 0, 255]
name = "Negative Active Power Integral Total"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 16, 7, 0, 255]
name = "Sum Active Power Instantaneous Total"
value_type = "integer"

[[obis.data_sets]]
id = [1, 0, 32, 7, 0, 255]
name = "Voltage Instantaneous L1"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 52, 7, 0, 255]
name = "Voltage Instantaneous L2"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 72, 7, 0, 255]
name = "Voltage Instantaneous L3"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 31, 7, 0, 255]
name = "Current Instantaneous L1"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 51, 7, 0, 255]
name = "Current Instantaneous L2"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 71, 7, 0, 255]
name = "Current Instantaneous L3"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 14, 7, 0, 255]
name = "Frequency Instantaneous"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 1, 8, 0, 96]
name = "Positive Active Power Integral Last Day"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 1, 8, 0, 97]
name = "Positive Active Power Integral Last Week"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 1, 8, 0, 98]
name = "Positive Active Power Integral Last Month"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 1, 8, 0, 99]
name = "Positive Active Power Integral Last Year"
value_type = "float"

[[obis.data_sets]]
id = [1, 0, 1, 8, 0, 100]
name = "Positive Active Power Integral Since Reset"
value_type = "float"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant