yozik04 / nibe-mqtt

Nibe MQTT integration to use with HomeAssistant MQTT Autodiscovery
GNU General Public License v3.0
26 stars 8 forks source link

Nibe-mqtt does not work for TCP modbus (w/o nibegw) #19

Closed hansij66 closed 1 year ago

hansij66 commented 1 year ago

Nibe library works fine for me (S2125, TCP modbus) Nibe-mqtt does not work for me

Environment:

I get error below:

hansij66@pi4:~/temp/nibe $ sudo /root/.local/bin/nibe-mqtt -c config.yaml
2023-02-13 20:27:12,682 - INFO     - Running Nibe MQTT 0.3.1 service with Nibe 1.6.0 lib
2023-02-13 20:27:12,717 - WARNING  - MQTT connected
2023-02-13 20:27:17,717 - INFO     - Polling coil current-outdoor-temperature-bt1-30002: last_update = None
2023-02-13 20:27:17,737 - INFO     - current-outdoor-temperature-bt1-30002: 9.7
2023-02-13 20:27:17,738 - ERROR    - 'nibegw'
Traceback (most recent call last):
  File "/root/.local/lib/python3.9/site-packages/nibe/event_server.py", line 17, in notify_event_listeners
    listener(*args, **kwargs)
  File "/root/.local/lib/python3.9/site-packages/nibe_mqtt/service.py", line 120, in on_coil_update
    self.mqtt_client.publish_discovery(coil, self._get_device_info())
  File "/root/.local/lib/python3.9/site-packages/nibe_mqtt/service.py", line 67, in _get_device_info
    "id": slugify("Nibe " + self.conf["nibe"]["nibegw"]["ip"]),
KeyError: 'nibegw'
2023-02-13 20:27:22,743 - INFO     - Polling coil current-outdoor-temperature-bt1-30002: last_update = None
2023-02-13 20:27:22,770 - INFO     - current-outdoor-temperature-bt1-30002: 9.7
2023-02-13 20:27:22,771 - ERROR    - 'nibegw'

My config.yaml

mqtt:
  host: 192.168.1.1
  protocol: 5
  username: username
  password: ***********
nibe:
  model: S2125
  word_swap: true
  modbus:
    url: tcp://192.168.1.16:502
    slave_id: 1
  poll:
    coils:
      - current-outdoor-temperature-bt1-30002
yozik04 commented 1 year ago

I have released 0.3.2. Please try. Thank you for the report.

hansij66 commented 1 year ago

Not resolved yet:

sudo /root/.local/bin/nibe-mqtt -c config.yaml
2023-02-14 19:56:45,449 - INFO     - Running Nibe MQTT 0.3.2 service with Nibe 1.6.0 lib
2023-02-14 19:56:45,493 - WARNING  - MQTT connected
2023-02-14 19:56:50,486 - INFO     - Polling coil current-outdoor-temperature-bt1-30002: last_update = None
2023-02-14 19:56:50,515 - INFO     - current-outdoor-temperature-bt1-30002: 9.8
2023-02-14 19:56:50,515 - ERROR    - name 'conf' is not defined
Traceback (most recent call last):
  File "/root/.local/lib/python3.9/site-packages/nibe/event_server.py", line 17, in notify_event_listeners
    listener(*args, **kwargs)
  File "/root/.local/lib/python3.9/site-packages/nibe_mqtt/service.py", line 127, in on_coil_update
    self.mqtt_client.publish_discovery(coil, self._get_device_info())
  File "/root/.local/lib/python3.9/site-packages/nibe_mqtt/service.py", line 64, in _get_device_info
    if "nibegw" in conf["nibe"]:
NameError: name 'conf' is not defined
yozik04 commented 1 year ago

I think it is now fixed :)

hansij66 commented 1 year ago

Fixed. Thanks

nkrepo commented 1 year ago

Thank you , I will give it a go.