mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Supervisor update entity auto update from api (#79611)
* Supervisor update entity auto update from api * Update api mocks in tests
This commit is contained in:
parent
214c2934de
commit
416c10a793
@ -219,7 +219,6 @@ class SupervisorOSUpdateEntity(HassioOSEntity, UpdateEntity):
|
|||||||
class SupervisorSupervisorUpdateEntity(HassioSupervisorEntity, UpdateEntity):
|
class SupervisorSupervisorUpdateEntity(HassioSupervisorEntity, UpdateEntity):
|
||||||
"""Update entity to handle updates for the Home Assistant Supervisor."""
|
"""Update entity to handle updates for the Home Assistant Supervisor."""
|
||||||
|
|
||||||
_attr_auto_update = True
|
|
||||||
_attr_supported_features = UpdateEntityFeature.INSTALL
|
_attr_supported_features = UpdateEntityFeature.INSTALL
|
||||||
_attr_title = "Home Assistant Supervisor"
|
_attr_title = "Home Assistant Supervisor"
|
||||||
|
|
||||||
@ -233,6 +232,11 @@ class SupervisorSupervisorUpdateEntity(HassioSupervisorEntity, UpdateEntity):
|
|||||||
"""Return native value of entity."""
|
"""Return native value of entity."""
|
||||||
return self.coordinator.data[DATA_KEY_SUPERVISOR][ATTR_VERSION]
|
return self.coordinator.data[DATA_KEY_SUPERVISOR][ATTR_VERSION]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def auto_update(self) -> bool:
|
||||||
|
"""Return true if auto-update is enabled for supervisor."""
|
||||||
|
return self.coordinator.data[DATA_KEY_SUPERVISOR][ATTR_AUTO_UPDATE]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def release_url(self) -> str | None:
|
def release_url(self) -> str | None:
|
||||||
"""URL to the full release notes of the latest version available."""
|
"""URL to the full release notes of the latest version available."""
|
||||||
|
@ -75,6 +75,7 @@ def mock_all(aioclient_mock, request):
|
|||||||
"result": "ok",
|
"result": "ok",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"version_latest": "1.0.0",
|
"version_latest": "1.0.0",
|
||||||
|
"auto_update": True,
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"name": "test",
|
"name": "test",
|
||||||
|
@ -92,7 +92,11 @@ def mock_all(aioclient_mock, request, os_info):
|
|||||||
"http://127.0.0.1/supervisor/info",
|
"http://127.0.0.1/supervisor/info",
|
||||||
json={
|
json={
|
||||||
"result": "ok",
|
"result": "ok",
|
||||||
"data": {"version_latest": "1.0.0", "version": "1.0.0"},
|
"data": {
|
||||||
|
"version_latest": "1.0.0",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"auto_update": True,
|
||||||
|
},
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"name": "test",
|
"name": "test",
|
||||||
@ -536,6 +540,7 @@ async def test_device_registry_calls(hass):
|
|||||||
supervisor_mock_data = {
|
supervisor_mock_data = {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"version_latest": "1.0.0",
|
"version_latest": "1.0.0",
|
||||||
|
"auto_update": True,
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"name": "test",
|
"name": "test",
|
||||||
@ -586,6 +591,7 @@ async def test_device_registry_calls(hass):
|
|||||||
supervisor_mock_data = {
|
supervisor_mock_data = {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"version_latest": "1.0.0",
|
"version_latest": "1.0.0",
|
||||||
|
"auto_update": True,
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"name": "test2",
|
"name": "test2",
|
||||||
@ -620,6 +626,7 @@ async def test_device_registry_calls(hass):
|
|||||||
supervisor_mock_data = {
|
supervisor_mock_data = {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"version_latest": "1.0.0",
|
"version_latest": "1.0.0",
|
||||||
|
"auto_update": True,
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"name": "test2",
|
"name": "test2",
|
||||||
|
@ -68,6 +68,7 @@ def mock_all(aioclient_mock, request):
|
|||||||
"result": "ok",
|
"result": "ok",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"version_latest": "1.0.0",
|
"version_latest": "1.0.0",
|
||||||
|
"auto_update": True,
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"name": "test",
|
"name": "test",
|
||||||
|
@ -79,6 +79,7 @@ def mock_all(aioclient_mock, request):
|
|||||||
"result": "ok",
|
"result": "ok",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"version_latest": "1.0.1dev222",
|
"version_latest": "1.0.1dev222",
|
||||||
|
"auto_update": True,
|
||||||
"addons": [
|
"addons": [
|
||||||
{
|
{
|
||||||
"name": "test",
|
"name": "test",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user