Commit Graph

418 Commits

Author SHA1 Message Date
J. Nick Koston f15acf1b1a
Reduce duplicate code for Bluetooth Advertisements (#738) 2023-11-26 14:08:05 -06:00
J. Nick Koston 67bd7efb29
Add test for GATT error while doing a read (#736) 2023-11-26 13:59:07 -06:00
J. Nick Koston cea62efbba
Small cython cleanps to the frame helpers (#733) 2023-11-26 13:25:55 -06:00
J. Nick Koston f230825651
Add discover cli tool (#732) 2023-11-26 11:04:17 -06:00
J. Nick Koston 6e08933a75
Fix race scheduling reconnect from zeroconf records (#731) 2023-11-26 10:32:16 -06:00
J. Nick Koston c9091cbefc
Avoid closing the churning zeroconf instances in the host resolver (#730) 2023-11-26 10:12:29 -06:00
J. Nick Koston aded2d28b5
Avoid churning zeroconf instances in the host resolver when created in the reconnect logic (#729) 2023-11-26 10:05:24 -06:00
J. Nick Koston 991214ef52
Fix name logic with reconnect logic when APIConnection address lacks local (#728) 2023-11-26 09:56:32 -06:00
J. Nick Koston b3d4189b07
Fix reconnect logic cancelling the connection while handshaking (#726) 2023-11-26 09:14:42 -06:00
J. Nick Koston 908545768b
Update pre-commit with newer tools (#724) 2023-11-26 08:09:52 -06:00
J. Nick Koston 32821752a5
Remove unused pylint disables (#720) 2023-11-25 14:41:27 -06:00
J. Nick Koston cd5ad769f0
Refactor reading varuints to significant simplify plaintext frame helper (#718) 2023-11-25 14:17:24 -06:00
J. Nick Koston 18401dd7ed
Add some additional cython types to the connection module (#716) 2023-11-25 10:30:17 -06:00
J. Nick Koston 4230871761
Cleanup protobuf object construction (#715) 2023-11-25 10:18:04 -06:00
J. Nick Koston 1360dd136a
Remove unused constants from connection module (#714) 2023-11-25 10:11:21 -06:00
J. Nick Koston 66e654084b
Add test for unexpected hello responses (#712) 2023-11-25 09:58:30 -06:00
J. Nick Koston 79686bf729
Fix client connection code swallowing unhandled exceptions as debug logging (#711) 2023-11-25 09:33:43 -06:00
J. Nick Koston 2f49f804e5
Remove unreachable socket buffering check code in connection (#710) 2023-11-25 09:06:28 -06:00
J. Nick Koston d592f1e7ab
Reverse future done checks so we know they are actually reachable (#708) 2023-11-25 08:49:54 -06:00
J. Nick Koston 3711d54ffa
Add test for trying to finish an unstarted connection (#706) 2023-11-25 08:44:25 -06:00
J. Nick Koston 3abf9ff8d4
Make force_disconnect a normal function (#705) 2023-11-25 08:39:04 -06:00
J. Nick Koston 402d6fe113
Remove unreachable check in connection send_messages (#704) 2023-11-25 08:32:27 -06:00
J. Nick Koston b67e19bd94
Add test for attempting to reuse an APIConnection object raises (#703) 2023-11-25 08:18:08 -06:00
J. Nick Koston 554190228e
Remove unreachable code in connection (#702) 2023-11-25 08:10:37 -06:00
J. Nick Koston 9edba66d30
Add test coverage for invalid protobuf messages (#701) 2023-11-25 08:10:26 -06:00
J. Nick Koston 67661dbd7f
Avoid expensive debug logging checks in packet processor (#700) 2023-11-25 07:51:48 -06:00
J. Nick Koston e01f22d99a
Fix race in cleaning up connection (#698) 2023-11-25 07:11:34 -06:00
J. Nick Koston c0a153c9f3
Speed up frame helpers (#696) 2023-11-24 12:40:33 -06:00
J. Nick Koston 065c8e715d
Fix signedness of server name check (#697) 2023-11-24 12:35:58 -06:00
J. Nick Koston 9c63f3205a
Remove unused slot in the noise frame helper (#695) 2023-11-24 12:18:26 -06:00
J. Nick Koston 7a57f1fa89
Optimize the frame helpers by improving cython typing (#691) 2023-11-24 12:12:32 -06:00
J. Nick Koston 33d1d3d8c4
Speed up noise frame helper (#693) 2023-11-24 12:04:12 -06:00
J. Nick Koston aa3b8af246
Fix signedness with incoming plaintext data (#694) 2023-11-24 12:01:02 -06:00
J. Nick Koston 663f7ca950
Speed up plain text frame helper (#692) 2023-11-24 11:46:15 -06:00
J. Nick Koston 095ef822f1
Fix error in noise frame helper were we could write when the writer was unset (#685) 2023-11-24 09:42:56 -06:00
J. Nick Koston b31472c569
Refactor noise _error_on_incorrect_preamble to improve coverage (#683) 2023-11-24 08:36:31 -06:00
J. Nick Koston 39aba56958
Remove unreachable code in noise frame helper (#682) 2023-11-24 08:29:42 -06:00
J. Nick Koston c21e32fda7
Fix handshake getting the wrong exception when the ESP drops the connection because its not using noise (#681) 2023-11-24 08:26:12 -06:00
J. Nick Koston 83b4f43610
Refactor frame helper to get debug state from connection (#679) 2023-11-23 12:20:52 -06:00
J. Nick Koston f1a9f4b452
Small speed up to client callbacks (#678) 2023-11-23 11:46:52 -06:00
J. Nick Koston a0cf5d0e90
Add coverage for subscribe_home_assistant_states (#677) 2023-11-23 11:37:25 -06:00
J. Nick Koston 1f5b538502
Remove unneeded local variables from previous refactoring (#676) 2023-11-23 11:27:16 -06:00
J. Nick Koston e7d27e307e
Refactor client class to split callback conversion functions into their own module (#675) 2023-11-23 11:23:51 -06:00
J. Nick Koston 174fb8284b
Refactor state and service response converter to prepare to relocate code (#674) 2023-11-23 11:06:42 -06:00
J. Nick Koston 0347302222
Add coverage for bluetooth connection free responses (#673) 2023-11-23 10:49:24 -06:00
J. Nick Koston 96781616b8
Fix unbound variable in bluetooth logging when connection fails (#672) 2023-11-23 10:38:35 -06:00
J. Nick Koston 250f786c38
Add benchmarks for calling back bluetooth packets (#671) 2023-11-23 10:34:11 -06:00
J. Nick Koston 33966938f2
Add coverage for bluetooth advertising (#670) 2023-11-23 10:20:56 -06:00
J. Nick Koston 1cc6b3ed52
Fix missed GATT notify if the device responds immediately after subscribe (#669) 2023-11-23 09:46:56 -06:00
J. Nick Koston b8427c4cbb
Fix race running disconnect callback in reconnect logic (#666) 2023-11-23 08:39:03 -06:00
J. Nick Koston df0dbadae7
Ensure scope_id is preserved from zeroconf resolution on python versions that support it (#664) 2023-11-23 07:48:34 -06:00
J. Nick Koston 00a6ce9f6a
Pass server name to zeroconf when known (#665) 2023-11-23 07:25:05 -06:00
J. Nick Koston 70a670f2b2
Rename internal client connection get function to _get_connection (#661) 2023-11-22 22:32:22 +01:00
J. Nick Koston ac43747196
Refactor connection checks to return APIConnection to avoid many asserts (#660) 2023-11-22 22:22:10 +01:00
J. Nick Koston 77a7c5eaf4
Guard client connection asserts with if TYPE_CHECKING (#659) 2023-11-22 21:54:01 +01:00
J. Nick Koston d8cace0b26
Reduce duplication in bluetooth gatt read code (#657) 2023-11-21 23:24:54 +01:00
J. Nick Koston 2501ea4275
Add additional coverage for starting noise connections (#653) 2023-11-21 16:42:23 +01:00
J. Nick Koston 0afa8c6832
Remove in_do_connect contextvar (#652) 2023-11-21 15:36:43 +01:00
J. Nick Koston f88b15e33b
Fix `eof_received` not raising SocketClosedAPIError (#651) 2023-11-21 14:56:31 +01:00
J. Nick Koston 298aa01b00
Small cleanups to connection (#648) 2023-11-21 13:08:48 +01:00
J. Nick Koston f783438a7d
Ensure expected_disconnect is True when sending DisconnectResponse fails (#646) 2023-11-20 19:08:29 +01:00
J. Nick Koston c76d741cb8
Refactor to reduce duplicate connection code (#644) 2023-11-18 15:10:40 -06:00
J. Nick Koston b12903e2e7
Refactor zeroconf code to avoid creating instances when one is unneeded (#643) 2023-11-17 13:11:36 -06:00
J. Nick Koston f94ddf8e6a
Fix handling incoming data from protractor event loop (#642) 2023-11-16 17:50:54 -06:00
J. Nick Koston 3ccb36b6fc
Refactor frame helper to avoid py conversions when processing packets (#641) 2023-11-16 12:24:50 -06:00
J. Nick Koston d6293d9177
Refactor frame helper to allow sending multiple packets at once (#640) 2023-11-16 10:31:02 -06:00
J. Nick Koston e6257a8627
Add the ability to pass the name the reconnect logic when running logs (#639) 2023-11-15 00:55:39 -06:00
dependabot[bot] f1956aa598
Bump mypy from 1.6.1 to 1.7.0 (#638)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-11-13 22:22:43 -06:00
J. Nick Koston e70cbb8135
Increase cli tool logging timestamps to include nanoseconds (#637) 2023-11-13 13:56:52 -06:00
J. Nick Koston 634c739048
Fix host resolution when local dns does not resolve mdns (#636) 2023-11-11 14:48:12 -06:00
J. Nick Koston c1a0500ecb
Update some legacy python code to python 3.9 (#635) 2023-11-11 14:19:04 -06:00
J. Nick Koston 0202e00eae
Ensure zeroconf instance is closed when log runner ends (#632) 2023-11-11 13:43:31 -06:00
J. Nick Koston 3ffcca3bdd
Make log runner code reusable and add coverage (#630) 2023-11-11 13:06:27 -06:00
J. Nick Koston b227f79dad
Refactor bluetooth client functions to reduce duplicate code (#629) 2023-11-10 17:14:00 -06:00
J. Nick Koston a15b96c76b
Send hello and login asynchronously to speed up connecting (#628) 2023-11-09 19:17:53 -06:00
J. Nick Koston 8678fa9ebc
Small cleanups to noise write_packet (#627) 2023-11-09 11:28:18 -06:00
J. Nick Koston 419bf67e9b
Small readability improvements to the plain_text frame helper (#626) 2023-11-09 11:12:00 -06:00
J. Nick Koston 94157a8ac1
Small speed up to the plaintext frame helper (#625) 2023-11-09 10:20:42 -06:00
J. Nick Koston ef9f9bf136
Ensure an empty noise_psk or expected_name is treated as None (#623) 2023-11-08 18:00:28 -06:00
J. Nick Koston 7ac7742c91
Ensure passed params are always a str (#622) 2023-11-08 17:26:51 -06:00
J. Nick Koston 6458ebcf60
Allow the stop callback to be cancelled when already disconnected (#615) 2023-11-06 18:17:50 -06:00
J. Nick Koston 0683521839
Wait for handshake to finish to allow for clean disconnect when stopping reconnect logic (#614) 2023-11-06 16:46:32 -06:00
J. Nick Koston 2ef9ed9026
Fix zeroconf reconnect logic (#613) 2023-11-06 15:04:09 -06:00
J. Nick Koston 8357a3a0c6
Remove extra timeouts (#610) 2023-10-31 23:20:22 -05:00
J. Nick Koston 1d2682a76e
Improve logging on clean disconnect failure (#609) 2023-10-31 23:07:40 -05:00
Jesse Hills e91da7e301
Add suggested_area to device info (#607) 2023-10-26 18:01:43 +13:00
Daniel Dunn 5a8c0d8e23
Updated fork of PR for Text input components (#532)
Co-authored-by: Maurits <maurits@vloop.nl>
Co-authored-by: Daniel Dunn <dannydunn@eternityforest.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-10-25 15:35:04 +13:00
J. Nick Koston e1c42e95bf
Ensure frame_helper is always closed before the underlying socket (#602) 2023-10-23 19:22:08 -05:00
J. Nick Koston 1630816dc8
Fix unhandled exception when handshake times out (#601) 2023-10-23 12:32:20 -05:00
J. Nick Koston 8c37f088d4
Refactor internal message handlers to use a single dispatch path (#598) 2023-10-22 07:05:53 -10:00
J. Nick Koston 000ff14ac0
Make reconnect logic state machine switches check locks (#597) 2023-10-21 17:46:45 -10:00
J. Nick Koston f34bfb5d1c
Simplify raw ble advertisements callbacks (#594) 2023-10-20 17:34:05 -10:00
J. Nick Koston 359ed510a2
Move mypy disable for async_timeout to mypy.ini (#593) 2023-10-20 06:25:20 -10:00
J. Nick Koston 741308c93f
Add basic pre-commit to handle eol space (#592) 2023-10-19 14:00:36 -10:00
J. Nick Koston f31b250fe2
Remove unless local variable in _connect_resolve_host (#588) 2023-10-17 14:05:39 -10:00
J. Nick Koston 63897ed680
Move varuint functions into plain_text frame_helper (#587) 2023-10-16 17:24:03 -10:00
Jesse Hills dbdb5b442f
Add TTS_STREAM_START/END events (#586) 2023-10-17 14:28:58 +13:00
J. Nick Koston 90f0901ded
Add function to build new format unique ids (#585) 2023-10-15 15:03:13 -10:00
J. Nick Koston cb5cea784e
Improve host resolver coverage (#583) 2023-10-15 13:05:23 -10:00
J. Nick Koston 2a78e9588e
Fix trying to convert hostnames to IP Addresses (#579) 2023-10-15 12:39:12 -10:00