Skip to content

Commit

Permalink
Added documentation intent extras (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzgloeckl authored Jan 30, 2022
1 parent 37578f6 commit d7709f4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/notifications/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,37 @@ automation:
group: "EXTRA_CONFIG_JSON:%7B%22push%22%3A%7B%22set%22%3A%7B%22widgetCustom0._.config.upper_text%22%3A%22Hi%22%7D%7D%7D:urlencoded"
```

<span class='beta'>BETA</span> Similarly to using urlencoding, you can add specific types to your intent extra. Your values will then be converted according to the type you specified. Make sure the type conversion is possible/meaningful.

Currently supported types are:

- Integer `EXTRA:101:int`
- Double `EXTRA:10.1:double`
- Float `EXTRA:10.1:float`
- Long `EXTRA:101:long`
- Short `EXTRA:1:short`
- Boolean `EXTRA:true:boolean`
- Char `EXTRA:a:char`
- ArrayList<Integer\> `EXTRA:1;2;3:ArrayList<Integer>`
- ArrayList<String\> `EXTRA:a;b;c:ArrayList<String>`

If you do not specify a specific type, the type is guessed based on your input. Numbers will be converted to Integers, `true` or `false` will be converted to Boolean values. Otherwise the intent extra will be set as String.

```yaml
automation:
- alias: Send broadcast intent with ArrayList<Integer> extra
trigger:
...
action:
- service: notify.mobile_app_<your_device_id_here>
data:
message: "command_broadcast_intent"
title: "sample.intent.SAMPLE"
data:
channel: "sample"
group: "EXTRA:1;2;3:ArrayList<Integer>"
```

## Do Not Disturb

![Android](/assets/android.svg) &nbsp;Android 6+ only
Expand Down

0 comments on commit d7709f4

Please sign in to comment.