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

Add IoTaWatt integration #55364

Merged
merged 64 commits into from
Aug 30, 2021
Merged

Add IoTaWatt integration #55364

merged 64 commits into from
Aug 30, 2021

Conversation

gtdiehl
Copy link
Contributor

@gtdiehl gtdiehl commented Aug 27, 2021

Breaking change

Proposed change

Add a new integration to support the IoTaWatt Energy device

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

raise UpdateFailed("Connection failed") from err

if not is_authenticated:
raise UpdateFailed("Authentication error")
Copy link
Member

Choose a reason for hiding this comment

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

A future improvement would be to raise ConfigEntryAuthFailed and start a reauth config flow.

https://developers.home-assistant.io/docs/config_entries_config_flow_handler#reauthentication

tests/components/iotawatt/test_sensor.py Show resolved Hide resolved
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good! If we add a test for removing an output sensor, I think this is ready. 👍

@balloob balloob added this to the 2021.9.0 milestone Aug 30, 2021
@balloob balloob merged commit 3bd9be2 into home-assistant:dev Aug 30, 2021
bramkragten pushed a commit that referenced this pull request Aug 30, 2021
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
@jyavenard
Copy link
Contributor

It is very unfortunate that no unique id are created for output sensors. Makes for much easier integration and allow to easily modify outputs on the iotawatt without having to modify everything in HA and lose history in the process.

@balloob
Copy link
Member

balloob commented Aug 31, 2021

Unique IDs for output sensors require a IoTaWatt firmware upgrade. It's being worked on by IoTaWatt.

@jyavenard
Copy link
Contributor

I've always dealt with outputs the same as inputs. Or is this new version of the integration relying on another data from the iotawatt?

@balloob
Copy link
Member

balloob commented Aug 31, 2021

Output sensors have no unique stable identifiers. Input has channels which can't change.

Before you go mention name… that's not stable.

@jyavenard
Copy link
Contributor

Yes, as soon as you replied I guessed that's what you wanted to do. Make sense.

I have made a lot of changes to the iotawatt HACS integration, to support calculating import/export data with the energy screen. Right now, the iotawatt code can't do that at all. I hope I can submit this very soon.

@jyavenard
Copy link
Contributor

Sorry for hijacking this ; but have only a STATE_CLASS_TOTAL_INCREASING is very limiting.
The iotawatt uses signed values depending on which way the current is flowing.

A solar read will read negative and keeps reducing ; HA can't detect rollover.

Having either a generic STATE_CLASS_TOTAL_MONOTONIC would be preferable.

@MartinHjelmare
Copy link
Member

Please create an issue instead and describe the problem. We don't want discussion in PRs after they are merged. Thanks!

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants