Add Freebox button to mark calls as read (#80609)

* Add Freebox button to mark calls as read

* Bump Freebox to 1.0.1

* Fix black/flake8

* Add entity_category + fix reboot button name

* Add has_entity_name to reboot

* Remove 'missed' as it put all calls as read

* base unique_id on key and not name

* unique_id base on key later with migration step

* Keep the same name

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
Quentame 2022-10-24 09:33:59 +02:00 committed by GitHub
parent 91e6ee5da5
commit b1202ab31f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 4 deletions

View File

@ -11,7 +11,7 @@ from homeassistant.components.button import (
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN
@ -37,8 +37,15 @@ BUTTON_DESCRIPTIONS: tuple[FreeboxButtonEntityDescription, ...] = (
key="reboot",
name="Reboot Freebox",
device_class=ButtonDeviceClass.RESTART,
entity_category=EntityCategory.CONFIG,
async_press=lambda router: router.reboot(),
),
FreeboxButtonEntityDescription(
key="mark_calls_as_read",
name="Mark calls as read",
entity_category=EntityCategory.DIAGNOSTIC,
async_press=lambda router: router.call.mark_calls_log_as_read(),
),
)

View File

@ -3,7 +3,7 @@
"name": "Freebox",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/freebox",
"requirements": ["freebox-api==1.0.0"],
"requirements": ["freebox-api==1.0.1"],
"zeroconf": ["_fbx-api._tcp.local."],
"codeowners": ["@hacf-fr", "@Quentame"],
"iot_class": "local_polling",

View File

@ -9,6 +9,7 @@ from pathlib import Path
from typing import Any
from freebox_api import Freepybox
from freebox_api.api.call import Call
from freebox_api.api.wifi import Wifi
from freebox_api.exceptions import NotOpenError
@ -186,6 +187,11 @@ class FreeboxRouter:
"""Return sensors."""
return {**self.sensors_temperature, **self.sensors_connection}
@property
def call(self) -> Call:
"""Return the call."""
return self._api.call
@property
def wifi(self) -> Wifi:
"""Return the wifi."""

View File

@ -709,7 +709,7 @@ forecast_solar==2.2.0
fortiosapi==1.0.5
# homeassistant.components.freebox
freebox-api==1.0.0
freebox-api==1.0.1
# homeassistant.components.free_mobile
freesms==0.2.0

View File

@ -528,7 +528,7 @@ foobot_async==1.0.0
forecast_solar==2.2.0
# homeassistant.components.freebox
freebox-api==1.0.0
freebox-api==1.0.1
# homeassistant.components.fritz
# homeassistant.components.fritzbox_callmonitor