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

Update PostNL to also contain distributions and letters #27551

Closed
wants to merge 4 commits into from

Conversation

peternijssen
Copy link
Contributor

@peternijssen peternijssen commented Oct 12, 2019

Breaking Change:

The PostNL component now also contains distribution of packages and letters, next to the already existing delivery of packages. sensor.postnl has now been renamed to sensor.postnl_delivery. Additionally, sensor.postnl_distribution and sensor.postnl_letters became available. This component is now fully compatible with the PostNL Lovelace card.

Description:

The component now also adds distributions and letters and can nicely work together with a custom Lovelace card.

I've marked the following issue as solved, as the original suggestion was to have a custom Lovelace card, which is now possible.
Related issue (if applicable): fixes #20696

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10749

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

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. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

@peternijssen
Copy link
Contributor Author

@iMicknl Feel free to comment. Let me know if you want to be added as codeowner and I will add you in this PR.

@MartinHjelmare MartinHjelmare changed the title Updated PostNL to also contain distributions and letters Update PostNL to also contain distributions and letters Oct 13, 2019
@peternijssen
Copy link
Contributor Author

Not sure why the tests are failing. I suppose they need to be restarted.

@frenck
Copy link
Member

frenck commented Oct 16, 2019

@peternijssen CI for checking code styling/formatting fails. Please format your code using Black, by running this from the project root:

black --fast homeassistant

@peternijssen
Copy link
Contributor Author

Thanks @frenck. It also ran now in the pre commit. I only noticed it's missing in the dev docs I believe: https://developers.home-assistant.io/docs/en/development_testing.html

homeassistant/components/postnl/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/postnl/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/postnl/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/postnl/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/postnl/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/postnl/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/postnl/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/postnl/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/postnl/sensor.py Outdated Show resolved Hide resolved
Dev automation moved this from Needs review to Review in progress Oct 27, 2019
@iMicknl
Copy link
Contributor

iMicknl commented Nov 4, 2019

@iMicknl Feel free to comment. Let me know if you want to be added as codeowner and I will add you in this PR.

This is fine, I currently won't have many time to maintain it. :-)

add_entities([PostNLSensor(api, name)], True)
add_entities([PostNLDelivery(api, name)], True)
add_entities([PostNLDistribution(api, name)], True)
add_entities([PostNLLetter(api, name)], True)
Copy link
Member

Choose a reason for hiding this comment

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

The two new classes are more or less duplicating the existing code.

Remove PostNLDistribution and PostNLLetter but add a data object and a list of the available e sensors. E.g., openweathermap or bitcoin sensor.

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 sure if I completely understand. The only thing that is common is a part of the init method, the properties and a part of the update method. I could create a data object, store the name etc in it, but that basically means that with the name property, I have to retrieve it from the data property and the creation still happens in the init of the current class, as it's not a common name.

Also the update method is different between both. Perhaps the shipment foreach loop could be in a data class which handles that, I am just wondering if that's enough gain for you.

Or am I thinking something different then what you ment?

@balloob
Copy link
Member

balloob commented Dec 5, 2019

Closing this as PostNL is currently broken.

@balloob balloob closed this Dec 5, 2019
Dev automation moved this from Review in progress to Cancelled Dec 5, 2019
@lock lock bot locked and limited conversation to collaborators Dec 6, 2019
@peternijssen peternijssen deleted the postnl branch December 9, 2020 17:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Cancelled
Development

Successfully merging this pull request may close these issues.

PostNL component broken
6 participants