47 Commits

Author SHA1 Message Date
Bruno Pantaleão Gonçalves
6b3419ea23
Display dynamic island indication when db is updating (#4230)
<!-- 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="1796" height="804" alt="CleanShot 2026-01-16 at 13 11 31@2x"
src="https://github.com/user-attachments/assets/4c0be252-f3b6-4ff5-b27e-8b11f19eaee4"
/>

## 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. -->
2026-01-16 12:50:22 +00:00
Copilot
a7627d53aa
Fix Mac device identification on macOS Catalyst (#4108) 2025-12-18 02:28:53 +00:00
Copilot
9e8df8ad9d
Format BSSID MAC addresses with leading zeros for consistency with Android (#4095)
## Summary
BSSID sensor reported MAC addresses without leading zeros (e.g.,
`18:e8:29:a7:e9:b`), inconsistent with Android companion app and
standard MAC address notation. This breaks cross-platform room presence
tracking.

**Changes:**
- Added `String.formattedBSSID` extension that pads hex octets to 2
characters
- Applied formatting to BSSID sensor state in `ConnectivitySensor`
- Added test coverage for formatting edge cases

```swift
// Before: "18:e8:29:a7:e9:b"
// After:  "18:e8:29:a7:e9:0b"
sensor.State = bssid.formattedBSSID
```

## Screenshots
N/A - Sensor value formatting change only

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

## Any other notes
**Breaking change:** Users with BSSID-based automations must update to
the new zero-padded format. This aligns iOS with Android, standard MAC
notation, and network management tools like UniFi.

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>BSSID mac address format isn't consistant with Android
Companion app</issue_title>
> <issue_description>**iOS device model, version and app version**
> <!-- Please include your device 'Model Name' and 'Software Version' as
listed in iOS Settings>General>About. Please also give the app version
listed beneath "Home Assistant Companion" in the App Configuration>About
menu within the app, please include the number in brackets -->
> 
> Model Name: IPhone 6S
> Software Version: IOS 14.4.1
> App version: 2021.77
> 
> **Home Assistant Core Version**
> version | core-2021.3.4
> -- | --
> installation_type | Home Assistant Container
> dev | false
> hassio | false
> docker | true
> virtualenv | false
> python_version | 3.8.7
> os_name | Linux
> os_version | 5.3.18-3-pve
> arch | x86_64
> timezone | Europe/Paris
> 
> <details><summary>Home Assistant Community Store</summary>
> 
> GitHub API | ok
> -- | --
> Github API Calls Remaining | 4998
> Installed Version | 1.11.0
> Stage | running
> Available Repositories | 850
> Installed Repositories | 8
> 
> </details>
> 
> <details><summary>Home Assistant Cloud</summary>
> 
> logged_in | false
> -- | --
> can_reach_cert_server | ok
> can_reach_cloud_auth | ok
> can_reach_cloud | ok
> 
> </details>
> 
> <details><summary>Lovelace</summary>
> 
> dashboards | 9
> -- | --
> resources | 6
> views | 31
> mode | storage
> 
> </details>
> 
> **Describe the bug**
> The BSSID sensor reports access point mac address with leading zeros
omitted
> example:
> 
> ```
> 18:e8:29:a7:e9:b
> ```
> The last number is 0x0b
> 
> An adroid device connected the the same access point returns 
> 
> ```
> 18:e8:29:a7:e9:0b
> ```
> **To Reproduce**
> You need to have an access point with mac bytes lower then 0x10
> 
> **Expected behavior**
> Having same BSSID representation than reported by Android App
companion
> 
> **Screenshots**
> Iphone:
>
![image](https://user-images.githubusercontent.com/5980377/113318644-f3901d00-9310-11eb-94a8-63e53675946d.png)
> 
> Android phone
>
![image](https://user-images.githubusercontent.com/5980377/113318689-00ad0c00-9311-11eb-8594-8daa837dbb2a.png)
> 
> 
> **Additional context**
> I'm using BSSID to track room presence based on connected AP. I'm
trying to share BSSID --> access point for all household mobile.
> 
> I'd prefer the version with leading 0 witch is aligned with Unify
management tool.
> 
> </issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> <comment_new><author>@zacwest</author><body>
> We're just slurping the value we read from the system, so we'd need to
sanitize the input to change it. It would also be a breaking change for
modifying what values are sent up, which is less-than-ideal since users
get auto-updated in the apps. I'm not sure there's a great path forward
for resolving this.</body></comment_new>
> </comments>
> 


</details>



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

- Fixes home-assistant/iOS#1563

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

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

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-16 12:38:06 +00:00
Bruno Pantaleão Gonçalves
2340cdf975
Add location and local access permission screens to onboarding (#3895) 2025-10-14 23:05:28 +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
16f5a1bc75
Simplify and migrate onboarding screens to SwiftUI (#3527)
<!-- 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. -->



https://github.com/user-attachments/assets/e79c6e4d-13ff-405a-9463-02e597ce4996
2025-04-08 23:54:34 +02:00
Bruno Pantaleão Gonçalves
87306eabbb
Rename iOS audio sensor values (#3237)
<!-- 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-12-05 15:03:41 +01:00
Bruno Pantaleão Gonçalves
d7ba21107a
iOS Audio output sensor (#3161)
<!-- 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-12-02 14:10:22 +01:00
Bruno Pantaleão Gonçalves
745355abcc
Fix watch sensors sync (#2966) 2024-09-02 12:31:37 +02:00
Joseph Chiocchi
a154389970
add charging state sensor for Apple Watch (#2945)
<!-- 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 -->

Following the thread at
https://github.com/home-assistant/iOS/discussions/1764#discussioncomment-10434403
, this is my novice attempt at adding
https://developer.apple.com/documentation/watchkit/wkinterfacedevicebatterystate
or the Watch Battery State, using #2897 as a reference.

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

I don't know how to take a screenshot of the sensor reporting through
the simulator, I can add them if pointed in the right direction.

## 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# 

> _I will look into this. I will look for the corresponding watch
battery change docs if they exist and extend them._

## 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. -->

This is a rough pass. I used #2897 as a launching point - I read it
carefully as this is my first ever code contribution for Swift / iOS,
WatchOS project but I think I had enough heuristics to manage to
_possibly_ get it in the vicinity of it being correct.

I also used `Sources/Shared/API/Webhook/Sensors/BatterySensor.swift` for
including an additional `Battery State` sensor, while exposing both
sensors similarly in name like it's another device.

I think it could still be improved by using
`Sources/Shared/API/Webhook/Sensors/BatterySensor.swift` as a reference.
I tried to change as little as possible.

I wasn't sure if I needed to add anything to
`Sources/App/WatchCommunicatorService.swift`, considering the commit in
#2897,
f961d689e5 (diff-daa127042af3bc5719e4eb4e02e3c50bfcef50084f554e53475f4a4238fdd096)


- I will lean heavily on comments and will iterate where requested, if
the changes aren't edited directly by the maintainers. @bgoncal
- I **do** think I ran the Unit Tests correctly and added to the one
that was also changed in #2897

---------

Co-authored-by: Bruno Pantaleão Gonçalves <5808343+bgoncal@users.noreply.github.com>
2024-08-29 01:09:51 +02: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
Bruno Pantaleão Gonçalves
dd0e080a30
Use entity category "diagnostic" for App Version (#2899) 2024-08-02 12:48:18 +02:00
Bruno Pantaleão Gonçalves
4fa6de6b11
Add Apple Watch battery sensor (#2897)
<!-- 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-02 11:32:24 +02:00
Bruno Pantaleão Gonçalves
7c05d32bfd
Add App version sensor (#2896)
<!-- 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-02 11:13:38 +02:00
Bruno Pantaleão Gonçalves
38c90c1912
Add location permission sensor (#2892)
<!-- 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 -->
So you can finally know if that family member is not having their phone
tracked correctly because of the current location permission settings
and messing up with automations :D

## 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-02 10:36:24 +02: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
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
Bruno Pantaleão Gonçalves
e8598d913c
Wrap CoreMediaIO inside macCatalyst condition (#2452)
Apparently `#if canImport(CoreMediaIO)` is now true even if you are
trying to run the App on iOS instead of macOS, so this PR wraps it also
under `#if targetEnvironment(macCatalyst)`
2023-11-16 10:01:15 +01:00
Zac West
64e97ce44b
Bump MaterialDesignIcons to 7.0.96 (#2160) 2022-07-24 14:37:03 -07: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
546125dc0d
Add Audio Output sensors, rename Microphone to Audio Input (#1978)
Fixes #1958.

## Summary
Existing Core Audio stuff already exposes the output devices pretty easily, so creating sensors from 'em is pretty easy.

## Sensor Values
Roughly identical to microphones:

| Sensor | Attributes | Description |
| --------- | --------- | ----------- |
| `sensor.active_audio_input` | `All`, `Active` | The name of the active audio input (microphone), or `Inactive` if not in use. |
| `sensor.active_audio_output` | `All`, `Active` | The name of the active audio output (speaker), or `Inactive` if not in use. |
| `binary_sensor.audio_input_in_use` | None | Whether an audio output (microphone) on the system is currently in use. |
| `binary_sensor.audio_output_in_use` | None | Whether an audio output (speaker) on the system is currently in use. |

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

## Any other notes
This updates relatively instantly for when output starts, but takes a few seconds before it updates once output pauses.

Existing `microphone` sensors won't have their unique IDs changed, but their display name will change. New installs will get the new unique ID.
2021-12-07 09:18:32 -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
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
8041b997b3
Only signal focus sensor updates in the foreground (#1859)
## Summary
Fixes unnecessarily doing a sensor update pass when launching in the background, as well as an occasional crash talking to UIApplication's applicationState off the main thread.

## 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. -->
2021-09-24 19:09:22 -07:00
Zac West
4a3007f0c2
Add live-updating to in-app display of focus sensor (#1845)
## Summary
Fires a sensor update pass if the app is running when the focus status changes.

## Any other notes
The focus sensor _always_ live-updates, but it does so in the Intents extension. This allows the Intents extension to inform the app that it did an update, which (unfortunately, for now) fires a sensor update pass in the app. So we're over-updating the sensors, but we're keeping the in-app sensor list updated. Worth the cost, I think, since the app running when focus changes happening feels rare unless the user's playing with the sensor.
2021-09-19 11:33:36 -07:00
Zac West
a8220f690e
Upgrade MaterialDesignIcons to 6.1.95 (#1844)
## Summary
- Upgrades the font, config, and adds a migration for renamed/removed icons.
- Migrates the one use of a renamed/removed one: `laptop-mac` -> `laptop`

## Any other notes
This change should also make it a little easier to do the migrations, since the Realm+Initialization part won't need to be touched, probably.
2021-09-19 10:36:57 -07:00
Zac West
293fae54cf
Fix focus sensor updating in iOS 15 RC (#1842)
## Summary
Fixes the insta-updating of the focus sensor on iOS 15.

## Any other notes
`INFocusStatusCenter.default.focusStatus` always returns isFocused=false in the extension, but the intent provides the correct focus status for each update -- so we need to cache this value in the extension, and not trust the focus center state.
2021-09-18 20:34:15 -07:00
Zac West
17fc1898f9
Fix crash updating active sensor idle time setting (#1803)
## Summary
Fixes a crash caused by infinitely recursing the value change.

## Any other notes
This also allows setting fractional minute values, every 15 seconds. The minimum timer which we check is 5 seconds, and that low means we won't detect changes if they occur in a 10 second period which feels too low.
2021-07-19 21:02:56 -07:00
Zac West
cd6fb39c6d
Add "Focus" sensor for iOS 15 & macOS 12 (#1664)
Refs #945. This will not be available until we switch to compiling builds with Xcode 13, regardless of when it is merged.

## Summary
Adds a "Focus" binary sensor which is on when focus is enabled. This updates live, even when the app isn't running, via Intents.

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

## Any other notes
Followup is needed for onboarding to prompt for this permission.
2021-06-18 12:45:09 -07:00
Zac West
90fa3ea022
Limit Sentry breadcrumbs to warning & reduce some logs (#1568)
* Limit Sentry breadcrumbs to warning level or above

* Reduce some logging
2021-04-03 11:56:11 -07:00
Zac West
da2574a3b5
Cache date formatter for frontmost app sensor (#1567)
Since we change the settings on the formatter, we end up paying initialization cost for each one, which adds up fast when command-tabbing.
2021-04-03 10:58:47 -07:00
Zac West
86b0b0a409
Allow disabling individual sensors (#1484)
Fixes #358.

## Summary
Allows toggling on or off certain sensors. This does not currently delete the sensor but instead sets its state to 'unavailable'.

## Screenshots
### App
![Image](https://user-images.githubusercontent.com/74188/107861269-bd96e800-6df9-11eb-93c4-682eab17b157.png)
![Image 2](https://user-images.githubusercontent.com/74188/107861298-d8695c80-6df9-11eb-9496-dc89cdc892c0.png)

### Frontend
<img width="334" alt="entities" src="https://user-images.githubusercontent.com/74188/107861381-5c234900-6dfa-11eb-86c5-27b7f6ea2c2e.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
- Sensors are still only showing up in the sensor list if they have been generated during the app lifecycle. So for example the Geocode sensor doesn't show up unless a location update happened, and motion sensors do not show up if motion permission is disabled.
- Avoids removing items from the cache when they aren't around anymore, or when we think they are stale.
2021-02-13 16:55:16 -08:00
Zac West
37e5080118
Fix an out-of-order sensor caching issue (#1477)
Fixes #1473.
Refs #1460/#1467.

## Summary
When an earlier request gets applied later than we expect, we also need to assume it has replaced values similar to the transient update case fixed before.

## Any other notes
I am going to keep telling myself that the long-term benefit of the sensor caching outweighs having to figure out all of these real-world edge cases the hard way. In this case, I already expected it, I just did not fully think through the ramifications of the edge case and how it would look from the server perspective.
2021-02-11 19:35:43 -08:00
Zac West
bcb307a7dd
Fix not updating sensors when prior update fails for transient value change (#1467)
Fixes #1460.

## Summary
Fixes our internal cache being out of sync with the sensor values on the server.

## Any other notes
This issue occurs when, for example, we transition from value1 -> value2 -> value1. If the value2 update fails from our perspective, but successfully hits the server, we may not realize that we need to send value1 up again in the future.
2021-02-06 18:04:29 -08:00
Zac West
640cca884b
Add SwiftFormat to project (#1463)
Adds new fastlane lanes:
- `fastlane lint` which checks the linters
- `fastlane autocorrect` which applies the linters which can autocorrect (Rubocop, SwiftFormat)

Adds a build step to the Codegen abstract target which runs SwiftFormat in lint mode, pointing out what it's going to change when run.

Applies SwiftFormat to nearly all code -- exempts a few externally-sourced files and generated code.
2021-02-05 22:06:25 -08:00
Zac West
30b388aa39
Make server version optional, fixing an alert issue (#1402)
Fixes #1397.

## Summary
Makes server version optional, returning nil when we don't know rather than a fallback version.

## Screenshots
n/a

## Link to pull request in Documentation repository
n/a

## Any other notes
Prevents an issue where we'd alert about the fallback version being old enough to have an alert, rather than the actual version which comes later. Amusingly the work I did to make sure that we'd handle app-launch-to-web-view events supporting an onboarding flow in the middle causes the alerts to be delayed until the webview loads after initial login.
2021-01-22 23:01:49 -08:00
Zac West
f1b7a691e3
Only send up the values for changed sensors when they change (#1381)
Replace #1013.

## Summary
Keeps track of what sensors we've sent up during the session and only pushes up changes.

## Screenshots
Just tabbing around between apps on Mac:

```
14:49:15.876 [Info] [main] [HAAPI.swift:824] UpdateSensors(trigger:location:) > updating sensors ["frontmost_app"]
14:49:16.561 [Info] [main] [HAAPI.swift:824] UpdateSensors(trigger:location:) > updating sensors ["frontmost_app"]
14:49:17.422 [Info] [main] [HAAPI.swift:824] UpdateSensors(trigger:location:) > updating sensors ["frontmost_app"]
14:49:30.550 [Info] [main] [HAAPI.swift:824] UpdateSensors(trigger:location:) > updating sensors ["frontmost_app"]
14:49:32.363 [Info] [main] [HAAPI.swift:824] UpdateSensors(trigger:location:) > updating sensors ["frontmost_app"]
```

## Link to pull request in Documentation repository
No user-facing changes.

## Any other notes
Unlike #1013, this does not persist the sensor values to disk. This is a place that can be improved, but there are some unanswered questions/complications with storing to disk (especially around migrations and cleaning up the values when upgrading and when hardware devices change and wrong values are shown) that could probably be solved a little cleaner in the future transparently to consumers of these types.
2021-01-17 16:32:22 -08:00
Zac West
9f2e04dcc2
Clean up Battery Level & Battery State sensor attributes/classes (#1372)
Fixes #1311.

## Summary
Removes duplicate attributes from both (so they do not refer to each other in attributes) and stops using `device_class` of `battery` on the state sensor.

## Screenshots
![Image](https://user-images.githubusercontent.com/74188/104554534-2d466700-55f1-11eb-8eff-2dcd55889ece.png)
![Image 2](https://user-images.githubusercontent.com/74188/104554635-549d3400-55f1-11eb-8642-4deba335d034.png)

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

## Any other notes
Also stops showing the non-user-facing-anywhere-else "unique id" in the sensor detail list, and fixes an empty set of attributes (but non-nil dictionary) showing an empty section.
2021-01-14 19:38:23 -08:00
Zac West
d06edc7cb7
Add sensor for frontmost app on Mac (#1352)
Fixes #977.

## Summary
Adds a sensor for the current frontmost app, also known as the current foreground or active app. 

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

## Any other notes
Creates `sensor.frontmost_app` which has a state of the name of the current frontmost app, or None if there isn't one. I'm really not sure how that can happen, but it's definitely possible. This updates via a signal when it changes, so it happens immediately.
2021-01-07 17:26:24 -08:00
Zac West
d0e5866f81
Add Connection Type sensor to Mac (#1351)
Fixes #1184.

## Summary
This is the same sensor as we send up on iOS except it now bounces between No Connection, Wi-Fi and Ethernet.

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

## Any other notes
- `sensor.connection_type` now has an `Ethernet` value and is set up on macOS.
- `sensor.connection_type` gains attributes on macOS: `Name` (the name of the network interface, e.g. `Wi-Fi`) and `Hardware Address` (the MAC address of the interface).
- Adds signaled updates to this (and other network) sensors.

Important to note that, although Ethernet is now added to Connection Type, the Wi-Fi sensors for SSID and BSSID will still report values if any Wi-Fi network device is connected, even if it is not the primary route.
2021-01-06 21:44:11 -08:00
Zac West
ed7e74d0b6
Add sensors for Mac displays (#1349)
Fixes #1247.

## Summary
Adds 3 sensors for displays: "Displays" (a count), "Primary Display Name" (the name of the display with the menu bar on it), and "Primary Display ID" (the ID of the primary).

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

## Any other notes
- `sensor.displays` 
  - states like `0`, `1`, `2`, …
  - attributes of `"Display IDs": ["id1", "id2", …]` and `"Display Names": ["name1", "name2", …]`
- `sensor.primary_display_name`
  - states like `"None"`, `"Built-in Retina Display"`, etc.
- `sensor.primary_display_id`
  - states like `"BE82E2E6-EA40-4963-93AD-A0BDC9D2F18F"`, `"1AB60A12-6BB3-4503-96BD-F5B481F5830E"` etc.
2021-01-06 09:42:28 -08:00
Zac West
556e8a4e54
Collapse microphones and cameras into singular sensors (#1320)
Breaking change. Fixes #1261.

Collapses all Camera and Microphone sensors from one-sensor-per-device to two camera and two microphone sensors:
- `binary_sensor.[device]_microphone_in_use` and `binary_sensor.[device]_camera_in_use` (value: true/false)
- `sensor.[device]_active_microphone` and `sensor.[device]_active_camera` (value: name or "Inactive")

This is unfortunately required because both the the `kCMIODevicePropertyDeviceUID`/`kAudioDevicePropertyDeviceUID` and the `kCMIOObjectPropertyName`/`kAudioObjectPropertyName` are not stable; the IDs change and names gain `#2`, `#3`, etc., suffixes. This is despite the documentation reading:

> A CMIODevice's UID is persistent across boots.

and

> An AudioDevice's UID is persistent across boots.

Were this the case, we wouldn't need to worry -- we unique on the device ID after all, and names can change over time were that part actually stable.
2020-12-31 19:10:56 -08:00
Zac West
9107c86521
Bump minimum target to iOS 12 (#1241) 2020-10-25 18:53:39 -07:00
Zac West
8427d32524
Fix crash in connectivity sensor on iOS 14.0 (and not 14.1+) (#1238)
The 5G connectivity defines are declared available in iOS 14.0+ but evaluate to nil or whatever on iOS 14.0.
2020-10-24 21:09:02 -07:00
Zac West
53598ef741
Add 5G to Connectivity Sensor (#1233)
Fixes #1232.
2020-10-24 11:33:15 -07:00
Zac West
4d9a530637
Reorganize files in repo, pull out build settings from pbxproj (#1140)
This is somewhat in prep of being able to make the project file generated, but also just organizes things into more concrete directory structures.

This pulls out _all_ of the build settings from the root level, and most from the target level, into xcconfigs.

The new directory structure looks like:

- Sources
  - App
    - (everything from HomeAssistant/)
  - WatchApp
  - Shared
  - MacBridge
  - Extensions
    - Intents
    - NotificationContent
    - NotificationService
    - Share
    - Today
    - Watch
    - Widgets
- Tests
  - App
  - UI
  - Shared

Somewhat intentionally, the file structure under these is not yet standardized/organized.

The project targets are now:

- App
- WatchApp
- Shared-iOS
- Shared-watchOS
- MacBridge
- Tests-App
- Tests-UI
- Tests-Shared
- Extension-Intents
- Extension-NotificationContent
- Extension-NotificationService
- Extension-Share
- Extension-Today
- Extension-Widget
- WatchExtension-Watch

This does not yet clean up resources vs. sources, nor does it handle some of the "it's in Sources/App but it's part of Shared" crossover directory issues.
2020-10-03 00:15:04 -07:00