8000 Add back Netatmo public weather sensors by cgtobi · Pull Request #34401 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add back Netatmo public weather sensors #34401

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

Merged
merged 14 commits into from
Jul 9, 2020

Conversation

cgtobi
Copy link
Contributor
@cgtobi cgtobi commented Apr 18, 2020

Breaking change

Proposed change

Add (back) the Netatmo public weather stations sensors and make them configurable from the UI.

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

Example entry for configuration.yaml:

# Example configuration.yaml

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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

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

Copy link
Member
@Kane610 Kane610 left a comment

Choose a reason for hiding this comment

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

Found a few things you could iterate over once more

@cgtobi cgtobi force-pushed the netatmo_weather branch from 583cafd to cf51929 Compare May 1, 2020 22:45
@cgtobi cgtobi requested a review from Kane610 May 5, 2020 22:48
@cgtobi cgtobi force-pushed the netatmo_weather branch from d7cc8e4 to d31fa11 Compare May 22, 2020 09:49
@stale
Copy link
stale bot commented Jul 5, 2020

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale label Jul 5, 2020
if self.hass.config_entries.async_entries(DOMAIN):
return self.async_abort(reason="already_setup")

await self.async_set_unique_id(DOMAIN)
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we use the username or account ID?

Copy link
Contributor Author
@cgtobi cgtobi Jul 8, 2020

Choose a reason for hiding this comment

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

Because it was never intended to support more than one account. But there is probably no reason not to if I can access that data.

@stale stale bot removed stale labels Jul 7, 2020
device_registry.async_remove_device(device.id)

if entities:
async_add_entities(entities)
Copy link
Member

Choose a reason for hiding this comment

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

Can you end up adding certain areas twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not by name, but I am not checking if the selected area already exists. The same area can be added multiple times, which can make sense since it can return average or max values for the available stations.

Once options are comited and in another run the same name is entered it will edit the existing area by that name.
Although if the area is just created in that flow without being submitted it would be overwritten.

Copy link
Member

Choose a reason for hiding this comment

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

I meant that could you end up passing certain entity objects twice to async_add_entities

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, should not happen.

@cgtobi cgtobi force-pushed the netatmo_weather branch from 6a4c365 to b4a0c7c Compare July 8, 2020 07:40
@balloob balloob mentioned this pull request Jul 8, 2020
20 tasks
@cgtobi cgtobi merged commit 155a5f7 into home-assistant:dev Jul 9, 2020

return self.async_show_form(step_id="public_weather", data_schema=data_schema)

async def _update_options(self):
Copy link
Member

Choose a reason for hiding this comment

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

This helper method doesn't need to be a coroutine since we don't await inside.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually we do in L105.

Copy link
Member

Choose a reason for hiding this comment

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

There's no await inside this method. That's what matters. We of course need to await the method currently since we have defined it as a coroutine function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, true. Fixed that in 5786afb
Thanks for pointing that out.

@cgtobi cgtobi deleted the netatmo_weather branch August 25, 2020 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0