Intent broadcast change

For some time now I’ve been using the intent command to set my alarm on my phone. In the previous update that has apparently been changed and now it only sends me a message if the intent instead of doing the command.

What is the change that I need to make?

service: notify.mobile_app_mobile
data:
  message: command_activity
  data:
    tag: android.intent.action.SET_ALARM
    group: >-
      android.intent.extra.alarm.HOUR:{{ (state_attr('sensor.google_alarm',
      'getReady').split(':')[0]) }},android.intent.extra.alarm.MINUTES:{{
              (state_attr('sensor.google_alarm', 'getReady').split(':')[1]) }},android.intent.extra.alarm.MESSAGE:Get Ready,android.intent.extra.alarm.RINGTONE:Roller Disco,android.intent.extra.alarm.SKIP_UI:true

Beta version I assume? This is the PR you should read:

I assume there will be a larger announcement with guidance when these changes move to stable. But the PR spells it out for now.

1 Like

yup we will have a blog post for this once a stable release is cut but the docs have also been updated to include examples of the latest beta changes.

Yes I am using the beta version; OK, so I gave it a shot and it didn’t seem to work. Can you please advise me on where I went wrong?:

service: notify.mobile_app_nathaniel_mobile
data:
  message: command_broadcast_intent
  data:
    intent_action: android.intent.action.SET_ALARM
    intent_package_name: android.intent.extra.alarm
    intent_extras: >-
      HOUR:{{ (state_attr('sensor.google_alarm','getReady').split(':')[0]) }},
      MINUTES:{{ (state_attr('sensor.google_alarm', 'getReady').split(':')[1]) }},
      MESSAGE:Get Ready,
      RINGTONE:Roller Disco,
      SKIP_UI:true

This seems to stop it from sending a message as a text message now, but it doesn’t seem to actually add the alarm like it used to.

The remove intent works without any issue (if I add the alarm manually), but adding the alarm doesn’t seem to appear (the important part)

Well you changed it. You had this:

According to the PR I linked here’s how the old fields mapped to the new ones for the activity notification command:

change channel to intent_package_name
change tag to intent_action
change title to intent_uri
change subject to intent_type
change group to intent_extras

So all you had to do was replace tag with intent_action and group with intent_extras. Instead you seem to have changed a bunch of other stuff. In particular you seem to have dropped the prefixes off the params in the intent extras which is probably the main reason it broke. But really all you had to do was change the fields, nothing else.

Not part of the topic per se…

but what is the command to remove the alarm without needing to accept the command via the UI?

And where does someone find the info generally on how to construct the command activities, broadcast intents etc that can be used with the mobile app?

there is no native intent to do that, its up to each app to provide its own services there. Sleep as android has a custom intent to enable/disable an alarm by its label but not remove it.

Every app is going to be different, the companion docs offer some live examples of Sleep as Android and Googles own apps. You’ll find links to the corresponding docs there too, outside of that its best to contact the app developer or look up their docs to see if they support it.

There is a thread that lists all the apps taht we have found to offer some type of example but largely if its not mentioned in the forums/docs you’ll need to do a bit of trial and error to get the command right. Its a bit of an advanced topic as some commands will require more trial and error than others, especially if you need to use a manifest reader to try and guess how things work.

1 Like