Skip to content

Conversation

@engrbm87
Copy link
Contributor

@engrbm87 engrbm87 commented Feb 7, 2020

Breaking change

Islamic Prayer Times is now its own integration and supports config flow. Please update your configuration by the following the documentation.
All sensors will display the prayer times as per the selected calculation method. Changing the calculation method will update all sensors with new prayer times.

Proposed change

Configure the Islamic Prayer Times integration through UI and update the calculation method using the options menu.

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
islamic_prayer_times:
  calculation_method: makkah

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request: #12435

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

@engrbm87 engrbm87 requested a review from fabaff February 7, 2020 12:18
@springstan springstan changed the title Islamic Prayer Times config flow Add Islamic Prayer Times config flow Feb 7, 2020
@codecov

This comment has been minimized.

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

There is a conflict that needs to be resolved

@engrbm87
Copy link
Contributor Author

There is a conflict that needs to be resolved

Resolved

@bdraco
Copy link
Member

bdraco commented Mar 17, 2020

If you are feeling ambitious the test coverage has decreased slightly with the change

Before

# pytest --cov=homeassistant/components/islamic_prayer_times/ -- tests/components/islamic_prayer_times/

Test session starts (platform: linux, Python 3.8.1, pytest 5.3.5, pytest-sugar 0.9.2)
rootdir: /root/home-assistant, inifile: setup.cfg
plugins: requests-mock-1.7.0, aiohttp-0.3.0, cov-2.8.1, sugar-0.9.2, timeout-1.3.3
collecting ... 
 tests/components/islamic_prayer_times/test_sensor.py ✓✓✓✓✓                                                                                                                                                                   100% ██████████

----------- coverage: platform linux, python 3.8.1-final-0 -----------
Name                                                        Stmts   Miss  Cover
-------------------------------------------------------------------------------
homeassistant/components/islamic_prayer_times/__init__.py       0      0   100%
homeassistant/components/islamic_prayer_times/sensor.py        99      5    95%
-------------------------------------------------------------------------------
TOTAL                                                          99      5    95%

After

# pytest --cov=homeassistant/components/islamic_prayer_times/ -- tests/components/islamic_prayer_times/
Test session starts (platform: linux, Python 3.8.1, pytest 5.3.5, pytest-sugar 0.9.2)
rootdir: /root/home-assistant, inifile: setup.cfg
plugins: requests-mock-1.7.0, aiohttp-0.3.0, cov-2.8.1, sugar-0.9.2, timeout-1.3.3
collecting ... 
 tests/components/islamic_prayer_times/test_config_flow.py ✓✓✓✓                                                                                                                                                                33% ███▍      
 tests/components/islamic_prayer_times/test_init.py ✓✓✓✓✓✓✓                                                                                                                                                                    92% █████████▎
 tests/components/islamic_prayer_times/test_sensor.py ✓                                                                                                                                                                       100% ██████████

----------- coverage: platform linux, python 3.8.1-final-0 -----------
Name                                                           Stmts   Miss  Cover
----------------------------------------------------------------------------------
homeassistant/components/islamic_prayer_times/__init__.py         83      7    92%
homeassistant/components/islamic_prayer_times/config_flow.py      30      0   100%
homeassistant/components/islamic_prayer_times/const.py             9      0   100%
homeassistant/components/islamic_prayer_times/sensor.py           57      3    95%
----------------------------------------------------------------------------------
TOTAL                                                            179     10    94%


Results (6.04s):
      12 passed

@bdraco
Copy link
Member

bdraco commented Mar 17, 2020

Testing passed
Screen Shot 2020-03-17 at 4 49 51 PM
Screen Shot 2020-03-17 at 4 49 19 PM
Screen Shot 2020-03-17 at 4 49 15 PM
Screen Shot 2020-03-17 at 4 48 53 PM
Screen Shot 2020-03-17 at 4 48 50 PM

@bdraco
Copy link
Member

bdraco commented Mar 18, 2020

@engrbm87 looks like this just needs docs and should be good to go

@engrbm87
Copy link
Contributor Author

engrbm87 commented Apr 1, 2020

Is it possible to rerun the test. I am not sure what the problem is.

@bdraco
Copy link
Member

bdraco commented Apr 1, 2020

@engrbm87 You'll need to rebase and then push for the CI to run again to see what the Mypy error is as the build has expired

https://developers.home-assistant.io/docs/development_catching_up/

@engrbm87
Copy link
Contributor Author

I believe this is ready to be merged

@MartinHjelmare
Copy link
Member

There's a merge conflict.

@engrbm87
Copy link
Contributor Author

Hello @MartinHjelmare , I have tried to clean up the code based on your comments and I think it is more efficient now.
I also want to highlight that these sensors should show the time as state which is the most import information for the "prayer". I included the timestamp as an attribute in case a user was using it in automation or template.

@MartinHjelmare
Copy link
Member

Two outstanding comments. Otherwise looks good. All CI tests need to be run properly though before we can merge.

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.

Great!

@MartinHjelmare MartinHjelmare self-assigned this Apr 19, 2020
@MartinHjelmare
Copy link
Member

Do we need the title for the options flow?

@engrbm87
Copy link
Contributor Author

Do we need the title for the options flow?

I got this error "* [TRANSLATIONS] Invalid strings.json: extra keys not allowed @ data['options']['title']". That is why i removed it

@MartinHjelmare
Copy link
Member

Ok, good.

@MartinHjelmare MartinHjelmare merged commit 2a6948e into home-assistant:dev Apr 20, 2020
@lock lock bot locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants