Skip to content

[easee] Add ability to retrieve total consumption per user#20176

Merged
lsiepel merged 14 commits intoopenhab:mainfrom
alexf2015:easee-dev
Apr 28, 2026
Merged

[easee] Add ability to retrieve total consumption per user#20176
lsiepel merged 14 commits intoopenhab:mainfrom
alexf2015:easee-dev

Conversation

@alexf2015
Copy link
Copy Markdown
Contributor

Description

This adds ability to retrieve total consumption per user.
Changes:

  • introduced user thing which has "totalConsumption" channel
  • added functionality to poll additional data from additonal API endpoints to populate that channel
  • added automatic discovery of users
  • adopted documentation
  • some minor fixes due to compiler warnings

@alexf2015 alexf2015 requested review from J-N-K and lsiepel February 4, 2026 16:32
@alexf2015 alexf2015 added the enhancement An enhancement or new feature for an existing add-on label Feb 4, 2026
@alexf2015 alexf2015 force-pushed the easee-dev branch 2 times, most recently from 83b6d28 to 1f54725 Compare February 4, 2026 18:27
@lsiepel lsiepel requested a review from Copilot February 4, 2026 19:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for retrieving total energy consumption per user in the Easee binding. It introduces a new "user" thing type that automatically discovers users with access to an Easee site and polls their consumption data.

Changes:

  • Added new user thing type with automatic discovery and a totalConsumption channel
  • Refactored common handler functionality into EaseeBaseThingHandler to reduce code duplication
  • Enhanced AbstractCommand with improved null safety and generic transform method

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
user-channel-groups.xml New channel group definition for user consumption tracking
things.xml Added user thing type configuration with site bridge reference
config.xml Added user ID configuration parameter
EaseeUserHandler.java New handler implementing polling for user consumption data
EaseeBaseThingHandler.java New base class extracting common functionality from handlers
EaseeChargerHandler.java Refactored to extend base class, removing duplicate code
GetUserTotalConsumption.java New command to fetch and sum yearly user consumption data
GetSiteUsers.java New command to fetch site users for discovery
AbstractCommand.java Enhanced transform method with generics and improved null safety
SiteState.java Updated to use new transform method signature
EaseeSiteDiscoveryService.java Added user discovery functionality
EaseeHandlerFactory.java Added user handler instantiation
EaseeBindingConstants.java Added constants for user support and API endpoints
README.md Updated documentation with user thing type details and examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at all files and came to these comments. But before you look into this, i wonder if adding a new thing user just to have one channel added is the right way.
If i understand it correctly, a site can have multiple users ? And if so, do they all have a different totalConsumption? How does that work?
If there is just one user or multiple users share the same totalConsumption value, i would consider to just add the channel to the site thing.

Comment thread bundles/org.openhab.binding.easee/README.md Outdated
Comment thread bundles/org.openhab.binding.easee/src/main/resources/OH-INF/thing/things.xml Outdated
@alexf2015
Copy link
Copy Markdown
Contributor Author

@lsiepel
Implemented changes according to your remarks.

Regarding the general question: A site can have multiple users and totalConsumption is measured for each user differently. There could be more per-user data added in future, e.g.

  • last session start date
  • last session end date
  • last session total energy
  • ...

I think with such extensions in mind it makes sense to model it that way. Otherwise the charger will hold all the data and this will soon get confusing.

Copy link
Copy Markdown
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

alexf2015 and others added 14 commits April 12, 2026 12:56
Signed-off-by: Alexander Friese <af944580@googlemail.com>
Signed-off-by: Alexander Friese <af944580@googlemail.com>
Signed-off-by: Alexander Friese <af944580@googlemail.com>
Signed-off-by: Alexander Friese <af944580@googlemail.com>
Signed-off-by: Alexander Friese <af944580@googlemail.com>
Signed-off-by: Alexander Friese <af944580@googlemail.com>
Signed-off-by: Alexander Friese <af944580@googlemail.com>
Signed-off-by: Alexander Friese <af944580@googlemail.com>
…nding/easee/internal/handler/EaseeChargerHandler.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Friese <alexf2015@users.noreply.github.com>
Signed-off-by: Alexander Friese <af944580@googlemail.com>
Signed-off-by: Alexander Friese <af944580@googlemail.com>
…ing/things.xml

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Alexander Friese <alexf2015@users.noreply.github.com>
…nding/easee/internal/command/site/GetSiteUsers.java

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Alexander Friese <alexf2015@users.noreply.github.com>
…nding/easee/internal/handler/EaseeUserHandler.java

Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Alexander Friese <alexf2015@users.noreply.github.com>
@lsiepel lsiepel merged commit 0e270ed into openhab:main Apr 28, 2026
2 checks passed
@lsiepel lsiepel added this to the 5.2 milestone Apr 28, 2026
@lsiepel lsiepel changed the title [easee] add ability to retrieve total consumption per user [easee] Add ability to retrieve total consumption per user Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An enhancement or new feature for an existing add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants