yozik04 / nibe-mqtt

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

Hassio Addon #3

Closed rtitmuss closed 2 years ago

rtitmuss commented 2 years ago

Thanks for making this integration. I'm liking the easy to read code.

I have made a small hassio addon so I can easily run this on my home assistant server. I am wondering if you'd like me to contribute this here, or if I should host in my own repo.

yozik04 commented 2 years ago

Hey, thank you for looking into the code. It is always useful to have a second pair of eyes. By HassIO addon do you mean you have added a Dockerfile? Or wrote a custom_component ?

rtitmuss commented 2 years ago

I've created the dockerfile and related files, so nibe-mqtt can be installed as an addon.

On Mon, 30 May 2022, 18:22 Jevgeni Kiski, @.***> wrote:

Hey, thank you for looking into the code. It is always useful to have a second pair of eyes. By HassIO addon do you mean you have added a Dockerfile? Or wrote a custom_component ?

— Reply to this email directly, view it on GitHub https://github.com/yozik04/nibe-mqtt/issues/3#issuecomment-1141325627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGZOWT4SI6CBGOGIMIAYRLVMTTMPANCNFSM5XLBOCDQ . You are receiving this because you authored the thread.Message ID: @.***>

yozik04 commented 2 years ago

I will happily accept this contribution here. That was actually on my TODO list. =)

rtitmuss commented 2 years ago

I've committed a basic hassio addon at https://github.com/rtitmuss/hassio-nibe-mqtt. The hass addon repository needs to be in it's own git repo, but I'm happy for you to clone and take ownership of this if you'd like.

To install this in hassio go to the add-on store in settings, select repositories from the ... menu, and add https://github.com/rtitmuss/hassio-nibe-mqtt.

This version creates a config file in config/nibe-mqtt, that will need editing for you system. I think it would be better if the config file could instead be managed by the add-on (so the add-on options editor can be used). I tried to do this by adding the following in the plugins config.yaml:

options:
  logging:
  - level: INFO
    format: "%(asctime)s - %(levelname)-8s - %(threadName)-10s - %(name)s - %(message)s"
  mqtt:
  - host: ****
    protocol: 5
    username: ****
    password: ****
  nibe:
  - model: F370
    nibegw:
    - ip: 10.46.1.39
      listening_port: 9999
      read_port: 10000
      write_port: 10000
  poll:
    - interval: 30
      coils:
        - bt50-room-temp-s1-40033
        - bt1-outdoor-temperature-40004
        - bt7-hw-top-40013
        - bt6-hw-load-40014
        - temporary-lux-48132
        - hot-water-comfort-mode-47041
        - eb100-ep14-bt3-return-temp-40012
        - bt2-supply-temp-s1-40008
        - compressor-starts-eb100-ep14-43416
        - prio-43086
        - tot-op-time-compr-eb100-ep14-43420
        - tot-hw-op-time-compr-eb100-ep14-43424
        - int-el-add-power-43084
        - tot-op-time-add-43081
        - hwc-pump-status-gp11-43180
        - heat-offset-s1-47011
        - cool-offset-s1-48739
        - allow-additive-heating-47370
        - holiday-activated-48043
        - allow-heating-47371
        - allow-cooling-47372
schema:
  logging:
  - level: str
    format: str
  mqtt:
  - host: str
    protocol: int
    username: str
    password: str
  nibe:
  - model: str
    nibegw:
    - ip: str
      listening_port: int
      read_port: int
      write_port: int
  poll:
  - interval: int
    coils: list(str)

This does not work as the options are limited to be nested 2 deep, and the nibegw is 3 deep. Would it be possible to change the format of the config.yaml to allow this to work?

yozik04 commented 2 years ago

I faced this before with my other home assistant project. Addon configuration unfortunatelly is very limited. Current project supports nibegw and modbus connection methods. That is 100% not supported by the addon config. I had plans to add nibe uplink as well. I'd better go without specifying a schema.

rtitmuss commented 2 years ago

It does not seem to work without a schema definition in the latest version of HA, as the /data/options.json in the container is empty. So I think the solution I've already implemented where it reads from /config/nibe-mqtt/confg.yaml is the best option.

yozik04 commented 2 years ago

I'd also mount config folder and configure there.

yozik04 commented 2 years ago

Looked into your code and you did it exactly as I was thinking to do it. Great job!

Pixelalb commented 2 years ago

Hey! Trying to set this up. Kindly please check this when you have couple of minutes. What I am doing wrong? https://somup.com/c31rjCtJSg :)

yozik04 commented 2 years ago

Hey! Trying to set this up. Kindly please check this when you have couple of minutes. What I am doing wrong? https://somup.com/c31rjCtJSg :)

I partially scanned your video. You do not understand what is MQTT. For MQTT to work you need MQTT Broker and Clients (HomeAssistant and Nibe Mqtt integration) You are missing Broker.

yozik04 commented 2 years ago

Actually, I am wrong. You have mqtt broker installed. Your nibe is S series. So you want to connect via tcp modbus, not nibegw. See readme for configuration.

Pixelalb commented 2 years ago

Little progress so far https://somup.com/c31rI2tdrF :)

InVain85 commented 2 years ago

Hi, first of all thank you for your effort of developing this :) So I'm basically stuck at the same point. But I can see some log entries that confuse me:

_2022-06-22 12:59:30,163 - WARNING - MainThread - nibe.nibemqtt.service - Poll bt1-outdoor-temperature-40004 failed: The data address received in the request is not an allowable address for the server.

My config looks like the following:

logging: level: WARNING format: "%(asctime)s - %(levelname)-8s - %(threadName)-10s - %(name)s - %(message)s" mqtt: host: protocol: 5 username: mqtt_user password: mqtt_pass nibe: model: F1255 modbus: url: tcp://:502 slave_id: 1 poll: interval: 30 coils:

I've commented most of the sensors because they aren't working anyway. My Heatpump model is a F2120-12, but I guess this isn't really important.

Any help appreciated :) Thx

yozik04 commented 2 years ago

@rtitmuss Can you please make a PR that removes UDP address check. We discussed it. I am away from computer this week.

rtitmuss commented 2 years ago

@yozik04 sure, you can find it here https://github.com/yozik04/nibe/pull/5. However I don't think this is causing this issue as the error message in the UDP address check is Ignoring packet from unknown host.

@InVain85 you mentioned your heatpump model is a F2120-12 but in the configuration file you have F1255. It looks like your model of heatpump is not yet supported.

There needs to be a configuration file for your heatpump added to https://github.com/yozik04/nibe/tree/master/nibe/data. It looks like the register definitions for your heatpump are listed in https://www.nibe.eu/download/18.3db69dc1795e0d992c5722/1622634529178/Modbus%20S-series%20EN%20M12676EN-1.pdf. These would need to be converted to an appropriate .json file.

yozik04 commented 2 years ago

Json is produced from Nibe Modbus configuration tool data. Tool exports csv and I convert. I think I picked all models which were supported by that tool.

rtitmuss commented 2 years ago

@Pixelalb It looks like you are also using a heatpump that is not yet supported, in your video you mention you are using an S320. This is also documented in the PDF I listed above.

It is important that your heatpump is supported with the right data files in nibe-mqtt, and that you also select the correct heatpump model in the configuration file.

Maybe the Nibe Modbus tool has not been updated to support these models? It should be possible, but time consuming, to create the necessary configuration files from the pdf.

For example from the PDF:

image

I think this would translate as:

"40001": {
    "title": "Outdoor temperature (BT1)",
    "info": "Current outdoor temperature",
    "unit": "\u00b0C",
    "size": "s16",
    "factor": 10,
    "name": "bt1-outdoor-temperature-40001"
  },

Note that the register address 40001 is from the type of register FC04 and the id 1. Other registers are FC03 eg

image

So in this case the register address would be 30018, in full:

"30018": {
    "title": "Degree minutes",
    "info": "Degree minutes",
    "size": "s16",
    "factor": 10,
    "name": "degree-minutes-30018",
    "write": true
  },
InVain85 commented 2 years ago

@rtitmuss

you mentioned your heatpump model is a F2120-12 but in the configuration file you have F1255. It looks like your model of heatpump is not yet supported.

Thx for your answer. Just to make things clear. The F2120-12 is the external actual heatpump. The internal device, with all the "intelligence", is a VVM320 S-Series. I already tried to set VVM320 as model in the configuration, but with the very same message in the log. So my assumption is, that this is more or less the same problem as @Pixelalb has. "Not (yet) supported model" The readme tells me that thare are "some" S series through TCP modbus supported. What are they? I could just trial and error with these.

Thx :)

rtitmuss commented 2 years ago

Ok, thanks for clarifying. I'm making educated guesses so it's very possible I've misunderstood. The error message does suggest that the wrong register is being read over mbus/tcp.

Pixelalb commented 2 years ago

So my assumption is, that this is more or less the same problem as @Pixelalb has.

Yes. I have the same exact setup: F2120-12 outside, VVMS320 internal unit. Trying to figure out how I can contribute.

davidtursic commented 2 years ago

I have the same problem with F2120-16 and VVMS320 inside.

Pixelalb commented 2 years ago

Is there a way I could add a new json to data ( https://github.com/yozik04/nibe/tree/master/nibe/data ) AND test on my local?

InVain85 commented 2 years ago

Anything new regarding this topic? Would be greatly appreciated. Thx.

yozik04 commented 2 years ago

@Pixelalb You can clone all locally and edit as you need.

latisen commented 2 years ago

Tried to install the addon, running on rPI 4 getting error: Failed to to call /addons/4d4f3f69_nibe_mqtt/install - The command '/bin/ash -o pipefail -c apk add --no-cache python3' returned a non-zero code: 1

latisen commented 2 years ago

@rtitmuss : I installed hassos instead of the docker variance and the plugin is now installing. But it wont start, throws this in the log: s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started Traceback (most recent call last): File "/usr/bin/nibe-mqtt", line 8, in sys.exit(main()) File "/usr/lib/python3.10/site-packages/nibe_mqtt/console_scripts/nibe_mqtt_service.py", line 24, in main conf = cfg.load(Path(args.config)) File "/usr/lib/python3.10/site-packages/nibe_mqtt/config.py", line 86, in load self._data = schema(yaml.safe_load(fh)) File "/usr/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in call return self._compiled([], data) File "/usr/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['nibe']['modbus'] s6-rc: info: service legacy-services: stopping s6-rc: info: service legacy-services successfully stopped s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped

yozik04 commented 2 years ago

extra keys are not allowed in configuration

latisen commented 2 years ago

extra keys are not allowed in configuration

@yozik04: I used the example that the addon is creating.

logging:
  level: WARNING
  format: "%(asctime)s - %(levelname)-8s - %(threadName)-10s - %(name)s - %(message)s"
mqtt:
  host: 10.0.1.34
  protocol: 5
  username: mqtt
  password: mqtt
nibe:
  model: VVM320
  modbus:
    url: tcp://10.0.1.15:502
    slave_id: 1
  poll:
    interval: 30
    coils:
      - bt1-outdoor-temperature-40004

I have S-model NIBE 325

yozik04 commented 2 years ago

I have created this repository https://github.com/yozik04/hassio-nibe-mqtt and updated to latest version. Try that.

latisen commented 2 years ago

I have created this repository https://github.com/yozik04/hassio-nibe-mqtt and updated to latest version. Try that.

@yozik04: This one gave me: Failed to install add-on The command '/bin/ash -o pipefail -c pip3 install nibe-mqtt@0.1.0' returned a non-zero code: 1

yozik04 commented 2 years ago

@latisen I fixed it try again. Remove repo and add again.

latisen commented 2 years ago

@latisen I fixed it try again. Remove repo and add again.

@yozik04 Tried it, tried with 2 coils, but they give me: 2022-07-10 15:10:49,580 - WARNING - MainThread - nibe.nibe_mqtt.service - Poll bt2-supply-temp-s1-40008 failed: The data address received in the request is not an allowable address for the server.

Should I use other names when using S-series VVM325?

yozik04 commented 2 years ago

Not sure. S series is still in alpha mode. Seems like it does not like the address... Somebody needs to look up addresses in the manual and create new json file for the model you have.

latisen commented 2 years ago

Not sure. S series is still in alpha mode. Seems like it does not like the address... Somebody needs to look up addresses in the manual and create new json file for the model you have.

@yozik04 I can do that work, is it the modbus adresses that needs to go in there?

yozik04 commented 2 years ago

It is great to hear. Please create a separate thread for your heatpump model we can discuss there. Please post link to the manual there as well. I need to check some things.