Open evercape opened 7 months ago
Hi Martin,
the json-live-data-server returns on endpoint /cgi-bin/get_resol_device_information
this data in my case:
device_info.txt
The endpoint /dlx/download/live
returns this json:
vbus-live.json
If I see it correct, then km2 and this endpoint return the same format and it should be enough to just decide which endpoint to use like in the original code: https://github.com/dm82m/hass-Deltasol-KM2/blob/1bcb26b45dc04be2a7aa90405bc1e313d01be864/custom_components/deltasol/deltasolapi.py#L140-L166 Regards Leo
Thanks Leo, I will check it out tomorrow/over the weekend. Much appreciated for providing the device information and JSON data. M
Hi Leo,
I am on Christmas family holidays, only have Laptop, no mouse, no external keyboard, no big screen.....so not ideal...
The following might work:
In resolapi.py line 113 add this method:
def fetch_data_dlx(self):
response = {}
url = f"http://{self.host}/dlx/download/live"
_LOGGER.debug(f"{self.device['serial']}: DLX requesting sensor data from url {url}")
response = requests.request("GET", url)
if(response.status_code == 200):
response_data = response.json()
_LOGGER.debug(f"DLX response: {response}")
# Proceed to parsing
return self.__parse_data(response_data)
In sensor.py line 66 add the following:
if device_check["product"] == "KM2":
data = await hass.async_add_executor_job(resol_api.fetch_data_km2)
elif device_check["product"] == "KM1":
data = await hass.async_add_executor_job(resol_api.fetch_data_km1)
elif device_check["product"] == "DL2" or device_check["product"] == "DL3":
data = await hass.async_add_executor_job(resol_api.fetch_data_dlx)
In config_flow line 54 add the following:
if device["product"] == "KM2":
auth_check = await hass.async_add_executor_job(resol_api.fetch_data_km2)
elif device["product"] == "KM1":
auth_check = await hass.async_add_executor_job(resol_api.fetch_data_km1)
elif device["product"] == "DL2" or device["product"] == "DL3":
auth_check = await hass.async_add_executor_job(resol_api.fetch_data_dlx)
I think it would be best to expose your JSON data for testing via a public IP or DYNDNS, even on Proxmox that might work? If not, I will setup a better test environment when back from holidays, which is only middle of January.
Let me know if the above works, maybe it does.
Also pls just enter anything for username/password for now - if you don't use one then the DL2/3=DLX method is ignoring it for now. Once I can test properly will setup a different config_flow for those type of devices/JSON servers.
Thanks Martin
Hi Martin,
thanks alot. I only had to add a :{self.port}
to the url. And the line to change in resolapi.py was 133 and not 113.
But after these two small changes, it works like a charme.
All Sensors are created correctly.
Regards
Leo
:{self.port}
...can't believe I forgot that, sorry bout that.
Glad it worked.
I am still not happy with it - I think some people on the json live data server may require username/password and even API key from what I can see.
If you do get a chance to make your setup public (even just whitelist for me) I would like to integrate it and test it properly.
Also with proper exceptions, logging etc. and once properly tested upgrade to a new version of this custom integration.
Pls send me a screenshot how the device looks like if you do get a moment.
Thanks for helping with testing this integration, much appreciated.
Rgds Martin
Hi Martin, I use a VBUS/LAN device and have the json-live-data-server running via HA Addon. It would be great, if your integration could also handle that. The json-live-data-server is not protected by username and password. Because these settings in your config dialog are mandatory, I cannot try out if the data format of the json-live-data-server is compatible to the KM2 format. If I can help adding support for VBUS/LAN please tell me. Regards Leo
Originally posted by @lebetz in https://github.com/evercape/hass-resol-KM2/discussions/1#discussioncomment-7794144