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

HA state_class & device_class #38

Open
yozik04 opened this issue Oct 10, 2022 · 14 comments
Open

HA state_class & device_class #38

yozik04 opened this issue Oct 10, 2022 · 14 comments

Comments

@yozik04
Copy link
Owner

yozik04 commented Oct 10, 2022

@elupus, do we want to have state_class and device_class attributes for every coil in json files? You will need them in HomeAssistant integration.

@elupus
Copy link
Collaborator

elupus commented Oct 10, 2022

I think that might be overkill. But perhaps that could be a good way to declare parameters that is good to have default.

I do like having higher level entities like climate and waterheater, those we need to represent somehow too. This is what i did in nibeuplink: https://github.com/elupus/nibeuplink/blob/1798c3840a73b0a35fc54f3c70033b8d331d0de6/src/nibeuplink/const.py#L72

@yozik04
Copy link
Owner Author

yozik04 commented Oct 10, 2022

No I do not offer to add these manually. We can try to detect these from unit_of_measurement.

@yozik04
Copy link
Owner Author

yozik04 commented Oct 10, 2022

This is how I did it in yozik04/nibe-mqtt@aa83e47

@elupus
Copy link
Collaborator

elupus commented Oct 10, 2022

We already do that in the HA integration. Those classes are internal to HA so they should not really be in lib.

@yozik04
Copy link
Owner Author

yozik04 commented Oct 10, 2022

I was thinking the same.

@tanelvakker
Copy link
Contributor

There are a lot of registers that don't have a unit defined. One example is compressor starts. Currently it ends up without a class and is considered a text field by HA.
"43635": {
"title": "EB108-EP14 Compressor starts",
"size": "u32",
"factor": 1,
"min": 0.0,
"max": 9999999.0,
"default": 0.0,
"name": "eb108-ep14-compressor-starts-43635"
},
Screenshot 2022-10-11 at 16 20 22

@elupus
Copy link
Collaborator

elupus commented Oct 11, 2022

We can mark them here with a custom unit, and translate that in HA.

@tanelvakker
Copy link
Contributor

Would adding state_class "measurement" for any integers be a solution that takes care of most instances?

@elupus
Copy link
Collaborator

elupus commented Oct 11, 2022

Yes, but we also need to to get total/increasing in place. I do think it would be good if we added some unit in the lib.

@tanelvakker
Copy link
Contributor

If you can define what the units are for counter type measures, I can start manually adding these to jsons. Would compressor starts have a measurement "times" or maybe "#"?

@elupus
Copy link
Collaborator

elupus commented Oct 11, 2022

Or count. However i do think we should have a way of specifying extensions to the raw csv file, that can be applied to multiple pump types. @yozik04 thoughts?

@yozik04
Copy link
Owner Author

yozik04 commented Oct 11, 2022

raw csv files are unmodified files exported from a heatpump or Modbus Manager. I do not want to touch these. We can edit json files if needed. I will need to store manual patches to json files some day, somehow.

@tanelvakker compressor starts does not need a unit. It requires state_class=total, I think. https://developers.home-assistant.io/docs/core/entity/sensor/#how-to-choose-state_class-and-last_reset

@elupus
Copy link
Collaborator

elupus commented Oct 12, 2022

@yozik04 yes, but we currently base those data on unit availability. We could as mentioned add state class and device class to the json file. But it does feel very home assistant specific, so i'm a bit hesitant. I did this to move changes to a separate extension file: #40 but maybe it should be a per-device extension file.

@elupus
Copy link
Collaborator

elupus commented Feb 6, 2024

Shown up again: home-assistant/core#104074 we need to figure out some way to handle this.

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