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

Jewish calendar binary sensor #26200

Merged
merged 39 commits into from
Sep 6, 2019

Conversation

tsvi
Copy link
Contributor

@tsvi tsvi commented Aug 25, 2019

Breaking Change:

Change in configuration.yaml

sensor:
  - platform: jewish_calendar
    sensors:
       - date
       - ...

To

jewish_calendar:

Automations based on sensor.issur_melacha_in_effect comparison to True/False need to be updated to use binary_sensor.issur_melacha_in_effect on and off states.

Explanation

  • Move Jewish calendar sensor to its own platform
  • Split sensors into sensors and binary sensors
  • Removal of the "sensors" key, following ADR003 removing data selectors, instead show all of the sensors.

The issur_melacha_in_effect was supposed to be a binary sensor. I wasn't aware of the distinction back when I first developed this integration. This fixes this issue by creating a new platform, supporting both types of sensors.

Description:

Make Jewish calendar its own platform with two types of sensors: sensor and binary sensor. In a future PR I plan to split the sensor furthermore in data and time related so that I can provide datetime attributes in the same fashion as the date sensor. This will provide easier ways of writing automations.

Related issue (if applicable): fixes #20315
As part of this change, I implemented @MartinHjelmare suggestion for testing the components,

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

Example entry for configuration.yaml (if applicable):

jewish_calendar:
  language: hebrew
  diaspora: False

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.

If the code does not interact with devices:

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

tsvi added a commit to tsvi/home-assistant.github.io that referenced this pull request Aug 26, 2019
@tsvi tsvi changed the title WIP: Jewish calendar binary sensor Jewish calendar binary sensor Aug 28, 2019
tests/components/jewish_calendar/test_binary_sensor.py Outdated Show resolved Hide resolved
tests/components/jewish_calendar/test_binary_sensor.py Outdated Show resolved Hide resolved
tests/components/jewish_calendar/test_binary_sensor.py Outdated Show resolved Hide resolved
tests/components/jewish_calendar/test_binary_sensor.py Outdated Show resolved Hide resolved
tests/components/jewish_calendar/test_binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/jewish_calendar/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/jewish_calendar/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/jewish_calendar/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/jewish_calendar/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/jewish_calendar/binary_sensor.py Outdated Show resolved Hide resolved
@tsvi tsvi force-pushed the jcal_binary_sensor branch 2 times, most recently from 6d0af80 to b105c7d Compare August 29, 2019 06:39
@tsvi
Copy link
Contributor Author

tsvi commented Sep 3, 2019

Finally got all the tests to pass. @MartinHjelmare any more fixes necessary?

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!

@tsvi
Copy link
Contributor Author

tsvi commented Sep 3, 2019

Fixed the imports as requested

@tsvi
Copy link
Contributor Author

tsvi commented Sep 3, 2019

I think we need a breaking change label here.

@MartinHjelmare
Copy link
Member

Please add to the breaking change paragraph what the user needs to do to cope with the breaking change.

@tsvi
Copy link
Contributor Author

tsvi commented Sep 6, 2019

@MartinHjelmare can you merge the PR? Or are we waiting for another review?

@MartinHjelmare
Copy link
Member

We're all good! Changing the PR description doesn't generate a github notification.

@MartinHjelmare MartinHjelmare merged commit 815e7a7 into home-assistant:dev Sep 6, 2019
@lock lock bot locked and limited conversation to collaborators Sep 7, 2019
@tsvi tsvi deleted the jcal_binary_sensor branch September 11, 2019 15:06
@tsvi tsvi restored the jcal_binary_sensor branch September 11, 2019 15:07
@tsvi tsvi deleted the jcal_binary_sensor branch September 11, 2019 15:28
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.

Refactor jewish_calendar to work as binary_sensor and sensor.
3 participants