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 new sensor platform to expose Islamic prayer times #19444

Merged
merged 6 commits into from Dec 20, 2018

Conversation

Projects
None yet
4 participants
@uchagani
Copy link
Contributor

uchagani commented Dec 19, 2018

Description:

Adds a new sensor platform for Islamic prayer times. Old PR (#19136) got muddled with other commits so I created a new one.

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

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: islamic_prayer_times

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.

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

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

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
@uchagani

This comment has been minimized.

Copy link
Contributor

uchagani commented Dec 19, 2018

@MartinHjelmare Ready for another review.

@uchagani

This comment has been minimized.

Copy link
Contributor

uchagani commented Dec 20, 2018

@MartinHjelmare ready for another review.

@MartinHjelmare
Copy link
Member

MartinHjelmare left a comment

Looks good! One clean up left.

@MartinHjelmare MartinHjelmare changed the title added new sensor platform to expose Islamic prayer times Add new sensor platform to expose Islamic prayer times Dec 20, 2018

@uchagani

This comment has been minimized.

Copy link
Contributor

uchagani commented Dec 20, 2018

@MartinHjelmare ready for another review

@MartinHjelmare
Copy link
Member

MartinHjelmare left a comment

Great!

@MartinHjelmare MartinHjelmare merged commit 71900ca into home-assistant:dev Dec 20, 2018

5 checks passed

Hound No violations found. Woof!
WIP ready for review
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.01%) to 93.047%
Details

@wafflebot wafflebot bot removed the in progress label Dec 20, 2018

mxworm added a commit to mxworm/home-assistant that referenced this pull request Dec 21, 2018

Merge branch 'dev' into current
* dev: (75 commits)
  Add native ESPHome Home Assistant state feature (home-assistant#19429)
  Add new sensor platform to expose Islamic prayer times (home-assistant#19444)
  Add timeout to RainMachine login (home-assistant#19476)
  Reorder FLOW entries in config_entries.py (home-assistant#19475)
  Update pynetgear to 0.5.2 (home-assistant#19490)
  Rename ocr.png to ssocr-(entity_name).png to allow multiple instances (home-assistant#18634)
  Add Mythic Beasts DNSAPI Component (home-assistant#18333)
  Adds battery_percent which had been introduced with pyatmo 1.4 and resolves unknown var warning. (home-assistant#19309)
  Bump Pybotvac To Support D7 On Latest Firmware (home-assistant#19463)
  Add device registry to MQTT alarm control panel (home-assistant#19331)
  Add device registry to MQTT lock (home-assistant#19333)
  Bump pyharmony (home-assistant#19460)
  Add testcase test_entity_id_update
  Add device registry to MQTT climate
  Updated frontend to 20181219.0
  Update translations
  ZHA entity ZCL reporting configuration (home-assistant#19177)
  Use web sockets for Harmony HUB (home-assistant#19440)
  Correct calls to subscription.async_unsubscribe_topics (home-assistant#19414)
  Various updates (home-assistant#19449)
  ...

dshokouhi added a commit to dshokouhi/home-assistant that referenced this pull request Dec 25, 2018

Add new sensor platform to expose Islamic prayer times (home-assistan…
…t#19444)

* added new sensor platform to expose Islamic prayer times

* added new sensor platform to expose Islamic prayer times

* updated tests according to feedback

* make prayer_times_info a public attribute

* remove stale comments

@uchagani uchagani referenced this pull request Dec 26, 2018

Merged

Add docs for islamic_prayer_times sensor platform #7783

2 of 2 tasks complete

@balloob balloob referenced this pull request Jan 10, 2019

Merged

0.85.0 #19897

@laithalsunni

This comment has been minimized.

Copy link

laithalsunni commented Jan 14, 2019

Hi @uchagani ,
Nice work. however, can you tell me why did you not include all of the methods?

"method" (number) -
A prayer times calculation method. Methods identify various schools of thought about how to compute the timings. This parameter accepts values from 0-12 and 99, as specified below:
0 - Shia Ithna-Ansari
1 - University of Islamic Sciences, Karachi
2 - Islamic Society of North America
3 - Muslim World League
4 - Umm Al-Qura University, Makkah
5 - Egyptian General Authority of Survey
7 - Institute of Geophysics, University of Tehran
8 - Gulf Region
9 - Kuwait
10 - Qatar
11 - Majlis Ugama Islam Singapura, Singapore
12 - Union Organization islamic de France
13 - Diyanet İşleri Başkanlığı, Turkey

you could have just did this

class PrayerTimesCalculator:
    CALCULATION_METHODS = {
        'shia': 0, 
        'karachi': 1,
        'isna': 2,
        'mwl': 3,
        'makkah': 4,
        'egas': 5,
        'igut': 6,
        'gulf': 7,
        'kuwait': 8,
        'qatar': 9,
        'muss': 10,
        'uoisdf': 11,
        'dibt': 12

see my fork https://github.com/AlsunniNet/prayer-times-calculator

@uchagani

This comment has been minimized.

Copy link
Contributor

uchagani commented Jan 14, 2019

@laithalsunni Honestly it was just for simplicity. If there is interest in more method calculations I'll update it.

@laithalsunni

This comment has been minimized.

Copy link

laithalsunni commented Jan 14, 2019

@uchagani yes. I have already put in a request on your repository.

@uchagani

This comment has been minimized.

Copy link
Contributor

uchagani commented Jan 14, 2019

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Jan 15, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.