ahh, but i thought it was in a call
If the phone that is in a call gets a TTS message then I believe it will be picked up by the microphone and sent to the other end
Ah ok, cool ,
Hi,
The call command still not working after the new app update.
make sure to grant the phone permissions when prompted, thats a requirement
Go to Configuration > Companion App > Logs and look at the error that shows up with that message. Also please share the YAML used. Its also possible you may need to deny and regrant the phone permission because we added an additional phone permission so android may not show that. The error message in the log will tell us exactly what the problem is so we can investigate further.
Hi @dshokouhi here is the log from the app:
03-17 12:26:07.960 28304 28433 D LogcatReader: Done reading logcat for pid 28304
03-17 12:26:12.727 28304 28435 D WebSocketRepository: Websocket: onMessage (text)
03-17 12:26:12.727 28304 28435 D WebSocketRepository: Message number 555 received: {"id":555,"type":"event","event":{"message":"command_activity","title":"tel:66558865","data":{"channel":"com.google.android.dialer","tag":"android.intent.action.CALL"},"hass_confirm_id":"4c02a25db75b5679010b0eab0e4d49aa"}}
03-17 12:26:12.731 28304 31744 D WebSocketRepository: Sending message 560: {type=mobile_app/push_notification_confirm, webhook_id=d95431239a4ec6470cf057261b7d2776ad661ce7391504a3f35a59012bf05715, confirm_id=4c02a25db75b5679010b0eab0e4d49aa, id=560}
03-17 12:26:12.731 28304 31744 D WebSocketRepository: Message number 560 sent
03-17 12:26:12.904 28304 28435 D WebSocketRepository: Websocket: onMessage (text)
03-17 12:26:12.904 28304 28435 D WebSocketRepository: Message number 560 received: {"id":560,"type":"result","success":true,"result":null}
03-17 12:26:12.911 28304 28433 D MessagingService: Processing device command
03-17 12:26:12.915 28304 28433 E MessagingService: Unable to send activity intent please check command format
03-17 12:26:12.915 28304 28433 E MessagingService: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxx flg=0x10000000 pkg=com.google.android.dialer }
03-17 12:26:12.915 28304 28433 E MessagingService: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2087)
03-17 12:26:12.915 28304 28433 E MessagingService: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1747)
03-17 12:26:12.915 28304 28433 E MessagingService: at android.app.ContextImpl.startActivity(ContextImpl.java:1095)
03-17 12:26:12.915 28304 28433 E MessagingService: at android.app.ContextImpl.startActivity(ContextImpl.java:1066)
03-17 12:26:12.915 28304 28433 E MessagingService: at android.content.ContextWrapper.startActivity(ContextWrapper.java:421)
03-17 12:26:12.915 28304 28433 E MessagingService: at io.homeassistant.companion.android.notifications.MessagingManager.processActivityCommand(MessagingManager.kt:1676)
03-17 12:26:12.915 28304 28433 E MessagingService: at io.homeassistant.companion.android.notifications.MessagingManager.handleDeviceCommands(MessagingManager.kt:671)
03-17 12:26:12.915 28304 28433 E MessagingService: at io.homeassistant.companion.android.notifications.MessagingManager.handleMessage(MessagingManager.kt:362)
03-17 12:26:12.915 28304 28433 E MessagingService: at io.homeassistant.companion.android.websocket.WebsocketManager$collectNotifications$2.emit(WebsocketManager.kt:165)
03-17 12:26:12.915 28304 28433 E MessagingService: at io.homeassistant.companion.android.websocket.WebsocketManager$collectNotifications$2$emit$1.invokeSuspend(Unknown Source:15)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
03-17 12:26:12.915 28304 28433 E MessagingService: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
03-17 12:26:12.917 28304 28304 D CompatibilityChangeReporter: Compat change id reported: 147798919; UID 10431; state: ENABLED
03-17 12:26:15.324 28304 28433 D LogcatReader: Read logcat for pid 28304
here is the yaml file I’m using:
alias: Dial a phone when roof door is open
description: ''
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: MAKE A CALL
condition:
- type: is_open
condition: device
device_id: 929a561c45ecb09cd145e163227021ae
entity_id: binary_sensor.roof_door_contact
domain: binary_sensor
action:
- service: notify.mobile_app_mousa_phone
data:
message: command_activity
data:
channel: com.google.android.dialer
tag: android.intent.action.CALL
title: tel:66558865
mode: single
I did deny the permission then re enable it again but that didn’t help.
It doesn’t work for me either.
Using:
service: notify.mobile_app_andreas
data:
message: command_activity
data:
channel: com.google.android.dialer
tag: android.intent.action.CALL
title: "tel:[my phone number]"
First time I got promoted to add permissions.
I disabled permission then enabled.
Logs:
03-17 10:49:22.260 8957 9035 D WebSocketRepository: Message number 1 received: {"id":1,"type":"event","event":{"message":"command_activity","title":"tel:[my phone number]","data":{"channel":"com.google.android.dialer","tag":"android.intent.action.CALL"},"hass_confirm_id":"b9da94f1828780a8b0fd8a21d3f0b38e"}}
03-17 10:49:22.262 8957 8992 D WebSocketRepository: Sending message 6: {type=mobile_app/push_notification_confirm, webhook_id=38e6f1b9fa1829358eb74227919073078aaff034b7f2a7fa16be6930c1a709cf, confirm_id=b9da94f1828780a8b0fd8a21d3f0b38e, id=6}
03-17 10:49:22.263 8957 8992 D WebSocketRepository: Message number 6 sent
03-17 10:49:22.318 8957 9035 D WebSocketRepository: Websocket: onMessage (text)
03-17 10:49:22.319 8957 9035 D WebSocketRepository: Message number 6 received: {"id":6,"type":"result","success":true,"result":null}
03-17 10:49:22.321 8957 8991 D MessagingService: Processing device command
03-17 10:49:22.323 8957 8991 E MessagingService: Unable to send activity intent please check command format
03-17 10:49:22.323 8957 8991 E MessagingService: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxxxx flg=0x10000000 pkg=com.google.android.dialer }
03-17 10:49:22.323 8957 8991 E MessagingService: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2067)
03-17 10:49:22.323 8957 8991 E MessagingService: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1727)
03-17 10:49:22.323 8957 8991 E MessagingService: at android.app.ContextImpl.startActivity(ContextImpl.java:1028)
03-17 10:49:22.323 8957 8991 E MessagingService: at android.app.ContextImpl.startActivity(ContextImpl.java:999)
03-17 10:49:22.323 8957 8991 E MessagingService: at android.content.ContextWrapper.startActivity(ContextWrapper.java:403)
03-17 10:49:22.323 8957 8991 E MessagingService: at io.homeassistant.companion.android.notifications.MessagingManager.processActivityCommand(MessagingManager.kt:1676)
03-17 10:49:22.323 8957 8991 E MessagingService: at io.homeassistant.companion.android.notifications.MessagingManager.handleDeviceCommands(MessagingManager.kt:671)
03-17 10:49:22.323 8957 8991 E MessagingService: at io.homeassistant.companion.android.notifications.MessagingManager.handleMessage(MessagingManager.kt:362)
03-17 10:49:22.323 8957 8991 E MessagingService: at io.homeassistant.companion.android.websocket.WebsocketManager$collectNotifications$2.emit(WebsocketManager.kt:165)
03-17 10:49:22.323 8957 8991 E MessagingService: at io.homeassistant.companion.android.websocket.WebsocketManager$collectNotifications$2$emit$1.invokeSuspend(Unknown Source:15)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
03-17 10:49:22.323 8957 8991 E MessagingService: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Where [my phone number]
is a phone number with plus country code and so on.
Note that the line where it says :
No Activity found to handle Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxxxx flg=0x10000000 pkg=com.google.android.dialer }
Is not me masking the phone number.
Not sure if that is a clue.
@Hellis81 and @mousawm what happens when you remove channel
? When I have the channel defined I do see the same error but when I remove it the phone knows what to do.
service: notify.mobile_app_dannys_pixel_6_pro
data:
message: command_activity
data:
intent_action: android.intent.action.CALL
intent_uri: "tel:4444"
Without channel it works! Thanks!
So what happens when you define a channel
is that the app sends the intent to the app assuming it has everything it needs. Sometimes we don’t have all the precise data needed so when you remove the channel
you let android decide how to process the intent. If you notice in my screenshot, Android noticed that I had 2 apps that could handle the intent. Defining the channel
will skip this step however, if the intent is not considered complete it fails. So here its best that we follow the provided example from Google and remove the package from the intent. Also notice how the icon in the screenshot is slightly different from the actual dialer app, the background and phone colors are swapped.
Hello,
thanks for this very instructive thread ! I read a lot and succeeded in launching the spotify app with an intent (just to verify I can make it work )
I made a script starting an activity from Harmony Hub integration and starting with wakeonlan my HTPC, I’d like this script to send an intent to my phone to show the harmony app on the specific activity screen
I downloaded APK Analyzer to access Harmony App manifest, here is the result : https://pastebin.com/9KyfFgcR
I saw the parts with intent-filter and tried things like
-
channel: com.logitech.harmonyhub.ui.SplashActivity / tag: android.intent.action.MAIN (without title)
-
channel: com.logitech.harmonyhub / tag: android.intent.action.VIEW / title : harmony:
but it’s not working, I’m probably missing out the logic with these intents
Any help would be welcome to help me understand
P.S : I could probably make this work with the Roku Emulator launching the wakeOnLan when launching an activity from the smartphone, but I’d like to learn more about Android intents
I dont see anything in here that will launch a specific harmony activity screen. The first intent you see is just for the splash screen the second intent you are probably not using correctly but none of us can you tell you the correct way to do it. Its up to the app developers to document that. If the companion app had an error then the companion app logs may help tell what hte error is.
Unfortunately without the developers telling us what the intents expect its all trial and error.
One thing you can try to do is access the activity screen using the notification from the harmony app and then look at logcat to see if any intents show up. You’ll basically need to reproduce the behavior using their app and then inspecting the logs using an app like LogCat Reader.
Thanks for your help. Companion app logs did not give me something useful and adb logcat got me lost in too much verbosity !
I finally went the Roku Emulator way allowing me to do my automation also with the Harmony Remote
Hi All, I’m hoping there a eufy security user in here with the know-how to work out an app intent to link directly to a camera stream.
I started out be reaching to eufy to ask if they could help but they declined.
I have used logcat to capture what happens when I follow a motion detected notification directly to a stream, there were a few line items that looked helpful, such as these
07-19 15:55:58.838 1692 4465 W ActivityTaskManager: startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { flg=0x4000000 cmp=com.oceanwing.battery.cam/com.eufy.security.doorbell.video.ui.VDBLiveVideoActivity (has extras) }
07-19 15:37:40.431 1692 2283 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.oceanwing.battery.cam/.main.SplashActivity bnds=[622,1379][821,1600]} from uid 10236
07-19 15:35:16.083 1692 4817 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.oceanwing.battery.cam cmp=com.oceanwing.battery.cam/.main.SplashActivity} from uid 10041
07-19 15:35:18.076 1692 4445 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.oceanwing.battery.cam/.main.SplashActivity bnds=[622,1379][821,1600]} from uid 10236
I’m not sure what the has extras
refers too.
I was able to build an intent URL using the examples here and here but could only acheive launching the app, not going directly to the stream.
My skills with logcat are pretty basic, it took me a while to figure out how to filter to the eufy app even, so there’s a big chance I’ve missed something. Appreciate any help!
Hi everybody,
I control spotify player through “command_activity” and “command_media”, since i use an old android phone as a controller for music and other stuff. It works nice, and now i would like to make shortcuts to my playlists.
I have tried with this script, and then command_media play. It opens the playlist i command, but then restart the song which was already playing, instead of play a random song of the selected playlist.
Any idea how to make it work properly?
Thanks in advance
- service: notify.mobile_app_nokia
data:
message: command_activity
title: spotify:playlist:2ztVKTR3JN97nPf1jz99lI
data:
channel: com.spotify.music
tag: android.intent.action.VIEW
It really depends on what the app supports, it may not be possible. Also this format is not going to work once the app updates to 2022.8, new format is listed in the documentation.
https://companion.home-assistant.io/docs/notifications/notification-commands#activity
See the example and table to see what has changed as a lot of the commands had updates.
I managed to toggle phone flashlight by using Broadcast Intent and the first app that I was able to find on the F-Droid store that supports flashlight toggle intent (I guess you could use official GooglePlay store but F-Droid allows you to navigate and investigate source code much more easier).
To make long story short:
- Install F-Droid
- Install Torch
- To toggle flash you should send notification broadcast-intent:
service: notify.mobile_app_<your_device_id_here>
data:
message: command_broadcast_intent
data:
intent_package_name: com.doomy.torch
intent_action: com.doomy.torch.TOGGLE_FLASHLIGHT