Commit Graph

44 Commits (99ab2566c25a3ba40b205302065740907675bd84)

Author SHA1 Message Date
epenet e734971d33
Enable collections-named-tuple (PYI024) rule in ruff (#123019) 2024-08-02 15:28:32 +02:00
Tsvi Mostovicz f40897b54c
Add Jewish Calendar reconfiguration test (#118833)
* Revert "Remove flaky tests"

This reverts commit c4de9fdcbe.

* Change reconfigure test to be based on data

* Don't assert using internals

* Fix assertions to be on config entry
2024-07-11 11:17:12 +02:00
Marc Mueller 921430d497
Import Generator from collections.abc (3) (#120916) 2024-07-01 12:09:11 +02:00
Tsvi Mostovicz 29da88d8f6
Create a Jewish Calendar entity (#120253)
* Set has_entity_name to true

* Move common code to jewish calendar service entity

* Remove already existing assignment

* Move data to common entity

* Remove description name

* Use config entry title instead of name for the device

* Address comments
2024-06-23 19:55:27 +02:00
Tsvi Mostovicz 2cc34fd7e7
Improve Jewish calendar entities (#120236)
* By default don't enable all sensors

* Fix tests

* Add entity category

* Set has_entity_name to true

* Revert "Set has_entity_name to true"

This reverts commit 5ebfcde78a.
2024-06-23 17:26:45 +02:00
SLaks 2dfa0a3c90
Add Jewish Calendar attributes for non-date sensors (#116252) 2024-06-22 14:30:19 +02:00
Tsvi Mostovicz 369f9772f2
Fix Jewish Calendar unique id migration (#119683)
* Implement correct passing fix

* Keep the test as is, as it simulates the current behavior

* Last minor change
2024-06-17 12:37:30 +02:00
Marc Mueller 33ed4fd862
Import Generator from typing_extensions (3) (#118990) 2024-06-06 17:28:59 +02:00
Tsvi Mostovicz 98455cbd93
Fix updating options in Jewish Calendar (#118643) 2024-06-04 20:55:38 +02:00
Tsvi Mostovicz 12215c51b3
Fix Jewish calendar unique id's (#117985)
* Initial commit

* Fix updating of unique id

* Add testing to check the unique id is being updated correctly

* Reload the config entry and confirm the unique id has not been changed

* Move updating unique_id to __init__.py as suggested

* Change the config_entry variable's name back from config to config_entry

* Move the loop into the update_unique_ids method

* Move test from test_config_flow to test_init

* Try an early optimization to check if we need to update the unique ids

* Mention the correct version

* Implement suggestions

* Ensure all entities are migrated correctly

* Just to be sure keep the previous assertion as well
2024-05-30 18:27:15 +02:00
Tsvi Mostovicz ea91f7a5aa
Change strings to const in Jewish Calendar (#118274) 2024-05-28 07:49:39 +02:00
Tsvi Mostovicz 11646cab5f
Move Jewish calendar constants to const file (#118180)
* Move Jewish calendar constants to const file

* Add a few missed constants

* Move CONF_LANGUAGE to it's correct path
2024-05-26 19:23:02 +02:00
Yuval Aboulafia 2c09f72c33
Add config flow to Jewish Calendar (#84464)
* Initial commit

* add basic tests (will probably fail)

* Set basic UID for now

* Various improvements

* use new naming convention?

* bit by bit, still not working tho

* Add tz selection

* Remove failing tests

* update unique_id

* add the tests again

* revert to previous binary_sensor test

* remove translations

* apply suggestions

* remove const.py

* Address review

* revert changes

* Initial fixes for tests

* Initial commit

* add basic tests (will probably fail)

* Set basic UID for now

* Various improvements

* use new naming convention?

* bit by bit, still not working tho

* Add tz selection

* Remove failing tests

* update unique_id

* add the tests again

* revert to previous binary_sensor test

* remove translations

* apply suggestions

* remove const.py

* Address review

* revert changes

* Fix bad merges in rebase

* Get tests to run again

* Fixes due to fails in ruff/pylint

* Fix binary sensor tests

* Fix config flow tests

* Fix sensor tests

* Apply review

* Adjust candle lights

* Apply suggestion

* revert unrelated change

* Address some of the comments

* We should only allow a single jewish calendar config entry

* Make data schema easier to read

* Add test and confirm only single entry is allowed

* Move OPTIONS_SCHEMA to top of file

* Add options test

* Simplify import tests

* Test import end2end

* Use a single async_forward_entry_setups statement

* Revert schema updates for YAML schema

* Remove unneeded brackets

* Remove CONF_NAME from config_flow

* Assign hass.data[DOMAIN][config_entry.entry_id] to a local variable before creating the sensors

* Data doesn't have a name remove slugifying of it

* Test that the entry has been created correctly

* Simplify setup_entry

* Use suggested values helper and flatten location dictionary

* Remove the string for name exists as this error doesn't exist

* Remove name from config entry

* Remove _attr_has_entity_name - will be added in a subsequent PR

* Don't override entity id's - we'll fixup the naming later

* Make location optional - will by default revert to the user's home location

* Update homeassistant/components/jewish_calendar/strings.json

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* No need for local lat/long variable

* Return name attribute, will deal with it in another PR

* Revert unique_id changes, will deal with this in a subsequent PR

* Add time zone data description

* Don't break the YAML config until the user has removed it.

* Cleanup initial config flow test

---------

Co-authored-by: Tsvi Mostovicz <ttmost@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-05-24 14:04:17 +02:00
J. Nick Koston 5a609c34bb
Fix blocking I/O in the event loop when loading timezones (#117721) 2024-05-20 11:06:03 +02:00
Marc Mueller aa16a9d707
Add empty line after module docstring (3) (#112750) 2024-03-08 20:38:34 +01:00
Marc Mueller c88b337600
Add empty line after module docstring [tests f-k] (#112709) 2024-03-08 14:50:04 +01:00
Jan-Philipp Benecke 92b3c0c96b
Update i-j* tests to use entity & device registry fixtures (#103900) 2023-11-13 11:51:55 +01:00
Franck Nijhof d3ed8de232
Update Ruff to v0.0.247 (#88210)
* Update Ruff to v0.0.247

* Fix new found violations
2023-02-15 16:46:03 -05:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
epenet ea29cdfe83
Add type hints to integration tests (part 12) (#87997) 2023-02-13 13:03:51 +01:00
epenet f75ac17554
Add type hints to integration tests (j-m) (#87704) 2023-02-08 19:06:59 +01:00
Yuval Aboulafia 7c46eb5952
Add test for incorrect config for Jewish Calendar (#71163)
* Loop load Jewish Calendar platforms

* Address review

* Add test for incorrect config

* add test to sensor platform
2022-05-02 20:52:00 +03:00
J. Nick Koston fe6a4bfb1d
Remove EVENT_TIME_CHANGED and EVENT_TIMER_OUT_OF_SYNC (#69643)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-09 09:05:54 -10:00
Erik Montnemery cf4033b1bc
Simplify time zone setting in tests (#68330)
* Simplify timezone setting in tests

* Fix typo

* Adjust caldav tests

* Adjust input_datetime tests

* Adjust time_date tests

* Adjust tod tests

* Adjust helper tests

* Adjust recorder tests

* Adjust risco tests

* Adjust aemet tests

* Adjust flux tests

* Adjust forecast_solar tests

* Revert unnecessary change in forecast_solar test

* Adjust climacell tests

* Adjust google tests

* Adjust sensor tests

* Adjust sonarr tests

* Adjust template tests

* Adjust zodiac tests

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-20 10:25:15 +01:00
Simone Chemelli 969930b9c9
Remove debug print (#63460) 2022-01-05 15:34:33 +01:00
Franck Nijhof d4d791e0a1
Ensure Jewish Calendar returns an iso formatted timestamp (#52722) 2021-07-26 20:23:25 -07:00
J. Nick Koston bf2d40adfe
Migrate from pytz to python-dateutil (#49643)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-05-07 22:46:26 -07:00
amitfin f8690c29cd
Bump libhdate dependency (#48695) 2021-04-10 17:20:08 +02:00
amitfin 2391134d26
Update "issur_melacha_in_effect" via time tracking (#42485) 2021-04-09 12:26:55 +02:00
Erik Montnemery 84226da404
Update tests i-o to use async_get() instead of async_get_registry() (#47653) 2021-03-09 14:32:08 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Andrew Marks d0af3339fc
Add unique_id to jewish_calendar entities (#39025) 2020-09-06 20:29:17 -05:00
J. Nick Koston 89a9634d35
Use eventloop for scheduling (#37184)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-06-29 09:39:24 -07:00
Paulus Schoutsen 2af984917e
Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Moshe Kaplan 7dff5e79d1
Add support for displaying Daf Yomi (#30628)
* Add support for displaying Daf Yomi

* Ran black --fast

* Added docstring to get_daf

* Further lint fixes

* Remove unnecessary else

* clarify code

* Use fstrings

* pull daf yomi from hdate

* Update manifest version for daf_yomi support

* fix variable usage

* Update requirements

* Also pass in today's date as well

* Rename date variable to daytime_date

* Add tests for daf yomi sensor

* Update stale test IDs
2020-02-16 00:00:17 +01:00
Franck Nijhof f5d4878992 Fix isort on a small set of misc files (#29803) 2019-12-10 09:25:42 +01:00
Bas Nijholt 0fbb450838 Sort imports according to PEP8 for jewish_calendar (#29697)
* use isort to sort imports according to PEP8 for jewish_calendar

* fix order
somehow isort did the wrong thing
2019-12-09 11:30:31 +01:00
Tsvi Mostovicz d7a66e6e4c Return Jewish Calendar holiday type id support (#29168)
* Bring back holiday type id as a attribute to the holiday sensor

* Add test for holiday type id attribute
2019-11-27 20:52:03 +01:00
Tsvi Mostovicz 2bc6b59e79 Move holiday info into a single sensor with multiple attributess (#27654)
* Move holiday onfo into a single sensor with multiple attributess

* Add tests for holiday attributes
2019-10-17 20:32:24 -07:00
Tsvi Mostovicz 9e3005133a Standardize times in time sensors Jewish calendar (#26940)
* Standardize times in time sensors Jewish calendar

* Fix pylint errors

* Add non-default time format test

* Make black happy

* Remove timestamp device class

Timestamp device class requires ISO 8601 format

* Revert "Remove timestamp device class"

This reverts commit 8a2fda39831bc750c3a77aa774b84b054d78032c.

* Remove time_format

As this is part of the UI decision, it should be decided by lovelace.

A nice addition for a future PR, might be the option to hint to lovelace the preferred way to display some data.

* Update name of state_attributes

* State of timestamp variable to be shown in UTC

Although I don't understand it, I give up :)

* Remove unnecessary attributes

I don't really see the value in these attributes, if there are any they should be implemented in
the sensor component for the timestamp device class
2019-10-10 20:57:48 +02:00
Tsvi Mostovicz 815e7a70e9 Jewish calendar binary sensor (#26200)
* Move jewish calendar to its own platform

* Fix tests for Jewish Calendar platform

As part of this, move tests to use async_setup_component instead of
testing JewishCalendarSensor as suggested by @MartinHjelmare here:

https://github.com/home-assistant/home-assistant/pull/24958#pullrequestreview-259394226

* Get sensors to update during test

* Use hass.config.set_time_zone instead of directly calling set_default_time_zone in tests

* Cleanup log messages

* Rename result from weekly_portion to parshat_hashavua

* Fix english/hebrew tests

* Fix updating of issue melacha binary sensor

* Fix docstrings of binary sensor

* Reset timezones before and after each test

* Use correct entity_id for day of the omer tests

* Fix omer tests

* Cleanup and rearrange tests

* Remove the old issur_melacha_in_effect sensor

* Rename variables to make the code clearer

Instead of using lagging_date, use after_tzais and after_shkia

* Use dt_util.set_default_time_zone instead of hass.config.set_time_zone so as not to break other tests

* Remove should_poll set to false (accidental copy/paste)

* Remove _LOGGER messaging during init and impossible cases

* Move binary tests to standalone test functions

Move sensor tests to standalone test functions

* Collect entities before calling add_entities

* Fix pylint errors

* Simplify logic in binary sensor until a future a PR adds more sensors

* Rename test_id holyness to holiday_type

* Fix time zone for binary sensor tests

Fix time zone for sensor tests

* Don't use unnecessary alter_time in sensors

Don't use unnecessary alter time in binary sensor

Remove unused alter_time

* Simply set hass.config.time_zone instead of murking around with global values

* Use async_fire_time_changed instead of directly calling async_update_entity

* Removing debug messaging during init of integration

* Capitalize constants

* Collect all Entities before calling async_add_entities

* Revert "Don't use unnecessary alter_time in sensors"

This reverts commit 74371740eaeb6e73c1a374725b05207071648ee1.

* Use test time instead of utc_now

* Remove superfluous testing

* Fix triggering of time changed

* Fix failing tests due to side-effects

* Use dt_util.as_utc instead of reimplementing it's functionality

* Use dict[key] for default values

* Move 3rd party imports to the top of the module

* Fix imports
2019-09-06 13:24:10 +02:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
arigilder f3e542542a Add missing support for jewish_calendar.omer_count sensor (#24958)
* Add missing support for omer_count to jewish_calendar

* Add tests for omer sensor

* Add tests for omer after tzeit hakochavim

* Lint fixes
2019-07-09 11:58:57 +02:00
Penny Wood f195ecca4b Consolidate all platforms that have tests (#22109)
* Moved climate components with tests into platform dirs.

* Updated tests from climate component.

* Moved binary_sensor components with tests into platform dirs.

* Updated tests from binary_sensor component.

* Moved calendar components with tests into platform dirs.

* Updated tests from calendar component.

* Moved camera components with tests into platform dirs.

* Updated tests from camera component.

* Moved cover components with tests into platform dirs.

* Updated tests from cover component.

* Moved device_tracker components with tests into platform dirs.

* Updated tests from device_tracker component.

* Moved fan components with tests into platform dirs.

* Updated tests from fan component.

* Moved geo_location components with tests into platform dirs.

* Updated tests from geo_location component.

* Moved image_processing components with tests into platform dirs.

* Updated tests from image_processing component.

* Moved light components with tests into platform dirs.

* Updated tests from light component.

* Moved lock components with tests into platform dirs.

* Moved media_player components with tests into platform dirs.

* Updated tests from media_player component.

* Moved scene components with tests into platform dirs.

* Moved sensor components with tests into platform dirs.

* Updated tests from sensor component.

* Moved switch components with tests into platform dirs.

* Updated tests from sensor component.

* Moved vacuum components with tests into platform dirs.

* Updated tests from vacuum component.

* Moved weather components with tests into platform dirs.

* Fixed __init__.py files

* Fixes for stuff moved as part of this branch.

* Fix stuff needed to merge with balloob's branch.

* Formatting issues.

* Missing __init__.py files.

* Fix-ups

* Fixup

* Regenerated requirements.

* Linting errors fixed.

* Fixed more broken tests.

* Missing init files.

* Fix broken tests.

* More broken tests

* There seems to be a thread race condition.
I suspect the logger stuff is running in another thread, which means waiting until the aio loop is done is missing the log messages.
Used sleep instead because that allows the logger thread to run. I think the api_streams sensor might not be thread safe.

* Disabled tests, will remove sensor in #22147

* Updated coverage and codeowners.
2019-03-18 23:07:39 -07:00