Resol KM2 Controller

Resol KM2 Controller is a custom integration to log sensor information from Resol devices using KM2 communication module.

This is my first time programming in Python and publishing to Github. This component was inspired by dm82m/hass-Deltasol-KM2 and I used some of dm82m’s code to fetch the KM2’s data via webservice.

I have made the following changes to dm82m’s component. Some are improvements, others maybe not so. The main purpose for me was to learn Python, program my first HASS custom integration from scratch and to publish to github.

  • Setup via custom_flow using multiple steps
  • Add port as connection detail
  • Combine KM2 specific sensors into devices as suggested by hoppel118
  • Group sensors into ‘useful’ device sensors and less important diagnostics sensors
  • Each sensor entity_id incorporate unique device name, yet presents friendly sensor name
  • Update of the full dataset of all sensors belonging to a KM2 device with single API call
  • Sensors that are disabled are skipped for updates, same with sensors where the state value has not changed
  • Present additional device specific attributes on each sensor
  • Extensive debug logging (hopefully helpful to anyone going through the same learning curve as myself)
  • Adding translations

There is a disadvantage in my integration: I only focused on KM2, even though I am certain that this integration could easily be amended to include DL2, KM1, VBUS and other Resol devices. The reason for this is that I simply don’t own any other Resol device and henceforth could not test this. If anyone is interested to extend this integration, please let me know, happy to do so.

Here are a few screenshots.

Please follow this project if you are interested in developing it further. Any input welcome, I am committed to extend and improve this further. Please keep in mind that I am new to this :wink:

Have fun!
Martin

2 Likes

Hi Martin,

Looks good! I have a Resol device and looking to integrate it into HA. Your integration looks perfect.
I’m just a bit lost on what device I need to buy to be able to connect:

  • VBus/LAN interface adapter
  • Resol VBus/USB interface adapter
  • Resol KM2 communicatie module (rather expensive)

Thanks!
Ben

Hi Ben,

I have two of these: https://www.resol.de/en/produktdetail/209

Tested and 100% works.

Let me know if you opt for the Vbus Lan adapter instead - I think the integration could be amended to work with those too.

Thanks
Martin

Hi Martin,

Will buy the Vbus Lan adapter as I don’t see a reason to spent the extra €100 for the KM2.

fair enough - I am back mid next week and will be able to help with testing. I think as I said earlier there is one small modification necessary.
Please ping me once you got it all installed.
Thanks
Martin

Hi there, I’m interested in the vBus LAN support as well.

I’ve got a setup running via the JSON Live Server right now, if it can be made better/simpler I’d like to give your addon a try!

If can help with testing if you want.

Hi Martin,

The adapter is connected to the Resol and I’m now figuring out how to find the IP address to access the device.

Hi Walter,

The default KM2 is usually http://192.168.240.1

You should be able to find the device if you do a network IP scan.

Check for the MAC address being the same as on the little sticker on the KM2 device.

Good luck
Martin

Thx Martin,
I successfully setup the add-on dm82m/hass-Deltasol-KM2 in HA. Tbh this is enough for my needs but happy to help test the LAN adaptor on your integration.

Thanks so much for the feedback, and glad it worked out.

Why don’t you test the integration I did with the same details, and let me know any feedback if you have. Ideally on GitHub.

Thanks Martin

hey

do you support km2 with firmware 2.0.6?
got this error.

2024-03-01 00:48:31.932 ERROR (MainThread) [custom_components.resol] Authentication failed: Invalid authentication Please log any issues here: https://github.com/evercape/resol/issues

thanks

Hi Edwin,

I only have the older KM2 devices with firmware 1.2.0.

Unfortunately, I cannot test unless I have public access to a device.

I called RESOL and they said they changed a few things with the firmware and I cannot upload the 2.0.6 firmware to my old KM2 devices.

In theory it should work, not sure what the issue is?

In order to debug, would you be able to email me or send me access details via public IP address or DYNDNS.org so I can test on your device?

Thanks
Martin

let me setup a vpn for you

so far so good. let me add more logging



works now, this error is misleading. had to connect vbus , now it works

2024-03-01 19:42:21.854 DEBUG (SyncWorker_18) [custom_components.resol] Attempting to discover Resol device via get: http://192.168.107.48:80/cgi-bin/get_resol_device_information
2024-03-01 19:42:21.857 DEBUG (SyncWorker_18) [custom_components.resol] 40A36BCE419E: Resol device data received: {'product': 'KM2', 'vendor': 'RESOL', 'serial': '40zzzz', 'version': '2.0.6', 'build': 'rc1', 'name': 'KM2-40zzzz', 'features': 'vbus,wifi,vpn', 'host': '192.168.107.48', 'port': '80', 'mac': '40:A3:zzzz'}
2024-03-01 19:42:21.860 DEBUG (SyncWorker_7) [custom_components.resol] 40A36BCE419E: KM2 requesting sensor data from url http://192.168.107.48:80/cgi-bin/resol-webservice
2024-03-01 19:42:21.925 DEBUG (SyncWorker_7) [custom_components.resol] 40A36BCE419E: Successfully authenticated. Auth ID: c4c8a863zzzz
2024-03-01 19:42:22.046 DEBUG (SyncWorker_7) [custom_components.resol] 40A36BCE419E: KM2 response: {'headers': [], 'headerset_stats': {'headerset_count': 1, 'min_timestamp': 1709250853.577, 'max_timestamp': 1709250853.577}, 'headersets': [{'timestamp': 1709250853.577, 'packets': []}]}
2024-03-01 19:42:22.048 ERROR (MainThread) [custom_components.resol] Authentication failed: Invalid authentication Please log any issues here: https://github.com/evercape/resol/issues

Hi Edwin,

thanks for the feedback. So it’s all working?

sorry this is my first integration I wrote.

Would you be able to share ALL the logs so that I can identify where to make changes? Maybe log an issue on GitHub?

Thanks
Martin

Hey Martin,

I have just come across your integration as I use a KM2 to read out my solar system.
It has worked perfectly right from the start, thank you for that!
I can read out the values out of the heat meter, so I get the reading for the heat power - which ist the main value.
However there is the controls for the solar panels also connected via VBUS and on vbus.net I can see all the values the KM2 sends out like the temperature sensors at the panels, pump status etc. There aree two modules on the VBUS, but I can see only one of them in your integration.

Is there an easy way to see those additional values in HA as well? Actually they must be there as the KM2 does send them out…?

Best regards
Michael


Hi Michael, Thanks for the feedback. Currently sailing and only back 3rd week in July. I am sure it can be added to the data output. Do you mind if I look when back? Thanks. Martin

Sure, appreciate it!
Enjoy your sailing trip and let me know when you have a solution👍
If not in the meantime someone else has odeas here…

Hi Martin,

I am new to Home assistant and strugeling to get your code implemented into Home Assistant. I have no clue where to start. The documentation isn’t clear to me as I can’t find anything under integrations with “_Resol_Controller”. So what goes wrong??

thanks for your answer!

Rgds, Benthouse