kdeyev / eyeonwater

HACS repository for EyeOnWater integration
MIT License
26 stars 6 forks source link

Add second sensor for historical data #58

Closed kdeyev closed 1 year ago

kdeyev commented 1 year ago

This PR addresses #30 and #43 The integration will add 2 different water meters:

The "statistic" one should be used in the Energy Dashboard as a workaround for the negative water usage values issue discussed in #30.

disforw commented 1 year ago

This looks great, do you think I should reconstruct it a little differently and separate out the sensors in to different classes since this is only “temporary”? It would be much easier later on to remove all of the secondary sensor stuff that way. Otherwise, this will work the way it is.

kdeyev commented 1 year ago

Yes, thank you! Do you want me to merge it first?

kdeyev commented 1 year ago

BTW, I never had those crazy problems with statistics, so the regular sensor works for me great

disforw commented 1 year ago

No, i’ll work inside of your branch. I have not seen any abnormal values either! I’ll work on this on Sunday, tonight is a drinking evening 😁.

disforw commented 1 year ago

Theres an import_historical_data in both the super(coordinater) and the sensor? Are they the same thing?

disforw commented 1 year ago

Extra sensor created 👍🏼

kdeyev commented 1 year ago

@disforw Sorry, I missed your message. Yes, I made them almost identical and the only difference is the attr_state_class. I found that the statistic with attr_state_class = None has some limitations, for example, it does not calculate the consumed water cost. So I decided to create 2 almost identical sensors, one for the happy path and another as a fallback.

kdeyev commented 1 year ago

I see pre-commit checks are failing. let me fix it

kdeyev commented 1 year ago

Should we merge it?

disforw commented 1 year ago

I cleaned us up a little bit, looks good to me. Wanna just check it with a beta first?