Skip to content

Jewish calendar binary sensor#26200

Merged
MartinHjelmare merged 39 commits into
home-assistant:devfrom
tsvi:jcal_binary_sensor
Sep 6, 2019
Merged

Jewish calendar binary sensor#26200
MartinHjelmare merged 39 commits into
home-assistant:devfrom
tsvi:jcal_binary_sensor

Conversation

@tsvi
Copy link
Copy Markdown
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 tsvi force-pushed the jcal_binary_sensor branch from 8d5352b to 085866e Compare August 26, 2019 09:51
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
Comment thread tests/components/jewish_calendar/test_binary_sensor.py Outdated
Comment thread tests/components/jewish_calendar/test_binary_sensor.py Outdated
Comment thread tests/components/jewish_calendar/test_binary_sensor.py Outdated
Comment thread tests/components/jewish_calendar/test_binary_sensor.py Outdated
Comment thread tests/components/jewish_calendar/test_binary_sensor.py Outdated
Comment thread homeassistant/components/jewish_calendar/__init__.py Outdated
Comment thread homeassistant/components/jewish_calendar/binary_sensor.py Outdated
Comment thread homeassistant/components/jewish_calendar/binary_sensor.py Outdated
Comment thread homeassistant/components/jewish_calendar/binary_sensor.py Outdated
Comment thread homeassistant/components/jewish_calendar/binary_sensor.py Outdated
@tsvi tsvi force-pushed the jcal_binary_sensor branch 2 times, most recently from 6d0af80 to b105c7d Compare August 29, 2019 06:39
Comment thread tests/components/jewish_calendar/test_binary_sensor.py Outdated
Comment thread homeassistant/components/jewish_calendar/sensor.py Outdated
Comment thread tests/components/jewish_calendar/test_sensor.py Outdated
Comment thread tests/components/jewish_calendar/test_binary_sensor.py Outdated
Comment thread tests/components/jewish_calendar/__init__.py Outdated
Comment thread tests/components/jewish_calendar/__init__.py Outdated
@tsvi
Copy link
Copy Markdown
Contributor Author

tsvi commented Sep 3, 2019

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

Comment thread homeassistant/components/jewish_calendar/binary_sensor.py Outdated
@tsvi tsvi force-pushed the jcal_binary_sensor branch from 6886e4e to 879e2f6 Compare September 3, 2019 15:36
Copy link
Copy Markdown
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!

Comment thread homeassistant/components/jewish_calendar/__init__.py Outdated
Comment thread homeassistant/components/jewish_calendar/binary_sensor.py Outdated
Comment thread homeassistant/components/jewish_calendar/sensor.py Outdated
@tsvi
Copy link
Copy Markdown
Contributor Author

tsvi commented Sep 3, 2019

Fixed the imports as requested

@tsvi
Copy link
Copy Markdown
Contributor Author

tsvi commented Sep 3, 2019

I think we need a breaking change label here.

@MartinHjelmare
Copy link
Copy Markdown
Member

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

@tsvi
Copy link
Copy Markdown
Contributor Author

tsvi commented Sep 6, 2019

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

@MartinHjelmare
Copy link
Copy Markdown
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