Compare commits

...

17 Commits

Author SHA1 Message Date
dependabot[bot] 14f51494cb
Bump pylint from 3.2.2 to 3.2.3 (#880)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-07 21:23:45 +02:00
github-actions[bot] 6a23cca5d3 Bump version to 24.5.1 2024-05-29 07:22:45 +00:00
dependabot[bot] 44dafb9f06
Bump docker/login-action from 3.1.0 to 3.2.0 (#879)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-29 09:22:26 +02:00
github-actions[bot] 8cd85de0af Bump version to 24.5.0 2024-05-27 22:32:52 +00:00
Jesse Hills 0eede84ead
Voice Assistant Timers (#878) 2024-05-28 10:32:36 +12:00
dependabot[bot] 3bae70e462
Bump pypa/cibuildwheel from 2.18.0 to 2.18.1 (#876)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-28 09:28:20 +12:00
github-actions[bot] 2ae6ff8338 Bump version to 24.4.1 2024-05-27 21:28:00 +00:00
dependabot[bot] 24652a226d
Bump pytest-asyncio from 0.23.6 to 0.23.7 (#874)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-28 09:27:46 +12:00
dependabot[bot] e8d27e514e
Bump pylint from 3.2.0 to 3.2.2 (#875)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-28 09:27:38 +12:00
github-actions[bot] d62d67f585 Bump version to 24.4.0 2024-05-14 22:05:43 +00:00
Mischa Siekmann 8778ad485c
Adding announcement flag to media player command (#871)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2024-05-15 10:05:18 +12:00
dependabot[bot] 8e6717c197
Bump pylint from 3.1.0 to 3.2.0 (#873) 2024-05-15 07:03:46 +09:00
dependabot[bot] adcd5b1a13
Bump pypa/cibuildwheel from 2.17.0 to 2.18.0 (#872) 2024-05-13 19:50:28 +09:00
dependabot[bot] 6e2d5d4fde
Bump mypy from 1.9.0 to 1.10.0 (#868) 2024-05-13 09:17:09 +09:00
dependabot[bot] 8dd044e89d
Bump black from 24.4.0 to 24.4.2 (#869)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-13 08:48:14 +09:00
github-actions[bot] e97a716d44 Bump version to 24.3.1 2024-04-23 02:44:35 +00:00
dependabot[bot] ab390acf93
Bump types-protobuf from 4.25.0.20240417 to 5.26.0.20240422 (#865)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-23 14:44:20 +12:00
10 changed files with 296 additions and 179 deletions

View File

@ -28,13 +28,13 @@ jobs:
uses: actions/checkout@v4
-
name: Log in to docker hub
uses: docker/login-action@v3.1.0
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Log in to the GitHub container registry
uses: docker/login-action@v3.1.0
uses: docker/login-action@v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}

View File

@ -25,7 +25,7 @@ jobs:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
uses: pypa/cibuildwheel@v2.18.1
env:
CIBW_SKIP: cp36-* cp37-* cp38-* cp39-* cp310-* pp* *musllinux*
CIBW_BEFORE_ALL_LINUX: apt-get install -y gcc || yum install -y gcc || apk add gcc

View File

@ -1175,6 +1175,9 @@ message MediaPlayerCommandRequest {
bool has_media_url = 6;
string media_url = 7;
bool has_announcement = 8;
bool announcement = 9;
}
// ==================== BLUETOOTH ====================
@ -1533,6 +1536,26 @@ message VoiceAssistantAudio {
bool end = 2;
}
enum VoiceAssistantTimerEvent {
VOICE_ASSISTANT_TIMER_STARTED = 0;
VOICE_ASSISTANT_TIMER_UPDATED = 1;
VOICE_ASSISTANT_TIMER_CANCELLED = 2;
VOICE_ASSISTANT_TIMER_FINISHED = 3;
}
message VoiceAssistantTimerEventResponse {
option (id) = 115;
option (source) = SOURCE_CLIENT;
option (ifdef) = "USE_VOICE_ASSISTANT";
VoiceAssistantTimerEvent event_type = 1;
string timer_id = 2;
string name = 3;
uint32 total_seconds = 4;
uint32 seconds_left = 5;
bool is_active = 6;
}
// ==================== ALARM CONTROL PANEL ====================
enum AlarmControlPanelState {
ALARM_STATE_DISARMED = 0;

File diff suppressed because one or more lines are too long

View File

@ -74,6 +74,7 @@ from .api_pb2 import ( # type: ignore
VoiceAssistantEventResponse,
VoiceAssistantRequest,
VoiceAssistantResponse,
VoiceAssistantTimerEventResponse,
)
from .client_callbacks import (
on_bluetooth_connections_free_response,
@ -131,6 +132,7 @@ from .model import (
VoiceAssistantCommand,
VoiceAssistantEventType,
VoiceAssistantSubscriptionFlag,
VoiceAssistantTimerEventType,
message_types_to_names,
)
from .model_conversions import (
@ -1192,6 +1194,7 @@ class APIClient:
command: MediaPlayerCommand | None = None,
volume: float | None = None,
media_url: str | None = None,
announcement: bool | None = None,
) -> None:
req = MediaPlayerCommandRequest(key=key)
if command is not None:
@ -1203,6 +1206,9 @@ class APIClient:
if media_url is not None:
req.media_url = media_url
req.has_media_url = True
if announcement is not None:
req.announcement = announcement
req.has_announcement = True
self._get_connection().send_message(req)
def text_command(self, key: int, state: str) -> None:
@ -1382,6 +1388,25 @@ class APIClient:
req = VoiceAssistantAudio(data=data)
self._get_connection().send_message(req)
def send_voice_assistant_timer_event(
self,
event_type: VoiceAssistantTimerEventType,
timer_id: str,
name: str | None,
total_seconds: int,
seconds_left: int,
is_active: bool,
) -> None:
req = VoiceAssistantTimerEventResponse(
event_type=event_type,
timer_id=timer_id,
name=name,
total_seconds=total_seconds,
seconds_left=seconds_left,
is_active=is_active,
)
self._get_connection().send_message(req)
def alarm_control_panel_command(
self,
key: int,

View File

@ -119,6 +119,7 @@ from .api_pb2 import ( # type: ignore
VoiceAssistantEventResponse,
VoiceAssistantRequest,
VoiceAssistantResponse,
VoiceAssistantTimerEventResponse,
)
TWO_CHAR = re.compile(r".{2}")
@ -384,4 +385,5 @@ MESSAGE_TYPE_TO_PROTO = {
112: ListEntitiesDateTimeResponse,
113: DateTimeStateResponse,
114: DateTimeCommandRequest,
115: VoiceAssistantTimerEventResponse,
}

View File

@ -124,6 +124,7 @@ class VoiceAssistantFeature(enum.IntFlag):
VOICE_ASSISTANT = 1 << 0
SPEAKER = 1 << 1
API_AUDIO = 1 << 2
TIMERS = 1 << 3
class VoiceAssistantSubscriptionFlag(enum.IntFlag):
@ -1260,6 +1261,13 @@ class VoiceAssistantEventType(APIIntEnum):
VOICE_ASSISTANT_TTS_STREAM_END = 99
class VoiceAssistantTimerEventType(APIIntEnum):
VOICE_ASSISTANT_TIMER_STARTED = 0
VOICE_ASSISTANT_TIMER_UPDATED = 1
VOICE_ASSISTANT_TIMER_CANCELLED = 2
VOICE_ASSISTANT_TIMER_FINISHED = 3
_TYPE_TO_NAME = {
BinarySensorInfo: "binary_sensor",
ButtonInfo: "button",

View File

@ -1,10 +1,10 @@
pylint==3.1.0
black==24.4.0
pylint==3.2.3
black==24.4.2
flake8==7.0.0
isort==5.13.2
mypy==1.9.0
types-protobuf==4.25.0.20240417
mypy==1.10.0
types-protobuf==5.26.0.20240422
pytest>=6.2.4,<9
pytest-asyncio==0.23.6
pytest-asyncio==0.23.7
mock>=4.0.3,<6
pytest-cov>=4.1.0

View File

@ -11,7 +11,7 @@ with open(os.path.join(here, "README.rst"), encoding="utf-8") as readme_file:
long_description = readme_file.read()
VERSION = "24.3.0"
VERSION = "24.5.1"
PROJECT_NAME = "aioesphomeapi"
PROJECT_PACKAGE_NAME = "aioesphomeapi"
PROJECT_LICENSE = "MIT"

View File

@ -72,6 +72,7 @@ from aioesphomeapi.api_pb2 import (
VoiceAssistantEventResponse,
VoiceAssistantRequest,
VoiceAssistantResponse,
VoiceAssistantTimerEventResponse,
)
from aioesphomeapi.client import APIClient, BluetoothConnectionDroppedError
from aioesphomeapi.connection import APIConnection
@ -113,6 +114,9 @@ from aioesphomeapi.model import (
VoiceAssistantAudioSettings as VoiceAssistantAudioSettingsModel,
)
from aioesphomeapi.model import VoiceAssistantEventType as VoiceAssistantEventModelType
from aioesphomeapi.model import (
VoiceAssistantTimerEventType as VoiceAssistantTimerEventModelType,
)
from aioesphomeapi.reconnect_logic import ReconnectLogic, ReconnectLogicState
from .common import (
@ -794,6 +798,16 @@ async def test_select_command(
dict(key=1, media_url="http://example.com"),
dict(key=1, has_media_url=True, media_url="http://example.com"),
),
(
dict(key=1, media_url="http://example.com", announcement=True),
dict(
key=1,
has_media_url=True,
media_url="http://example.com",
has_announcement=True,
announcement=True,
),
),
],
)
async def test_media_player_command(
@ -2475,6 +2489,31 @@ async def test_subscribe_voice_assistant_api_audio(
assert len(send.mock_calls) == 0
@pytest.mark.asyncio
async def test_send_voice_assistant_timer_event(auth_client: APIClient) -> None:
send = patch_send(auth_client)
auth_client.send_voice_assistant_timer_event(
VoiceAssistantTimerEventModelType.VOICE_ASSISTANT_TIMER_STARTED,
timer_id="test",
name="test",
total_seconds=99,
seconds_left=45,
is_active=True,
)
send.assert_called_once_with(
VoiceAssistantTimerEventResponse(
event_type=VoiceAssistantTimerEventModelType.VOICE_ASSISTANT_TIMER_STARTED,
timer_id="test",
name="test",
total_seconds=99,
seconds_left=45,
is_active=True,
)
)
@pytest.mark.asyncio
async def test_api_version_after_connection_closed(
api_client: tuple[