Support switches and services in mobile_app integration

The mobile_app integration can currently expose sensors, but not switches, or services other than notifications in general.

Being able to control things in that direction would unlock many features requested in the iOS/macOS app, like locking the screen, preventing sleep, turning dark mode on and off.

So the mobile app does support “services”, but not in the traditional sense. You can see the full list here: https://companion.home-assistant.io/docs/notifications/notification-commands

Certainly if the commands you mentioned are possible on the Android/iOS device (I know system settings are often unable to be changed by apps), then a willing developer could add them to that growing list.

However, I do like the idea of wrapping these up into service calls. Making the user send a notification with custom bits of information is quite clunky and not very user-friendly.

1 Like

The ‘iOS’ name is misleading because the app also runs on macOS, on which many of the system settings can be changed by apps.

So keep in mind the reason why the notification commands exist as a notification is because that is really the only way for HA to communicate to the app. At least on android we do not have websocket support so we rely on notifications to send data over.

Any service call you want created will also need to have “custom bits of information” so whether the service call is a notify service call or a custom service call the expected data is not going to change. Its still going to look “clunky” because we still need the data. So I don’t think switching it from one service call to another makes any difference there. The data is still required to do things with it, just the naming convention is different. How else can you expect to start an activity or tell it to turn on a screen without the additional data?

If you want to clean it up for the time being you can create a switch template. I know that doesnt sound ideal but keep in mind that anytime a change requires someting from HA core then it becomes a 2 step process in the apps. By keeping the logic in the app you get a faster turnaround for features. Android for example beta builds get generated after each and every commit. Now imagine how long you have to wait for something to show up in HA core, then to get released then for the mobile apps to support it.

I like the idea of making things simpler but if the expected data is not going to change then whats the difference between a notification service call and a custom service call that still requires the same data. Not to mention a switch that depends on a state can be delayed if the state is not going to be push based, so it can look out of sync. Not all sensors and states are pushed based on android.