All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Added: URLSession optional parameter to
HAConnectionInfofor custom configuration, e.g. for mTLS support.
- Fixed: Memory leak caused by NWPathMonitor not being cancelled
- Added: mTLS support
- Fixed: HAEntity attributes update
- Changed: Prevent connection retry after invalid credentials.
- Changed: Update get_services to handle optional name and description.
- Changed: Add timeout to retry logic when performing a request.
- Fixed: Standard-compliant parsing of Content-Type header, 'allowing application/json; charset=utf-8' and variations.
- Changed: Differentiate cache also by data provided (e.g. domain filter for states)
- Changed: Allow passing data to entities state subcription, so you can filter what you want to receive
- Changed: Avoid JSON cache by JSONSerialization NSString
- Added: Typed request to send Assist audio data to Assist pipeline
- Changed: Use of forked StarScream which fixes usage of URLSession
- Added: REST API calls can now be issued.
- Added:
HAConnectionInfocan now provide a closure to handle SecTrust (TLS certificate) validation other than the default.
- Changed:
HARequestTypeis now an enum ofwebSocketandrest. The command value for REST calls is the value after 'api/', e.g. 'api/template' has a type of.rest(.post, "template"). - Changed:
HADatanow includes aprimitivecase to express non-array/dictionary values that aren'tnull. - Changed: WebSocket connection will now enable compression.
- Fixed: Calling
HAConnection.connect()andHAConnection.disconnect()off the main thread no longer occasionally crashes. - Removed: Usage of "get_states"
- Added: More efficient API "subscribe_entities" replacing "get_states"
- Added: Subscriptions will now retry (when their request
shouldRetry) when the HA config changes or components are loaded. - Changed:
HAConnectionInfonow has a throwing initializer. SeeHAConnectionInfo.CreationErrorfor details.
- Added: Allow overriding
User-Agentheader in connection viaHAConnectionInfo. - Fixed:
Hostheader now properly excludes port so we match URLSession behavior. - Fixed: Services now load successfully for versions of HA Core prior to 2021.3 when
namewas added.
- Changed:
HAGlobal'slogblock now contains a log level, eitherinfoorerror. - Fixed: Failed populate requests no longer crash when a later subscription is updated.
- Fixed: The error log from a failed
HACache<T>populate now contains more information. - Fixed: Dates from HA which lack milliseconds no longer fail to parse.
- Added:
HACache<T>which can send requests and subscribe to events to keep its value up-to-date. - Added
HACachesContaineraccessible asconnection.cacheswhich contains built-in caches. - Added:
connection.caches.stateswhich contains and keeps up-to-date all entity states. - Added:
connection.caches.userwhich contains the current user. - Added: Optional
PromiseKittarget/subspec. - Added: Optional
HAMockConnectiontarget/subspec for use in test cases. - Added:
connectAutomaticallyparameter to connection creation. This will callconnect()when requests are sent if not connected. - Added:
.getServices()typed request. - Added:
.getStates()typed request. - Changed: Swapped to using the custom (not URLSession) engine in Starscream to try and figure out if URLSession is causing connectivity issues.
- Changed:
attributesandcontextonHAEntityare now represented by parsed types. - Changed: Many internal cases of JSON parsing and decoding are now done off the main thread.
- Changed: Events to unknown subscriptions (that is, a logic error in the library somewhere) no longer unsubscribe as this was sending erroneously during reconnects.
- Fixed: Calling
connect()when already connected no longer disconnects and reconnects. - Fixed: Calling
cancel()on a subscription more than once or on a non-retried subscription sends multiple unsubscribe requests. - Fixed: Disconnections silently occurred due to e.g. suspension; pings are now sent regularly to make sure the connection really is active.
Initial release.