-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Use DataUpdateCoordinator in scrape
#80593
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
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
Conversation
Hey there @fabaff, @gjohansson-ST, mind taking a look at this pull request as it has been labeled with an integration ( |
mocker.payload = "test_scrape_sensor_no_data" | ||
async_fire_time_changed(hass, datetime.utcnow() + SCAN_INTERVAL) | ||
await hass.async_block_till_done() |
|
|
assert mocker.data is None | ||
state = hass.states.get("sensor.ha_version") | ||
assert state is not None | ||
assert state.state == "Current Version: 2021.12.10" | ||
assert state.state == STATE_UNAVAILABLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: there is a slight change of behavior here.
With the DataCoordinator, we now set the state as UNAVAILABLE, where previously it returned the last value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @epenet 👍
* Add DataUpdateCoordinator to scrape * Fix tests
Breaking change
Previous implementation of scrape would return the last correct value if the http request failed.
This has been adjusted to now mark the sensor as
unavailable
.Proposed change
Use
DataUpdateCoordinator
inscrape
Linked to #74325
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: