# BPUP - Possible Enhancements to Source of Command / Action ("x")

**URL:** <https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103>\
**Category:** Integrations\
**Created:** [August 9, 2023, 2:15pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103 "2023-08-09T14:15:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![residualimages](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/residualimages/32/74_2.png) [@residualimages](https://forum.bondhome.io/u/residualimages)\
**Post date:** [August 9, 2023, 2:15pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103/1 "2023-08-09T14:15:23Z")

</div>

Since I find the Action history potentially useful for troubleshooting integrations, and because I understand it’s not feasible to have in the Bond app directly per the post below, I wonder if there is an opportunity to have a local network logger running for a Bond owner with just a couple tweaks to the current BPUP implementation?

> [@Bond Bridge Sending Unrequested Commands](https://forum.bondhome.io/t/bond-bridge-sending-unrequested-commands/4091/37):
>
> … actions history information is not available directly to end users. We did experiment with such a feature, but the monthly database costs skyrocketed and was not sustainable for a pay-once-use-forever product like Bond Bridge, so we had to pull it. — Perhaps a more efficient or more limited implementation could work, but it is not currently on roadmap

When I started thinking this morning of a local network logger a Bond owner could run, based on BPUP, I realized that it’s a little difficult to tell at a glance what is truly “Bond app” initiated vs what is Google (and presumably Alexa etc) initiated vs what is Local API direct call initiated – at least from what I’m seeing.

The Local API initiated feels a little more easily spotted, but I think there’s room for a slight update to what goes in the “x” part (source transport) of the BPUP notification.  
As in, if x = ‘http’ or ‘mqtt’, maybe it could specify which service was the source, if it came from a known “linked service” integration. If not from a linked service and not from the Bond app, then it is assumed to be the Local API directly called (and optionally could show from what IP address the API call was sent)?

Changes initiated in Bond App, an initial “x” of ‘bond’, followed immediately by an “x” of ‘bond’:

```auto
BPUP data payload received: (8/9/2023 8:57:01 AM)
	{"B":"ZPxxxxxxx","d":0,"v":"v3.15.5-beta","t":"devices/aabbccdd/state","i":"05000033ae51c1e0","f":100,"s":200,"m":0,"x":"bond","b":{"power":1,"light":0,"flame":1,"_":"d44ea720","__":"d44ea720"}}

BPUP data payload received: (8/9/2023 8:57:01 AM)
	{"B":"ZPxxxxxxx","d":0,"v":"v3.15.5-beta","t":"devices/00000000aabbccdd/actions/ToggleLight","i":"01000039826c505c","f":228,"s":200,"m":2,"x":"bond","b":{"argument":null,"no_tx":true,"_":"00000000","__":"00000000"}}

```

Changes initiated via local API from third party controller, an initial “x” of ‘bond’, followed immediately by an “x” of ‘http’:

```auto
BPUP data payload received: (8/9/2023 8:57:32 AM)
	{"B":"ZPxxxxxxx","d":0,"v":"v3.15.5-beta","t":"devices/aabbccdd/state","i":"0500009081f4656b","f":100,"s":200,"m":0,"x":"bond","b":{"power":1,"light":0,"flame":1,"_":"d44ea720","__":"d44ea720"}}

BPUP data payload received: (8/9/2023 8:57:32 AM)
	{"B":"ZPxxxxxxx","d":0,"v":"v3.15.5-beta","t":"devices/aabbccdd/actions/TurnLightOff","i":"06000067d5b5d2f0","f":132,"s":200,"m":2,"x":"http","b":{"_":"00000000","__":"00000000"}}

```

Changes initiated via Google Home app, an initial “x” of ‘bond’, followed immediately by an “x” of ‘mqtt’ (not sure if this would vary based on if a user has a Thread / Matter / Google Home Hub, as I do, vs someone that only uses Google Assistant on a phone):

```auto
BPUP data payload received: (8/9/2023 8:57:51 AM)
	{"B":"ZPxxxxxxx","d":0,"v":"v3.15.5-beta","t":"devices/aabbccdd/state","i":"05000099f2322a63","f":100,"s":200,"m":0,"x":"bond","b":{"power":1,"light":1,"flame":1,"_":"7a2636b1","__":"7a2636b1"}}

BPUP data payload received: (8/9/2023 8:57:51 AM)
	{"B":"ZPxxxxxxx","d":0,"v":"v3.15.5-beta","t":"devices/aabbccdd/actions/SetFlame","i":"0cbbf54ff3110053","f":132,"s":200,"m":2,"x":"mqtt","b":{"argument":100,"_":"00000000","__":"00000000"}}

```

---

<div class="post-metadata">

**Author:** ![merck](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/merck/32/1238_2.png) [@merck](https://forum.bondhome.io/u/merck)\
**Post date:** [August 9, 2023, 3:23pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103/2 "2023-08-09T15:23:47Z")

</div>

I hear you. Actually the source of the request is encoded into the first byte of the request ID. But indeed it would be nice to break it out into a separate “requestor” key with human-readable value.

---

<div class="post-metadata">

**Author:** ![residualimages](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/residualimages/32/74_2.png) [@residualimages](https://forum.bondhome.io/u/residualimages)\
**Post date:** [August 9, 2023, 4:29pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103/3 "2023-08-09T16:29:56Z")

</div>

> [@merck](#):
>
> the source of the request is encoded into the first byte of the request ID

Oh! Is this the mapping currently?

**Bond App** :

```auto
"i":"01..."

```

or

```auto
"i":"05..."

```

**Local API** :

```auto
"i":"06..."

```

**Google Home and/or Assistant** :

```auto
"i":"0c..."

```

---

<div class="post-metadata">

**Author:** ![endy](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/endy/32/1275_2.png) [@endy](https://forum.bondhome.io/u/endy)\
**Post date:** [August 17, 2023, 1:08pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103/4 "2023-08-17T13:08:12Z")

</div>

Hey @residualimages  
That’s correct! Since I work on the iOS app, I can confirm to you that the iOS is `02`.  
Also, may be worth mentioning that 3rd party integrations should use values above `A0` - being `A0` for Home Assistant.

---

<div class="post-metadata">

**Author:** ![residualimages](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/residualimages/32/74_2.png) [@residualimages](https://forum.bondhome.io/u/residualimages)\
**Post date:** [August 17, 2023, 1:42pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103/5 "2023-08-17T13:42:29Z")

</div>

Okay, cool!  
So 01 might be the Bond Android app?  
02 is the Bond iOS app.  
Wonder what the 05 is? 🧐

> [@endy](#):
>
> 3rd party integrations should use values above `A0` - being `A0` for Home Assistant

Endy is there a way when sending an API command to specify this ‘source transport’, in order to be compliant with that recommendation?  
Or does an incoming command’s source have to be recognized / determined by the Bridge software, and then it simply enumerates the known sources back out as the ‘x’ / source transport?

---

<div class="post-metadata">

**Author:** ![endy](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/endy/32/1275_2.png) [@endy](https://forum.bondhome.io/u/endy)\
**Post date:** [August 21, 2023, 2:39pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103/6 "2023-08-21T14:39:54Z")

</div>

I confirmed that 01 is Android app, and 05 is from the Bond (like the reply), does it make sense to you? 😄

You specify the `source transport` in the first byte on the randomly generated request ID.

---

<div class="post-metadata">

**Author:** ![residualimages](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/residualimages/32/74_2.png) [@residualimages](https://forum.bondhome.io/u/residualimages)\
**Post date:** [August 21, 2023, 9:52pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103/7 "2023-08-21T21:52:08Z")

</div>

> [@endy](#):
>
> You specify the `source transport` in the first byte on the randomly generated request ID

Sorry to keep being a pest. Is that [Request ID](http://docs-local.appbond.com/#section/API-Concepts/Request-ID) something that is only sent via mqtt clients?  
I tried with a normal http call and a Header of Request-ID, RequestID, X, I and maybe a few others, but no dice; all the calls just say `"x":"http"`.

Or is this supposed to be part of the [BOND-Flags](http://docs-local.appbond.com/#section/API-Concepts/Request-Flags) Header?

Specifically asking since most of my integrations use http, but I could see how occasionally it might be useful to denote which integrations are calling which http requests.

---

<div class="post-metadata">

**Author:** ![merck](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/merck/32/1238_2.png) [@merck](https://forum.bondhome.io/u/merck)\
**Post date:** [August 24, 2023, 1:49pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103/8 "2023-08-24T13:49:36Z")

</div>

There’s three things going on.

The request ID (`BOND-UUID` header) is a 64-bit ID with some structure to it. The first byte (the most-significant byte) indicates **Requestor Class** , such as `iOS App` or `Control4`. — But this approach is prone to collisions and misimplementations, and requires registration, so we need a better way for the community.

The `x` field on MQTT/BPUP indicates the **Source Transport** , such as `http` or `mqtt` or `bpup`.

Note that these are different concepts. For example, the iOS app may use any transport to communicate.

`BOND-Flags` does not contain any information about the requestor.

What about `Bond-Client-Name` and `Bond-Client-Version` headers where the integration author can put a string identifying the integration? Example:

`Bond-Integration-Name: home-assistant`  
`Bond-Integration-Version: 3.2.1`

This would be entirely uncontrolled, just for info purposes…

---

<div class="post-metadata">

**Author:** ![residualimages](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/residualimages/32/74_2.png) [@residualimages](https://forum.bondhome.io/u/residualimages)\
**Post date:** [August 24, 2023, 2:05pm UTC](https://forum.bondhome.io/t/bpup-possible-enhancements-to-source-of-command-action-x/4103/9 "2023-08-24T14:05:46Z")

</div>

Sorry I was getting a bit muddled on what comes from where.

It’s not a high priority, just would be useful for troubleshooting / auditing occasionally.  
But I like the sound of your brainstorm option.
