Commit Graph

162 Commits (726b0c51795a6e353b56f22fca8ceac88001eb97)

Author SHA1 Message Date
J. Nick Koston 095146b163
Fix has_entity_name not always being set in ESPHome (#97055) 2023-07-23 10:45:48 +02:00
J. Nick Koston e38f55fdb6
Move ESPHomeManager into its own file (#95870)
* Move ESPHomeManager into its own file

This is not a functional change. This is only a reorganization
ahead of some more test coverage being added so moving tests
around can be avoided later.

* relos

* fixes

* merge a portion of new cover since its small and allows us to remove the __init__ from .coveragerc
2023-07-08 09:19:44 +02:00
J. Nick Koston 734614bdda
Fix device_id not set in esphome (#95580) 2023-06-29 18:04:13 -05:00
J. Nick Koston dfe7c5ebed
Refactor ESPHome connection management logic into a class (#95457)
* Refactor ESPHome setup logic into a class

Avoids all the nonlocals and fixes the C901

* cleanup

* touch ups

* touch ups

* touch ups

* make easier to read

* stale
2023-06-28 21:39:31 -04:00
J. Nick Koston 021a39a09c
Make deep sleep esphome entities unavailable on unexpected disconnect (#95211) 2023-06-26 14:21:45 +02:00
J. Nick Koston 3b7095c63b
Fix esphome not removing entities when static info changes (#95202)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-06-25 21:31:31 -05:00
J. Nick Koston 85d6e03dd3
Require newly configured esphome device to allow Home Assistant service calls (#95143)
* Require esphome service calls to be enabled

For existing devices, calling Home Assistant services continues
to be allowed.

For newly configured devices, it must now be enabled in the options
flow

* fix

* adjust

* coverage

* adjust

* fix test

* Update homeassistant/components/esphome/strings.json

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Update homeassistant/components/esphome/strings.json

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Update homeassistant/components/esphome/strings.json

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Update homeassistant/components/esphome/__init__.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Update homeassistant/components/esphome/__init__.py

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>

* Update homeassistant/components/esphome/__init__.py

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-06-25 21:18:21 -04:00
J. Nick Koston 57a910a144
Relocate esphome entity code into its own module (#95092) 2023-06-24 23:12:36 -04:00
J. Nick Koston adc2df6b8e
Callback esphome EntityInfo by platform instead of all platforms (#95021) 2023-06-22 09:39:48 +02:00
J. Nick Koston 65a5244d5a
Fix race and add test coverage for esphome select platform (#95019) 2023-06-22 01:19:47 +02:00
J. Nick Koston 804a8ef36a
Reduce overhead to update esphome entities (#94930) 2023-06-21 11:00:21 +02:00
J. Nick Koston 2b1660c0f7
Dispatch when esphome static info changes (#94876) 2023-06-20 09:45:30 +02:00
J. Nick Koston be638d3772
Bump recommended esphome version for bluetooth to 2023.6.0 (#94773)
2023.6.0 is needed for #94138 to work
2023-06-17 16:23:33 -04:00
J. Nick Koston d369d679c7
Fix ESPHome entries reloading after startup when dashboard is in use (#94362) 2023-06-14 21:16:39 -10:00
J. Nick Koston 88bfd94800
Add support for ESPHome raw bluetooth advertisements (#94138)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-06-07 18:36:22 -05:00
Paulus Schoutsen cd330a2740
Pass device ID to conversation input (#93867) 2023-05-31 16:56:12 -04:00
Jesse Hills d7d9143a44
Add speech detection and conversation_id to esphome voice assistant (#93578)
* Add speech detection to esphome voice assistant

* Timeout after silence
Ensure events are sent before finish is called

* use va_version 3 instead of ESPHome version

* Convert repeated fixtures to factory

* Add some v3 tests

* Add conversation_id

* Bump aioesphomeapi to 13.8.0

* Fix missed buffering of detected chunk

* Alter log message

* Updates

* Spelling

* Fix return type
2023-05-30 19:49:22 -04:00
Jesse Hills 32ed45084a
ESPHome voice assistant: Version 2 - Stream raw tts audio back to device for playback (#92052)
* Send raw audio back

* Update tests

* More tests

* Fix docstrings and remove unused patches

* More tests

* MORE

* Only set raw for v2
2023-04-26 22:24:29 -04:00
Jesse Hills 29ca43acf6
Set pipeline_id from pipeline select (#92085) 2023-04-27 10:29:08 +12:00
J. Nick Koston c407fb0861
Bump recommended esphome version to 2023.4.0 for bluetooth (#91509) 2023-04-20 15:36:12 -10:00
Jesse Hills 8d201b205f
ESPHome binary sensor representing assist pipeline running (#91406)
* ESPHome binary sensor representing assist pipeline running

* Apply suggestions from code review

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Rename to call active
Simplify with attrs a little

* Load binary sensor if voice assistant on device

* Add some tests

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-04-17 19:52:37 -04:00
Jesse Hills 0ddccb26fa
ESPHome voice assistant (#90691)
* Add ESPHome push-to-talk

* Send pipeline events to device

* Bump aioesphomeapi to 13.7.0

* Log error instead of print

* Rename variable

* lint

* Rename

* Fix type and cast

* Move event data manipulation into voice_assistant callback
Process full url

* Add a test?

* Remove import

* More tests

* Update import

* Update manifest

* fix tests

* Ugh

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-04-13 19:18:56 -04:00
J. Nick Koston 87c22c3ad5
Fix state being cleared on disconnect with deep sleep esphome devices (#90925)
* Fix state being cleared on disconnect with deep sleep esphome devices

fixes #90923

* fix logic
2023-04-06 16:32:02 -04:00
Jesse Hills eb469d6a2f
Move enum mapper to own file to prevent circular dependency (#90890)
* Move enum_mapper to own file to prevent circular dependency

* Add enum mapper test
2023-04-05 22:55:51 -04:00
J. Nick Koston c566303edb
Avoid writing state to all esphome entities at shutdown (#90555) 2023-03-31 18:23:05 +02:00
J. Nick Koston 49f08ad71d
Filter out duplicate updates in esphome state dispatch (#89779) 2023-03-20 20:04:46 +01:00
Erik Montnemery cc564026fa
Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
Paulus Schoutsen 8417f22904
Trigger update of ESPHome update entity when static info updates (#87058)
Trigger update of update entity when static info updates
2023-01-31 22:13:41 -05:00
Paulus Schoutsen d88849fb04
ESPHome handle remove password and no encryption (#86995)
* ESPHome handle remove password and no encryption

* Start reauth for invalid api password

---------

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-01-30 23:05:48 -05:00
Jesse Hills d0b67689e0
Add issue to ESPHome deprecating api password (#86606)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-01-25 11:07:57 +01:00
J. Nick Koston aac89a3493
Bump recommended esphome version for bluetooth proxies to 2022.12.4 (#86308)
This will fix an MTU issue reported with airthings and
other devices.

needs https://github.com/esphome/esphome/pull/4323
2023-01-22 00:05:06 +02:00
Paulus Schoutsen 29337bc6eb
Reload ESPHome config entries when dashboard info received (#86174) 2023-01-18 17:59:55 +01:00
Franck Nijhof 382e1ac679
Code styling tweaks to the ESPHome integration (#86146) 2023-01-18 11:10:16 +01:00
epenet 9205020fa4
Avoid import homeassistant.const as a module (#85991) 2023-01-16 16:49:49 +01:00
Jesse Hills d3c41bc31c
Add friendly name support for ESPHome (#85976)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-01-15 21:33:44 -10:00
Paulus Schoutsen 06bc9c7b22
Automatically fetch the encryption key from the ESPHome dashboard (#85709)
* Automatically fetch the encryption key from the ESPHome dashboard

* Also use encryption key during reauth

* Typo

* Clean up tests
2023-01-11 15:28:31 -05:00
Paulus Schoutsen 82ec769ec5
Handle ESPHome dashboard discovery (#85662) 2023-01-11 08:30:52 -05:00
Jesse Hills 5874b4cdcf
ESPHome: do not set expected_name on APIClient (#84471) 2022-12-22 21:58:51 +01:00
Franck Nijhof b0cee0bc46
String formatting and max line length - Part 1 (#84390)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-12-22 10:12:50 +01:00
J. Nick Koston e94da1ad0f
Update ESPHome bluetooth repair issue for unique id change and 2022.12.0 (#84026)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-12-15 06:59:53 -10:00
Paulus Schoutsen d3df4dd3c1
ESPHome: Use MAC as unique ID (#83741)
* ESPHome: Use MAC as unique ID

* Normalize incoming zeroconf/dhcp macs

* Update comment

* Test ESPHome without mac in zeroconf

* Use format_mac

* Remove unique ID index from DomainData
2022-12-10 22:26:42 -05:00
J. Nick Koston 9094d73df1
Connect esphome ble scanner as soon as possible (#83728)
Other integration depend on it being available so connect
it first
2022-12-10 15:17:05 -05:00
Jan Bouwhuis 23bc39b7f4
Add type hints on `Template().__init__()` (#82574) 2022-11-23 20:26:55 +01:00
J. Nick Koston 4e11246ba5
Create an issue when using older esphome firmwares when bluetooth support is enabled (#82162)
* Create an issue when using older esphome firmwares when bluetooth support is enabled

2022.11.0 has some significant stability imporvements with
BLE. Its is non-obvious if the user is running an older
esphome version that does not have the fixes

* name

* skip repair issue if a project name is set

* drop reflashing term

* Update homeassistant/components/esphome/strings.json

* Update homeassistant/components/esphome/translations/en.json

* Update homeassistant/components/esphome/translations/en.json

Co-authored-by: Franck Nijhof <frenck@frenck.nl>

* Update homeassistant/components/esphome/translations/en.json

Co-authored-by: Franck Nijhof <frenck@frenck.nl>

* Update homeassistant/components/esphome/strings.json

Co-authored-by: Franck Nijhof <frenck@frenck.nl>

* Update homeassistant/components/esphome/strings.json

Co-authored-by: Franck Nijhof <frenck@frenck.nl>

* Update homeassistant/components/esphome/strings.json

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-11-16 22:16:51 +02:00
epenet 00f4933e72
Import tag from homeassistant.components (#82161) 2022-11-16 07:09:46 +01:00
epenet 1826795d37
Add TagProtocol for type checking (#81086)
* Add TagProtocol for type checking

* Adjust type hints
2022-11-14 14:32:10 +01:00
J. Nick Koston 8db7afb2e0
Include esphome device name in BLE logs (#81284)
* Include esphome device name in BLE logs

This makes it easier to debug what is going on when there
are multiple esphome proxies

* revert unintended change
2022-10-31 00:31:37 -05:00
Jesse Hills 97d31d05f0
Use ESPHome manufacturer name from device if provided (#80928) 2022-10-25 09:15:28 +02:00
J. Nick Koston 27a61f5407
Raise exception when esphome ble client disconnects during operation (#80885) 2022-10-24 14:04:50 -05:00
J. Nick Koston ca0cd19dc9
Switch to using new esphome bluetooth_proxy_version field (#79331) 2022-09-30 08:29:36 -04:00