yozik04 / nibe-mqtt

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

Installation instructions #4

Closed panosnl closed 1 year ago

panosnl commented 1 year ago

Can you please add installation instructions?

I tried to install it as a custom component but that did not work

yozik04 commented 1 year ago

try this addon repo: https://github.com/yozik04/hassio-nibe-mqtt

panosnl commented 1 year ago

My bad. I assumed it was a HA integration.....

Thanks for the suggestion but I am not running Hassio. The addon did show me to install it via pip3.

Installation went OK but I get errors running it. NibeGW runs OK with NibePI with my F1155.

~/nibe-mqtt# nibe-mqtt -c config.yaml Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner self.run() File "/usr/local/lib/python3.9/threading.py", line 910, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3591, in _thread_main self.loop_forever(retry_first_connection=True) File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1756, in loop_forever rc = self._loop(timeout) File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1164, in _loop rc = self.loop_read() File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1558, in loop_read return self._loop_rc_handle(rc) File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 2350, in _loop_rc_handle self._do_on_disconnect(rc, properties) File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3472, in _do_on_disconnect on_disconnect( TypeError: _on_disconnect_cb() takes from 3 to 4 positional arguments but 5 were given 2022-07-08 20:21:44,023 - ERROR - MainThread - nibe.nibe.connection.nibegw - Failed handling packet from ('192.168.0.159', 10000): tot-op-time-compr-eb100-ep14-43420 coil raw value is larger than max(9999999.0) allowed 2022-07-08 20:21:44,025 - WARNING - MainThread - nibe.nibe_mqtt.service - Poll tot-op-time-compr-eb100-ep14-43420 failed: ('tot-op-time-compr-eb100-ep14-43420 coil raw value is larger than max(9999999.0) allowed', DecodeException(AssertionError('tot-op-time-compr-eb100-ep14-43420 coil raw value is larger than max(9999999.0) allowed')))

yozik04 commented 1 year ago

First exception is that it is unable to connect to MQTT. I think. The last two it just filters out invalid values. You can increase logging level to see what data was attempted to parse.

frank8the9tank commented 1 year ago

I like to see some instructions also, Where do i have to add the repository in HA? under add-ons?

yozik04 commented 1 year ago

I like to see some instructions also, Where do i have to add the repository in HA? under add-ons?

yes

panosnl commented 1 year ago

First exception is that it is unable to connect to MQTT. I think. The last two it just filters out invalid values. You can increase logging level to see what data was attempted to parse.

thx! 1) I got MQTT working by removing protocol: 5 from the config. All parameters end up in HA nicely and can be changed (RW) as well. Nice!! 2) However, it seems that all parameters with 32bits (s32 and u32) fail to parse OK. Large values appear. 16 and 8 work OK.

DEBUG:

2022-07-20 19:52:14,475 - DEBUG - MainThread - nibe.nibe.connection.nibegw - Received b'5c00206a069ca9000002067d00' from ('192.168.0.159', 10000) 2022-07-20 19:52:14,477 - DEBUG - MainThread - nibe.nibe.connection.nibegw - Container: start_byte = 92 empty_byte = 0 fields = Container: data = b' j\x06\x9c\xa9\x00\x00\x02\x06' (total 9) value = Container: address = (enum) MODBUS40 32 cmd = (enum) MODBUS_READ_RESP 106 length = 6 data = Container: coil_address = 43420 value = b'\x00\x00\x02\x06' (total 4) offset1 = 2 offset2 = 11 length = 9 checksum = 125 2022-07-20 19:52:14,479 - ERROR - MainThread - nibe.nibe.connection.nibegw - Failed handling packet from ('192.168.0.159', 10000): tot-op-time-compr-eb100-ep14-43420 coil raw value is larger than max(9999999.0) allowed 2022-07-20 19:52:14,480 - WARNING - MainThread - nibe.nibe_mqtt.service - Poll tot-op-time-compr-eb100-ep14-43420 failed: ('tot-op-time-compr-eb100-ep14-43420 coil raw value is larger than max(9999999.0) allowed', DecodeException(AssertionError('tot-op-time-compr-eb100-ep14-43420 coil raw value is larger than max(9999999.0) allowed')))

yozik04 commented 1 year ago

@panosnl can you please try to read s32 or u32 again and send me what was sent and what value was expected after conversion. I can write a unit test for that then will be able to fix.

yozik04 commented 1 year ago

@panosnl. BTW what unit you have? On F1255 I have little-endian byte order. But your example shows big-endian.

My unit read response of the same 43420 coil.

Aug 29 23:49:48 smarthomepi python3[1418505]: 2022-08-29 23:49:48,315 - DEBUG    - Received b'5c00206a069ca9325400001f' from ('192.168.x.x', 1027)
Aug 29 23:49:48 smarthomepi python3[1418505]: 2022-08-29 23:49:48,316 - DEBUG    - Container:
Aug 29 23:49:48 smarthomepi python3[1418505]:     start_byte = 92
Aug 29 23:49:48 smarthomepi python3[1418505]:     empty_byte = 0
Aug 29 23:49:48 smarthomepi python3[1418505]:     fields = Container:
Aug 29 23:49:48 smarthomepi python3[1418505]:         data = b' j\x06\x9c\xa92T\x00\x00' (total 9)
Aug 29 23:49:48 smarthomepi python3[1418505]:         value = Container:
Aug 29 23:49:48 smarthomepi python3[1418505]:             address = (enum) MODBUS40 32
Aug 29 23:49:48 smarthomepi python3[1418505]:             cmd = (enum) MODBUS_READ_RESP 106
Aug 29 23:49:48 smarthomepi python3[1418505]:             length = 6
Aug 29 23:49:48 smarthomepi python3[1418505]:             data = Container:
Aug 29 23:49:48 smarthomepi python3[1418505]:                 coil_address = 43420
Aug 29 23:49:48 smarthomepi python3[1418505]:                 value = b'2T\x00\x00' (total 4)
Aug 29 23:49:48 smarthomepi python3[1418505]:         offset1 = 2
Aug 29 23:49:48 smarthomepi python3[1418505]:         offset2 = 11
Aug 29 23:49:48 smarthomepi python3[1418505]:         length = 9
Aug 29 23:49:48 smarthomepi python3[1418505]:     checksum = 31
Aug 29 23:49:48 smarthomepi python3[1418505]: 2022-08-29 23:49:48,317 - INFO     - tot-op-time-compr-eb100-ep14-43420: 21554

I've added more unit tests as well. But I am not sure what happens with your unit. If you are still interested. Create new ticket in https://github.com/yozik04/nibe

panosnl commented 1 year ago

@panosnl can you please try to read s32 or u32 again and send me what was sent and what value was expected after conversion. I can write a unit test for that then will be able to fix.

@yozik04 I am sorry for my late reply. I just returned from vacation.

I updated to the latest code. My unit is a F1155 with the latest firmware. Expected value for total compressor hours =1576

2022-08-30 08:27:14,150 - INFO     - MainThread - nibe.nibe.connection.nibegw - status-cooling-43024: ON
2022-08-30 08:27:14,153 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil tot-op-time-compr-eb100-ep14-43420: last_update = None
2022-08-30 08:27:14,155 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Sending b'c069029ca99e' (read request) to 192.168.0.159:10001
2022-08-30 08:27:14,156 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Waiting for read response for tot-op-time-compr-eb100-ep14-43420
2022-08-30 08:27:14,164 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Received b'5c00206b004ba8' from ('127.0.0.1', 10000)
2022-08-30 08:27:14,166 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Container:
    start_byte = 92
    empty_byte = 0
    fields = Container:
        data = b' k\x00' (total 3)
        value = Container:
            address = (enum) MODBUS40 32
            cmd = (enum) MODBUS_WRITE_REQ 107
            length = 0
            data = b'' (total 0)
        offset1 = 2
        offset2 = 5
        length = 3
    checksum = 75
2022-08-30 08:27:14,168 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Unknown command MODBUS_WRITE_REQ
2022-08-30 08:27:14,183 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Received b'5c0020690049a8' from ('127.0.0.1', 10000)
2022-08-30 08:27:14,185 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Container:
    start_byte = 92
    empty_byte = 0
    fields = Container:
        data = b' i\x00' (total 3)
        value = Container:
            address = (enum) MODBUS40 32
            cmd = (enum) MODBUS_READ_REQ 105
            length = 0
            data = b'' (total 0)
        offset1 = 2
        offset2 = 5
        length = 3
    checksum = 73
2022-08-30 08:27:14,187 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Unknown command MODBUS_READ_REQ
2022-08-30 08:27:15,146 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Received b'5c00206a069ca9000028065700' from ('127.0.0.1', 10000)
2022-08-30 08:27:15,148 - DEBUG    - MainThread - nibe.nibe.connection.nibegw - Container:
    start_byte = 92
    empty_byte = 0
    fields = Container:
        data = b' j\x06\x9c\xa9\x00\x00(\x06' (total 9)
        value = Container:
            address = (enum) MODBUS40 32
            cmd = (enum) MODBUS_READ_RESP 106
            length = 6
            data = Container:
                coil_address = 43420
                value = b'\x00\x00(\x06' (total 4)
        offset1 = 2
        offset2 = 11
        length = 9
    checksum = 87
2022-08-30 08:27:15,151 - ERROR    - MainThread - nibe.nibe.connection.nibegw - Failed handling packet from ('127.0.0.1', 10000): tot-op-time-compr-eb100-ep14-43420 coil raw value (103284736) is larger than max allowed (9999999.0)
2022-08-30 08:27:15,152 - WARNING  - MainThread - nibe.nibe_mqtt.service - Poll tot-op-time-compr-eb100-ep14-43420 failed: ('tot-op-time-compr-eb100-ep14-43420 coil raw value (103284736) is larger than max allowed (9999999.0)', DecodeException(AssertionError('tot-op-time-compr-eb100-ep14-43420 coil raw value (103284736) is larger than max allowed (9999999.0)')))
2022-08-30 08:27:15,153 - INFO     - MainThread - nibe.nibe_mqtt.service - Polling coil int-el-add-power-43084: last_update = None
yozik04 commented 1 year ago

@panosnl What setting you have in 5.3.11 service menu.

On my F1255 word swap is checked. I guess it is default.

panosnl commented 1 year ago

@yozik04 Word swap was unchecked. I checked it and now everything is working:

HASS: Tot. op.time compr. EB100-EP14 1.576 h

Thanks..

yozik04 commented 1 year ago

Great. But I am curious what is default one... Mine was checked. But I played with settings a lot. Maybe I have changed it...

panosnl commented 1 year ago

I just cheched the nibe manual

For F1155 : default is disabled. For F1255 : default is enabled.

yozik04 commented 1 year ago

Can you post a link please

yozik04 commented 1 year ago

wow...

panosnl commented 1 year ago

I have misread the older manuals: it only mentions the adress=1, no default was mentioned.

The latest manuals do mention the default values and it is for F1255 disabled too..

F1155 https://assetstore.nibe.se/hcms/v2.3/entity/document/25663/storage/MDI1NjYzLzAvbWFzdGVy F1255 https://assetstore.nibe.se/hcms/v2.3/entity/document/25544/storage/MDI1NTQ0LzAvbWFzdGVy

yozik04 commented 1 year ago

I have added support in the nibe library. nibe-mqtt is next.