Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No sensor data visible added for integration #36

Open
ankohanse opened this issue Nov 22, 2023 · 8 comments
Open

No sensor data visible added for integration #36

ankohanse opened this issue Nov 22, 2023 · 8 comments

Comments

@ankohanse
Copy link

Hi, hope this is the right place to ask questions about how to get this integration working...

Added all code files under custom_components/deltasol, restarted HA and added the -platform: deltasol sensor with ip, username and password.
In my traces I can see that communication with the KM2 is successfull and data is being retrieved:
image

However, I cannot find this data anywhere within HA.

When searching for entities containing 'deltasol' or even '0010', nothing shows up.
When looking into the integrations, deltasol is not visible. When I choose 'add integration' and select 'Resol KM1/KM2...', I get a popup 'This device cannot be added from the UI. You can add this device by adding it to your configuration.yaml'. Which I have done, otherwise it would not show up in the traces.

How do I get this data to show up in sensors/entities? What am I missing?

@evercape
Copy link

@ankohanse I suggest - unless done already - you enable logging to debug:

logger:
  default: warn
  logs:
    custom_components.deltasol: debug

and post your full logs filter over [custom_components.deltasol] this will permit to look into those logs.

On a side note, I used this plugin and it worked perfectly fine. I have re-written the module from scratch to work with UI based setup and I am in the process of publishing it to HACS. You can load manually and see if this works for you:

https://github.com/evercape/hass-resol-KM2

Good luck

@dm82m
Copy link
Owner

dm82m commented Nov 22, 2023

@ankohanse go to settings in Home Assistant and select devices and entities, select entities and type deltasol in the search box. All your sensors will be shown there.

@evercape why forking and re-releasing instead of contributing here?

@evercape
Copy link

@evercape why forking and re-releasing instead of contributing here?

Didn’t fork. Used a different init method as I wanted to use UI and not YAML to setup.

So cannot do pull request.

Also I don’t have any devices other than KM2 to test. Have put all in documentation.

First time using python and GitHub so if you have any suggestions pls let me know. Was more like a learning project for me.

Thanks

@dm82m
Copy link
Owner

dm82m commented Nov 22, 2023

You can also try to bring your improvements as pull requests 1 by 1. just as an idea. If you want to.

@evercape
Copy link

evercape commented Nov 22, 2023

You can also try to bring your improvements as pull requests 1 by 1. just as an idea. If you want to.

Thanks, good idea. Will do that - but not all of them will work.

You opted for YAML setup, which is fine and works well, but I wanted to try devices. One of your users commented on this setup. I initially forked your complete project, and setup devices, but they are not supported unless you use config_flow. I posted a bit around this in community groups, big learning experienced for me.

The "improvements" that I point out in my documentation are as follows:

  1. Setup via custom_flow using multiple steps
    --> not possible to fork, as completely separate init method

  2. Add port as connection detail
    --> that I can add. Happy if I do?

  3. Combine KM2 specific sensors into devices as suggested by Feature Request: Geräte in Home Assistant bereitstellen, statt nur Entitäten #24
    --> according to what I read in documentation and community groups, only works with custom_flow setup, not with YAML

  4. Group sensors into 'useful' device sensors and less important diagnostics sensors
    --> only works with devices, and they don't work with YAML setup.

  5. Each sensor entity_id incorporate unique device name, yet presents friendly sensor name
    --> that I can add. Happy if I do? Basically introduce the serial number of the device into sensor entity_id

  6. Update of the full dataset of all sensors belonging to a KM2 device with single API call
    --> I am not 100% sure if you do multiple API calls per sensor or not. When I re-wrote the component I first had too many calls. Can you pls confirm?

  7. Sensors that are disabled are skipped for updates, same with sensors where the state value has not changed
    --> Can do. Happy if I do a PR?

  8. Present additional device specific attributes on each sensor
    --> Can do, it's a minor thing on attributes. Happy if I do a PR on this?

  9. Extensive debug logging (hopefully helpful to anyone going through the same learning curve as myself)
    --> Maybe not that important as it was only relevant with the rather complex config_flow setup. I struggle at first, also first time doing python.

  10. Adding translations
    --> Want me to add that? I am German (but live in South Africa) and could happily add German as a language.

thanks for your feedback.
M

PS: First PR done: #37

@ankohanse
Copy link
Author

Thank you! Found them under Settings->Entities. I had been searching via Developer Tools->States and did not have a hit there. They got lost in the 500+ sensors in the list there and I must have completely overlooked them when scrolling through the list.

Part of the issue was that I was expecting sensors/entities to have 'deltasol' in their name, as that was what I configured in the 'Name' field in the config. However, it seems that that name is only used for the 'integration' field of the entities.

Problem of not using a prefix for each sensor is that they get lost and there is a huge chance of getting name conflicts on their sensor unique id with other integrations. For my system, I adapted your code so that each sensor is now prefixed with the name:

name=self.prefix + "_" + field["name"].replace(" ", "_").lower(),

with config.get(CONF_NAME) passed into DeltasolApi as self.prefix

@dm82m
Copy link
Owner

dm82m commented Nov 22, 2023

No need for it. Unique id is a combination of ids the km2 provided. The naming of the sensor can be changed within Home Assistant.

@evercape
Copy link

The one thing I suggest looking into it is to maybe have the entity_id of the sensor incorporate the serial number of the device (and the unique_id as well).

Reason is that when you have multiple Resol devices in the network and within the same Home Assistance instance, there might be an issue with those IDs.

Possibly a use case scenario not relevant for most users that only have one Resol device, but for anyone with more than one such as an installer monitoring multiple client devices this could be helpful.

@dm82m let me know if you want me to do a pull request on this:

  1. API: unique_id = self.device['serial'] + "_" + header["id"] + "__" + field["id"]
  2. #CONF_SERIAL_IN_ENTITY: false as a configuration flag
  3. If CONF_SERIAL_IN_ENTITY == True then Sensor Entity ID: serial+name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants