yozik04 / nibe-mqtt

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

No communication with mqtt server #20

Closed nkrepo closed 1 year ago

nkrepo commented 1 year ago

I have a working mosquitto server at IP 192.168.0.33:1883

I tested nibe-mqtt 0.4.0 with docker image and also directly by installing the python package. Unfortunately it seems that nibe-mqtt does try to connect to mqtt server.

Here is my test config

logging:
  level: DEBUG
  format: "%(asctime)s - %(levelname)-8s - %(threadName)-10s - %(name)s - %(message)s"
mqtt:
  host: 192.168.0.33:1883
  protocol: 5
  username: user
  password: password
 discovery_prefix: nibemqtttest
nibe:
  model: SMOS40
  word_swap: true
  modbus:
    url: tcp://192.168.0.32:502
    slave_id: 1
  poll:
    coils:
      - energy-log-energy-produced-for-heat-during-current-hour-32284
      - energy-log-energy-produced-for-hot-water-during-current-hour-32286
      - energy-log-energy-used-for-heat-during-current-hour-32292
      - energy-log-energy-used-for-hot-water-during-current-hour-32294
      - energy-log-energy-used-by-additional-heater-for-heat-during-current-hour-32300
      - energy-log-energy-used-by-additional-heater-for-hot-water-during-current-hour-32302
      - energy-log-current-power-consumption-32306
      - energy-log-current-power-consumption-components-32308

It connects with SMOS40 and pulls the registers

2023-03-08 16:39:42,973 - INFO     - MainThread - root - Running Nibe MQTT 0.4.0 service with Nibe 2.1.1 lib
2023-03-08 16:39:47,992 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-energy-produced-for-heat-during-current-hour-32284: last_update = None
2023-03-08 16:39:47,992 - DEBUG    - MainThread - nibe.nibe.connection.modbus - Sending read request
2023-03-08 16:39:47,992 - DEBUG    - MainThread - sockio.TCP(192.168.0.32:502) - open connection (#1)
2023-03-08 16:39:48,025 - INFO     - MainThread - nibe.nibe.connection.modbus - Coil energy-log-energy-produced-for-heat-during-current-hour-32284, value: 8.19
2023-03-08 16:39:48,026 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-energy-produced-for-hot-water-during-current-hour-32286: last_update = None
2023-03-08 16:39:48,026 - DEBUG    - MainThread - nibe.nibe.connection.modbus - Sending read request
2023-03-08 16:39:48,035 - INFO     - MainThread - nibe.nibe.connection.modbus - Coil energy-log-energy-produced-for-hot-water-during-current-hour-32286, value: 0.0
2023-03-08 16:39:48,035 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-energy-used-for-heat-during-current-hour-32292: last_update = None
2023-03-08 16:39:48,035 - DEBUG    - MainThread - nibe.nibe.connection.modbus - Sending read request
2023-03-08 16:39:48,044 - INFO     - MainThread - nibe.nibe.connection.modbus - Coil energy-log-energy-used-for-heat-during-current-hour-32292, value: 1.33
2023-03-08 16:39:48,045 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-energy-used-for-hot-water-during-current-hour-32294: last_update = None
2023-03-08 16:39:48,045 - DEBUG    - MainThread - nibe.nibe.connection.modbus - Sending read request
2023-03-08 16:39:48,053 - INFO     - MainThread - nibe.nibe.connection.modbus - Coil energy-log-energy-used-for-hot-water-during-current-hour-32294, value: 0.0
2023-03-08 16:39:48,054 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-energy-used-by-additional-heater-for-heat-during-current-hour-32300: last_update = None
2023-03-08 16:39:48,054 - DEBUG    - MainThread - nibe.nibe.connection.modbus - Sending read request
2023-03-08 16:39:48,073 - INFO     - MainThread - nibe.nibe.connection.modbus - Coil energy-log-energy-used-by-additional-heater-for-heat-during-current-hour-32300, value: 0.0
2023-03-08 16:39:48,073 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-energy-used-by-additional-heater-for-hot-water-during-current-hour-32302: last_update = None
2023-03-08 16:39:48,073 - DEBUG    - MainThread - nibe.nibe.connection.modbus - Sending read request
2023-03-08 16:39:48,095 - INFO     - MainThread - nibe.nibe.connection.modbus - Coil energy-log-energy-used-by-additional-heater-for-hot-water-during-current-hour-32302, value: 0.0
2023-03-08 16:39:48,096 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-current-power-consumption-32306: last_update = None
2023-03-08 16:39:48,096 - DEBUG    - MainThread - nibe.nibe.connection.modbus - Sending read request
2023-03-08 16:39:48,104 - INFO     - MainThread - nibe.nibe.connection.modbus - Coil energy-log-current-power-consumption-32306, value: 0.21
2023-03-08 16:39:48,104 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-current-power-consumption-components-32308: last_update = None
2023-03-08 16:39:48,104 - DEBUG    - MainThread - nibe.nibe.connection.modbus - Sending read request
2023-03-08 16:39:48,113 - INFO     - MainThread - nibe.nibe.connection.modbus - Coil energy-log-current-power-consumption-components-32308, value: 0.01
2023-03-08 16:40:48,163 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-energy-produced-for-heat-during-current-hour-32284: last_update = 2023-03-08 16:39:48.026335
2023-03-08 16:40:48,164 - DEBUG    - MainThread - nibe.nibe.connection.modbus - Sending read request
2023-03-08 16:40:48,174 - INFO     - MainThread - nibe.nibe.connection.modbus - Coil energy-log-energy-produced-for-heat-during-current-hour-32284, value: 8.19
2023-03-08 16:40:48,174 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil energy-log-energy-produced-for-hot-water-during-current-hour-32286: last_update = 2023-03-08 16:39:48.035582

But it does not publish them to mqtt, I verified that with mqtt-explorer. I tried putting invalid IP , wrong password e.t.c in the mqtt configuration , nibe-mqtt started without any error.

yozik04 commented 1 year ago

MQTT settings are wrong. It can start without MQTT, it is by design. If it will manage to connect in future then it will start publishing.

nkrepo commented 1 year ago

I found the culprit , I removed the port number :1883 from the host and now connects !

2023-03-08 17:40:05,904 - WARNING  - Thread-1 (_thread_main) - nibe.nibe_mqtt.mqtt - MQTT connected

The server is running at 1883 port , so something definitely goes wrong there.

yozik04 commented 1 year ago

Host and port are separate configuration fields.

nkrepo commented 1 year ago

Host and port are separate configuration fields.

ohh my fault sorry :(.

yozik04 commented 1 year ago

No problem:)

nkrepo commented 1 year ago

It would be nice to add it in the example to avoid confusion. I opened config.py but I overlooked that.