Compare commits
17 Commits
Author | SHA1 | Date |
---|---|---|
dependabot[bot] | 14f51494cb | |
github-actions[bot] | 6a23cca5d3 | |
dependabot[bot] | 44dafb9f06 | |
github-actions[bot] | 8cd85de0af | |
Jesse Hills | 0eede84ead | |
dependabot[bot] | 3bae70e462 | |
github-actions[bot] | 2ae6ff8338 | |
dependabot[bot] | 24652a226d | |
dependabot[bot] | e8d27e514e | |
github-actions[bot] | d62d67f585 | |
Mischa Siekmann | 8778ad485c | |
dependabot[bot] | 8e6717c197 | |
dependabot[bot] | adcd5b1a13 | |
dependabot[bot] | 6e2d5d4fde | |
dependabot[bot] | 8dd044e89d | |
github-actions[bot] | e97a716d44 | |
dependabot[bot] | ab390acf93 |
|
@ -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 }}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
2
setup.py
2
setup.py
|
@ -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"
|
||||
|
|
|
@ -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[
|
||||
|
|
Loading…
Reference in New Issue