83 Commits

Author SHA1 Message Date
Bruno Pantaleão Gonçalves
5ae4dfb563
Improve cameras list view (#4175)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
<img width="2756" height="1368" alt="CleanShot 2026-01-07 at 14 27
46@2x"
src="https://github.com/user-attachments/assets/092f6241-06b1-47b5-802f-468d22fa4473"
/>

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-07 13:58:09 +00:00
Copilot
3f25cd80ab
Add automation domain and iOS control widget (#4120)
## Summary

Adds support for Home Assistant automations in the iOS app. Automations
can now be triggered from iOS Control Center widgets (iOS 18+), similar
to existing script and scene controls.

**Domain & Model**
- Added `automation` domain with robot icon and `trigger` service
- Included automation in `AppEntitiesModel` tracked domains for database
caching
- Added to CarPlay supported domains

**Control Widget** (iOS 18+)
- `ControlAutomation` - Main control widget
- `AutomationAppIntent` - Triggers `automation.trigger` service
- `IntentAutomationEntity` - Entity queries and selection
- `ControlAutomationsValueProvider` - Configuration with custom
icons/text

**Pattern**
Follows existing `ControlScript` and `ControlScene` implementation
patterns for consistency.

**Tests**
- Updated `testWidgetsKindCasesValues` to include assertion for
`controlAutomation` case
- Updated widget kind count validation from 25 to 26

## Screenshots

N/A - Control widgets are system UI and cannot be screenshotted during
development. Widget appears in Control Center configuration with
automation icon and allows selection from available automations.

## Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

## Any other notes

Localization strings added for English only. Additional languages will
need translation via the standard localization workflow.

<!-- START COPILOT CODING AGENT SUFFIX -->



<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 1 - Add "automation" in AppEntitiesModel domains
> 2 - Create an iOS control for running automation like it exist for
ControlScript


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

 Let Copilot coding agent [set things up for
you](https://github.com/home-assistant/iOS/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
2025-12-22 10:58:37 +00:00
Copilot
6916e5437b
Add fan entity type to Control Center controls (#4109)
## Summary
Adds fan domain support to iOS 18 Control Center controls. Users can now
toggle fan entities directly from Control Center alongside existing
light, switch, and cover controls.

## Screenshots

N/A - Control Center widget requires device testing with configured fan
entities

## Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

## Any other notes

**Implementation:**
- Added `fan` domain to `Domain` enum with on/off states and CarPlay
support
- Created `ControlFan` widget with 4 files following existing control
patterns:
  - Main widget configuration with blue tint
  - Intent handler for toggle/turn_on/turn_off services
- Entity query with async pattern (matching Switch/Cover for
future-proofing)
- Value provider for state management with SF Symbol icons
(`fan`/`fan.fill`) and optional displayText parameter
- Integrated fan domain into system components:
  - `HAAPI.swift` - Added to toggle domain case
  - `HAEntity+CarPlay.swift` - Added fan icon mapping
  - `MagicItem.swift` - Added to toggle domain case
- Registered as `controlFan` in `WidgetsKind` and `WidgetsBundle18`
- Added localization strings following established patterns ("Choose
fan" for consistency)
- Added optional `displayText` parameter to `ControlFanConfiguration`
for custom display names (matching PR #4104 pattern)

**Pattern consistency:**
Mirrors Switch/Cover implementations with async entity queries. Uses
standard on/off toggle model with state-based icons. Includes
displayText override feature for user customization.

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Add "fan" entity type to control center
controls</issue_title>
> <issue_description>
> ### Discussed in
https://github.com/home-assistant/iOS/discussions/3679
> 
> <div type='discussions-op-text'>
> 
> <sup>Originally posted by **haydonryan** June 29, 2025</sup>
> Currently on IOS we have most of the major types except for fans.
Could we add that too please?
> 
>
![image](https://github.com/user-attachments/assets/6bef25db-f706-45f8-92cb-5940b5f0f7c4)</div></issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes home-assistant/iOS#3681

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-18 16:15:02 +00:00
Luke Butler
e98e22b168
Fix location error recovery for OneShotError wrapper (#3983)
## Summary
Fixes #3691 - kCLErrorDomain errors on macOS with WiFi disabled.

Claude found the problem, but I did build and test to verify.

Root Cause:
- oneShotLocation() wraps CLError in OneShotError enum before throwing
- Error recovery in manuallyUpdate() only checked for raw CLError type
- This type mismatch prevented error recovery from triggering
- Errors propagated to UI instead of being handled gracefully

The Fix:
- Updated error recovery to also handle OneShotError type
- Now location failures are properly caught and sensor updates continue
without location data
- No more error dialogs when WiFi is disabled on macOS

Co-authored-by: Luke <8517289+luke3butler@users.noreply.github.com>
2025-11-17 11:01:36 +01:00
Bruno Pantaleão Gonçalves
1cce18b72e
Remove logic to clean frontend cache on server version change (#3787) 2025-09-03 13:51:51 -03:00
Bruno Pantaleão Gonçalves
23edc7ce0a
Fix scripts execution (#3731) 2025-07-16 11:28:10 +02:00
Bruno Pantaleão Gonçalves
ca35a9a6ac
Stop observing disabled sensors triggers (#3721) 2025-07-14 23:08:37 +02:00
Bruno Pantaleão Gonçalves
b908fff567
Reset frontend cache when server version changes + refactor webView access (#3718)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
This PR adds functionality of resetting web cache when server version
changes and also refactor WebView direct access around the project,
becoming now private to WebViewController and only interactable through
the controller's protocol.

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2025-07-14 15:13:03 +02:00
Bruno Pantaleão Gonçalves
615da4c976
Add experimental native WebRTC Player (#3703) 2025-07-07 23:30:02 +02:00
Bruno Pantaleão Gonçalves
64839bbac5
Move background task keys to enum and add tests (#3673)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-25 15:03:30 +02:00
Bruno Pantaleão Gonçalves
f6aa4c9ff0
Update user's location when opening the App (#3627)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2025-06-10 15:08:00 +02:00
Bruno Pantaleão Gonçalves
1623da6625
Migrate servers selection bottom sheet to swiftUI (#3545)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
![Simulator Screenshot - iPhone 16 Plus - 2025-04-15 at 13 27
19](https://github.com/user-attachments/assets/1c0cb20d-2561-4956-a7de-e406443c17e0)
2025-04-15 14:02:09 +02:00
Bruno Pantaleão Gonçalves
b70242c8f8
Move magic item execution out of API file (#3507)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2025-03-27 16:27:52 +01:00
Bruno Pantaleão Gonçalves
6c2097ebf3
Remove extra service data from call service request (#3505)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2025-03-26 15:17:11 +01:00
Bruno Pantaleão Gonçalves
0c419df2a3
Add "triggerSource" to service calls (#3489)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
To leverage the features from the legacy iOS Actions, this PR adds
triggerSource to all service calls in the app so users can automate
based on which device (watch/phone/car) triggered that.

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2025-03-19 15:26:17 +01:00
Bruno Pantaleão Gonçalves
02e5fa6692
Save ClientEvents on local json file instead of GRDB to avoid crashes (#3378) 2025-01-30 12:55:32 +01:00
Bruno Pantaleão Gonçalves
6952af21ca
Fix "button" domain not working on CarPlay quick access (#3342) 2025-01-17 22:36:17 +01:00
Bruno Pantaleão Gonçalves
2896f4a454
Assist improvements and revert optional connection access (#3201)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-11-27 15:42:33 +01:00
Bruno Pantaleão Gonçalves
79d84045d6
Add more logging to connectivity errors (#3196)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-11-26 14:06:57 +01:00
Bruno Pantaleão Gonçalves
13ac4e4a87
Making API connection optional given activeURL is now optional as well (#3169)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-11-18 15:07:18 +01:00
Bruno Pantaleão Gonçalves
5913eb2256
Allow entities on CarPlay quick access (#3134)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
![Simulator Screenshot - iPhone 16 - 2024-11-08 at 18 19
48](https://github.com/user-attachments/assets/429dbafc-b6a0-464e-b756-f04f34ba12cf)

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-11-11 14:33:46 +01:00
Bruno Pantaleão Gonçalves
e823624661
Do not default to internal URL when external URL is not available (#2767)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

To avoid using internal URL out of local network, this PR makes
"activeURL" optional, and it will not use internalURL when out of local
network.

Tested the internal/external logic on:
- iPhone
- iPad
- Mac
- Watch
- Shortcuts
- Notifications
- Widgets

For VPN users, they have to set external URL the same as internal URL to
have their setup working.

Pending:
- [x] Verify all edge cases where "guard let" were added
- [ ] Enforce SSID to use internal URL in the App

Next possible iteration:
- Add noise protocol between app and server to make http connections
secure

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
<img width="1154" alt="Screenshot 2024-05-13 at 11 46 47"
src="https://github.com/home-assistant/iOS/assets/5808343/7ea634cc-382b-49c2-ab64-a218f996452e">

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-11-08 17:07:02 +01:00
Bruno Pantaleão Gonçalves
a8e2f4a449
Add configuration screen for CarPlay, also migrate "iOS Actions" to "Quick access" (#3111) 2024-10-31 19:15:13 +01:00
Bruno Pantaleão Gonçalves
186aea4fa7
Create Watch Home from iOS (#2944)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

- Create watch home from iPhone
- Configure Assist for watch from iPhone
- Deprecate message for iOS Actions
- Use Scripts or Scenes directly
- Show/Hide Assist in Apple Watch
- Options to require confirmation before running watch item
(script/scene/action)

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
![CleanShot 2024-08-27 at 15 52
39@2x](https://github.com/user-attachments/assets/5360c60d-9638-40b9-b799-d12668bd579f)


https://github.com/user-attachments/assets/1e4509f8-45e5-4b39-bfdc-62f9bce64617


## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-08-28 09:45:07 +02:00
n6ham
ff66bbf2e3
Add sharedEventDeviceInfo data into the "tag_scanned" event (#2910)
sharedEventDeviceInfo contains "sourceDevicePermanentID",
"sourceDeviceName" and "sourceDeviceID" values.

It is used in other action events (such as event triggered from the
Apple Watch). "sourceDeviceName" can be used to send an actionable
notification back to the device that was used to scan tag. Currently
it's not possible, since these values are not dispatched in the event
body.

<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-08-12 11:46:37 +02:00
Bruno Pantaleão Gonçalves
df68401139
Add device registry id to assist call (#2838)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

Integration PR:
https://github.com/home-assistant/core/pull/121496#event-13420408451

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-07-09 16:01:58 +02:00
Perry Naseck
31e62c254f
Use user agent for all webviews (fixes #2512) (#2728) 2024-04-24 21:53:13 +02:00
Michal Šrůtek
7de47c6e62
static var to static let (#2642)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

- `static let` plays nicely with modern Swift concurrency (async/await)
- `static let` makes it impossible to mutate the values - causing
undefined behavior in some cases
2024-03-25 11:57:48 +01:00
Michal Šrůtek
3146e08aac
Available checks cleanup for iOS 15 and watchOS 8 (#2622)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

As the [minimum watchOS is
8](https://github.com/home-assistant/iOS/pull/2609) and [minimum iOS
15](https://github.com/home-assistant/iOS/pull/2469), this PR removes
redundant `#available` checks.

Co-authored-by: Bruno Pantaleão Gonçalves <bruno.ing879@gmail.com>
2024-03-04 15:36:55 +01:00
mat1th
97834bfd5e
Update swift lint and format + appy fixes (#2585)
## Summary
Swift lint and swiftformat are outdated. This PR does update those +
applies the new formatting form swiftformat.
There is 1 swift file with a manual change:
`Sources/Vehicle/Templates/Areas/CarPlayAreasViewModel.swift`. This is
done because `swiftlint` did create the following swiftlint error:
`error: Cyclomatic Complexity Violation: Function should have complexity
10 or less; currently complexity is 11 (cyclomatic_complexity)`.

Because it does change a lot of files the question is if we want to
finetune the `swiftformat` rules.

## Screenshots
No user facing changes.

## Link to pull request in Documentation repository
NA

## Any other notes
NA
2024-02-22 13:06:39 +01:00
Bruno Pantaleão Gonçalves
135b7642b5
Add CarPlay Actions and general improvements (#2517) 2024-01-16 21:23:52 +01:00
Bruno Pantaleão Gonçalves
e9c85b3f7a
Drop iOS 12, 13 and 14 support (#2469)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
Drop support for iOS 12 and 13.

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2023-12-27 16:50:11 +01:00
Zac West
4332c0ec11
Add intent handler for conversation (#2284)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
Adds an intent handler for the conversation feature in core-2023.2.

## Screenshots

![simulator_screenshot_5002493C-BF10-4193-87B9-59E69CD78B6F](https://user-images.githubusercontent.com/74188/213895975-825f2b28-b530-4a32-87b7-475c07f041ef.png)

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2023-01-21 19:53:41 -08:00
Zac West
d51a2d6893
Update to Xcode 14 & dependencies (#2228)
Fixes #2214.

## Summary
Updates to building with Xcode 14 as the minimum. Updates all
dependencies (as many both require Xcode 14 to update and would not work
with it without updating).

## Any other notes
This excludes `arm64` (new in Xcode 14) from watchOS builds. This is due
to App Store Connect having a bad heuristic for file size:

> ITMS-90389: Size Limit Exceeded - The size of watch application
'/Payload/Home Assistant.app/Watch/HomeAssistant-WatchApp.app' (102MB)
has exceeded the 75MB size limit.

Our binary file is larger than 75 MB unthinned and our thinned install
size is sub-25 MB, so I don't think this is testing the right thing. In
either case, we're somehow below whatever the limit actually is with
just `arm64_32_v8` and `arm_v7k` slices.

The first build on TF using the Xcode 14 build for distribution is
2022.413.
2022-10-19 13:56:30 -07:00
Zac West
471b27edd1
Skip updating registration in push provider (#2227)
## Summary
The push provider's periodic updating runs the 'connect' mechanism,
which also updates the registration/integration. In iOS 16, this means
we're updating the device name to 'iPhone' because our device name
entitlement only exists in the main app. To avoid this issue, we no
longer update the registration in the push provider.

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2022-10-17 20:35:00 +00:00
Zac West
662eec4c64
Allow trusting otherwise-invalid TLS certificates during onboarding (#2131)
## Summary
During onboarding, allow trusting an invalid certificate chain for most features of the app.

## Screenshots
<img src="https://user-images.githubusercontent.com/74188/170773293-14eeb3fb-2e54-42a5-b6c6-8b07c792ea24.png" width="300">

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
Future changes necessary:
- Trusting certificates if an error occurs while the app is running
- Trusting certificates when configuring internal/external URLs
2022-05-27 23:15:14 +00:00
Zac West
2250a779ea
Periodically update sensors from local push extension (#2138)
## Summary
When the Local Push extension is running (when we're on Wi-Fi in an SSID marked as 'Internal' and location is set to Always), we're given a persistent opportunity to do work. When we're running, we now update sensors on a regular interval.

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#753

## Any other notes
Updating the metadata/sensors every 5 minutes (by default) should have minimal, if any, battery implications. This follows the same setting as the "Periodic" timer which we use for foreground updates.
2022-05-24 03:30:25 +00:00
Zac West
326d9a2c04
Potentially fix invalid authentication issues (#2091)
## Summary
There is a potential race condition in token retrieving which could result in providing an old access token to a WebView external auth request. This should at least make it not provide the wrong one, even though the race condition will still occur with the saved keychain data.

## Any other notes
My hunch is that a server's info is updated using stale data just as an access token is updated, which would cause the "grab the server.info.token" to use the wrong access token when constructing the dictionary.

Grabbing it from the server is unnecessary here - we're in the promise chain for getting the new access token anyway, so we can avoid the underlying issue by using the right token when we know it works.

I can sort of reproduce this by hammering server info updates and grabbing the dictionary but not in any way that is reliable enough to write a test around. It may be worth trying to add some sanity checks into the token expirations in the future too. Some additional logging here should make it a little easier to figure out what's going on if/when this reproduces.
2022-02-25 04:45:48 +00:00
Zac West
60ac777069
Fix warnings in Xcode 13.3 (#2053) 2022-02-02 09:22:36 -08:00
Zac West
ab56fd7afa
Revert "Remove Firebase (#2028)" (#2051)
This reverts commit 2c4bab1d5c5e61b33f3e3fd74ee8aedaa261accf.
2022-01-23 18:45:04 +00:00
Zac West
2c4bab1d5c
Remove Firebase (#2028)
## Summary
Removes FCM and related SDKs in favor of using the server introduced in #2024.

## Any other notes
This will require testing. It may be worth reverting this PR to introduce a toggle if this lasts more than 1 beta cycle.

Future work includes figuring out the permanent location for these services; they are on fly.io right now but that may cost money, but for now I just want TestFlight builds to use it.
2021-12-26 09:01:29 +00:00
Zac West
370fd18735
Server privacy setting for sensors (#2019)
## Summary
When set to "None", all sensors sent to the server will be redacted.

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#644

## Any other notes
This also updates location when changing location privacy & sensors when changing sensor privacy, so the data server-side will be most-up-to-date.
2021-12-20 23:15:40 -08:00
Zac West
e3d1d1c8ac
Setting for types of locations sent to a server (#2015)
Requires home-assistant/core#62243.

## Summary
Allows sending exact locations (current behavior, gps coordinates), no locations (sets the device tracker to 'unknown' effectively), and zone-only locations (we send `home`, `other_zone_name` or `not_home` only).

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#639
2021-12-20 15:13:11 -08:00
Zac West
d4324cc6d6
Fix cases of sending invalid sensor values on macOS (#1972)
- Stops caching of sensor values and now sends them to the server regardless if we think they have changed. Fixes #1473. The sensor container was (a) prone to issues (as it could not fully capture network semantics) and (b) not updated for multi-server support.
- Moves all intent handling that I can into the app for iOS 14+ / macOS 11+. The only intent that must be in the extension is the focus intent, which now strictly updates just the focus sensor on macOS, since it did not have access to all sensor values. Fixes #1921.
2021-12-05 10:00:47 -08:00
Zac West
7631aa5110
Changeable local name for servers (#1945)
Changes the server name row into an editable one, persists along with the server and uses it everywhere. Basically identical to 'device name' in functionality there.

Also hides the 'activate' button if there's only one server.
2021-11-28 15:51:11 -08:00
Zac West
a3cf326d7b
Store zones by server, allowing duplicate entity ids (#1936)
## Summary
Stores a zone from s1 in Realm like `s1/zone.name` rather than `zone.name` so it's distinct from `s2/zone.name`. This is most apparent for `zone.home` which universally conflicts.

## Any other notes
This does not yet extend to the other synced models as we use their identifier in persisted locations that aren't programmatically changeable (e.g. action IDs are stored in intents). Zones don't pose such a problem, and are the most likely suspect to even have duplicates right now; scenes, actions, and deprecated notification categories can be done after an external beta.
2021-11-28 04:39:29 +00:00
Zac West
5c104f76e9
Multi-server (#1906)
## Summary
Most, but not all, of the changes necessary to support multi-server throughout the app and all its features.

## Screenshots
| Light | Dark |
| ----- | ---- |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 24](https://user-images.githubusercontent.com/74188/143670011-9b9905ac-1b5b-4a82-b9f3-1490465c4ec5.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 26](https://user-images.githubusercontent.com/74188/143670012-0080230a-8f68-4f34-9691-db9f5e825a83.png) |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 30](https://user-images.githubusercontent.com/74188/143670015-ceeac558-e039-4639-a186-b5001ab418b8.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 29](https://user-images.githubusercontent.com/74188/143670016-d72bb69d-83f5-4197-a742-59d208467258.png) |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 47](https://user-images.githubusercontent.com/74188/143670021-6c90c40f-c2f1-4a33-aad9-da6626e99d9d.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 52 45](https://user-images.githubusercontent.com/74188/143670024-e99de69d-61d8-4e12-be73-a172242806a0.png) |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 53 05](https://user-images.githubusercontent.com/74188/143670033-1a41ac7e-d4d1-458b-974e-2efdaf8e2288.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 53 03](https://user-images.githubusercontent.com/74188/143670049-baf4db64-64db-4bfb-88cf-4930f9e5661b.png) |
| ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 53 21](https://user-images.githubusercontent.com/74188/143670053-7ec794f1-857c-4ef6-a92a-5318e90ac6b6.png) | ![Simulator Screen Shot - iPhone 13 Pro - 2021-11-26 at 21 53 19](https://user-images.githubusercontent.com/74188/143670056-a6a5207c-3bba-49fc-b5c6-fc6fa8141f9c.png) |

## Any other notes
- Encapsulates all connectivity, token & server-specific knowledge in a Server model object which gets passed around.
- Updates various places throughout the app to know about and use Server rather than accessing said information through non-server-specific methods.
- Visually requests/notes server in places where it's ambiguous. For example, the Open Page widget will gain a subtitle if multiple servers are set up.
- Allows switching which server is shown in the WebViews. Note that this doesn't take into account multi-window support on iPad/macOS yet.

Most things will migrate successfully however adding an additional server causes things like Shortcuts to start erroring requiring you specify which to use in the particular Shortcut.

Future work necessary:
- Model objects currently clobber each other if their identifiers match. For example, both servers having a zone named `home` means one of them wins the fight for which is known to the app.
- Being remotely logged out on any account causes the app to require onboarding again, when instead it should only do that if the last known server is logged out.
2021-11-27 12:33:46 -08:00
Zac West
c55e1f98ed
Provide clearer error if mobile_app is not loaded during onboarding (#1914)
## Summary
If the API call to `mobile_app/registrations` fails due to a 404, explain that the component needs to be loaded. This likely, in the old flow, was erroring a bit more randomly on the final screen, as the same order of checks was happening.

## Screenshots
| Before | After |
| ------ | ----- |
| ![image](https://user-images.githubusercontent.com/74188/141503139-e09bf4fb-fafb-4743-ad14-34cd9c1bc923.png) | ![image](https://user-images.githubusercontent.com/74188/141503061-7712615f-21fd-45b9-8a83-8ddc67bb6721.png) |

## Any other notes
This is the "Alamofire.AFError 9" error during onboarding _after_ logging in noted in [this forum post](https://community.home-assistant.io/t/ha-companion-app-alamofire-aferror-9/355504/11).

It is worth noting that this error message could be happening because the internal URL (or the URL connecting to) is incorrect, which would produce the same error message after entering the URL or tapping the discovered row, but before entering credentials.
2021-11-13 14:12:21 -08:00
Zac West
4c39d8672d
Add testing to onboarding authentication/login handling (#1888) 2021-10-25 21:04:05 -07:00
Zac West
7cbde6ddb2
Try and fix Realm crashes via excessive background tasks (#1874)
Starting in iOS 15, there's a number of crashes happening in the background with Realm. They don't appear to be due to the file lock in the shared app container, but this may help resolve them either way -- easy to see if the next beta doesn't crash a bunch.
2021-10-03 21:28:00 +00:00