# HomeSeer Integration questions

**URL:** <https://forum.bondhome.io/t/homeseer-integration-questions/1237>\
**Category:** Integrations\
**Created:** [January 21, 2020, 1:20pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237 "2020-01-21T13:20:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 21, 2020, 1:20pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/1 "2020-01-21T13:20:45Z")

</div>

Hey Chris @merck. I have now some questions about implementing actions in my HS plugin.

Main problem for me is that the plugin should work with any device supported by BB and SBB. And I guess there’s a lot. And they all have different functionality. So the plugin should be generic enough to support them all.

Currently I do get the list of actions for the device and create control buttons fro each action. Which should work for actions without arguments (Open/Close etc.)

So my questions are:

1. Is it possible to get a list of required arguments for each action? Is it available via API? Or do you have a document?

2. How do I get the confirmation after I execute the action (in generic manner)? I know that I use `/v2/devices/{device_id}/state` - but which field do I use? Same questions - Is it available via API? Or do you have a document?

3. Similar to above, do you have a list of `state` replies for all possible devices? SO I can display the state info in HS?

Thank you.

[EDIT] How is it done in other Integrations?

---

<div class="post-metadata">

**Author:** ![jacob](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/jacob/32/312_2.png) [@jacob](https://forum.bondhome.io/u/jacob)\
**Post date:** [January 21, 2020, 3:21pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/2 "2020-01-21T15:21:12Z")

</div>

Docs are hosted here: [http://docs-local.appbond.com/](http://docs-local.appbond.com/)

The information about relationships between actions, arguments, and state is in the [Feature subsection](http://docs-local.appbond.com/#section/Features)

A side note: we just open-sourced the API docs, so if anyone has any language they’d like clarified, please open an issue here: [GitHub - bondhome/api-v2: Bond V2 API Documentation](https://github.com/bondhome/api-v2)

> [@alexbk66](#):
>
> How do I get the confirmation after I execute the action (in generic manner)?

Seeing a 204 response should be good enough. If you want to get the state of the device though, you can request the device’s [state endpoint](http://docs-local.appbond.com/#tag/Device-State). If you’d prefer the state to be pushed to you, and you can listen for UDP packets, you could use [BPUP](http://docs-local.appbond.com/#section/Bond-Push-UDP-Protocol-(BPUP)).

> [@alexbk66](#):
>
> How is it done in other Integrations?

For our own integrations (Alexa, Google Home, SmartThings. All cloud-to-cloud.) we send the action request, check for 204, then wait for state to be pushed to our backend, at which point we forward the state on.

I think a lot of the local integrations are polling for state in a loop.

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 21, 2020, 3:39pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/3 "2020-01-21T15:39:35Z")

</div>

Thank you @jacob.  
Actually, are you saying that **all possible actions** (and their arguments) are listed in the [Feature subsection](http://docs-local.appbond.com/#section/Features)?

It’s good. But would be better to have an API function for getting argument info for given action. Much better for future extension.

---

<div class="post-metadata">

**Author:** ![jacob](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/jacob/32/312_2.png) [@jacob](https://forum.bondhome.io/u/jacob)\
**Post date:** [January 21, 2020, 3:43pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/4 "2020-01-21T15:43:12Z")

</div>

> [@alexbk66](#):
>
> It’s good. But would be better to have an API function for getting argument info for given action. Much better for future extension.

Interesting, hadn’t thought of that. For now, GET `actions/<action_name>` is unused. Perhaps if we populated that with a type and accepted input, that’d make the API a bit more “discoverable”?

The type would be easy, I’d just need to think if there’s a straightforward way to convey accepted inputs for all possible actions in JSON. I’m open to suggestions.

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 21, 2020, 3:52pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/5 "2020-01-21T15:52:08Z")

</div>

> [@jacob](#):
>
> Perhaps if we populated that with a type and accepted input, that’d make the API a bit more “discoverable”?
> 
> The type would be easy, I’d just need to think if there’s a straightforward way to convey accepted inputs for all possible actions in JSON. I’m open to suggestions.

Would be really great!

One suggestion - as a quick/temporary fix - just return a string from the docs, i.e. `{"description": "(integer) 1 = forward, -1 = reverse"}`

Later can extend it.

[EDIT] or `{"type": "integer, "vals":{"1":"forward", "-1":"reverse"}}`

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 22, 2020, 6:42am UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/6 "2020-01-22T06:42:12Z")

</div>

Another question. User reported that his fan has 6 speeds (in the app), but the API returns “SetSpeed”, “IncreaseSpeed”, “DecreaseSpeed”. So it looks like the app artificially creates 6 buttons, but internally it uses “SetSpeed”?

Is it possible to get the app button setup to duplicate it in HomeSeer? How do I know that I need to create 6 buttons for Speed? Most fans have only three speeds.

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 22, 2020, 7:47am UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/7 "2020-01-22T07:47:21Z")

</div>

I think I found it - “max\_speed” property?

---

<div class="post-metadata">

**Author:** ![jacob](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/jacob/32/312_2.png) [@jacob](https://forum.bondhome.io/u/jacob)\
**Post date:** [January 22, 2020, 2:04pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/8 "2020-01-22T14:04:55Z")

</div>

> [@alexbk66](#):
>
> I think I found it - “max\_speed” property?

Yes, that’s right

> [@alexbk66](#):
>
> Another question. User reported that his fan has 6 speeds (in the app), but the API returns “SetSpeed”, “IncreaseSpeed”, “DecreaseSpeed”. So it looks like the app artificially creates 6 buttons, but internally it uses “SetSpeed”?

The buttons are “commands”, which are documented [here](http://docs-local.appbond.com/#tag/Device-Commands). The [Actions API](http://docs-local.appbond.com/#tag/Device-Actions) is built from the list of commands, simplifying it for use by integrations.

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 22, 2020, 2:21pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/9 "2020-01-22T14:21:11Z")

</div>

So “command” is a shortcut for “action” and includes arguments?  
API provides function to get the command, but I don’t see how I can execute the command. Or can I?

---

<div class="post-metadata">

**Author:** ![jacob](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/jacob/32/312_2.png) [@jacob](https://forum.bondhome.io/u/jacob)\
**Post date:** [January 22, 2020, 2:31pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/10 "2020-01-22T14:31:30Z")

</div>

> [@alexbk66](#):
>
> So “command” is a shortcut for “action” and includes arguments?

I’d say “Action” is more a shortcut for “Command”. For example, the user records 6 speed buttons, which create 6 commands. If we didn’t have the Actions API, an integration would have to 1) find out the list of command IDs 2) request each one in turn and 3) store in memory this table of available commands.

Additionally, this table would potentially have to be rebuilt pretty often, say if a user later recorded a “Speed 7” button.

The Actions API just takes care of this for you. It collapses available commands into available actions, so you can get all you need in one request. ([GET device](http://docs-local.appbond.com/#tag/Devices/paths/~1v2~1devices~1%7Bdevice_id%7D/get) has an array of actions, looks like the docs are wrong! They show just a sub-endpoint hash)

> [@alexbk66](#):
>
> API provides function to get the command, but I don’t see how I can execute the command. Or can I?

Yes, with [PUT command/x/signal/tx](http://docs-local.appbond.com/#tag/Device-Command-Transmit/paths/~1v2~1devices~1%7Bdevice_id%7D~1commands~1%7Bcommand_id%7D~1tx/put)

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 22, 2020, 2:39pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/11 "2020-01-22T14:39:55Z")

</div>

> [@jacob](#):
>
> I’d say “Action” is more a shortcut for “Command”. For example, the user records 6 speed buttons, which create 6 commands. If we didn’t have the Actions API, an integration would have to 1) find out the list of command IDs 2) request each one in turn and 3) store in memory this table of available commands.
> 
> Additionally, this table would potentially have to be rebuilt pretty often, say if a user later recorded a “Speed 7” button.
> 
> The Actions API just takes care of this for you. It collapses available commands into available actions, so you can get all you need in one request. ([GET device](http://docs-local.appbond.com/#tag/Devices/paths/~1v2~1devices~1%7Bdevice_id%7D/get) has an array of actions, looks like the docs are wrong! They show just a sub-endpoint hash)

Confused (may be because it’s 1:35 am)  
So. The user says he has 6 buttond for speeds (pic. 1).  
In my code I get the list of available actions (pic .2).  
So the action is “SetSpeed” and I guess it takes argument from 1 to 6.  
So “Speed 1” _command_ is the shortcut for SetSpeed(1) _action_?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/bond1/original/1X/9f88e19c64fed2a6e94b6960e5f806b335197a27.jpeg)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/bond1/original/1X/075a2cbccc10b726f0afefec5f89125e5cb0f369.jpeg)

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 22, 2020, 2:50pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/12 "2020-01-22T14:50:00Z")

</div>

Ok @jacob, I’m reading the docs. RTFM!

> Actions represent a user’s intent, but do not nessisarly map one-to-one onto the commands that are sent to a device.

> Bond Bridges operate by translating actions into “commands”. While actions are in a user’s language, commands are in the device’s remote control’s language.

---

<div class="post-metadata">

**Author:** ![jacob](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/jacob/32/312_2.png) [@jacob](https://forum.bondhome.io/u/jacob)\
**Post date:** [January 22, 2020, 3:21pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/13 "2020-01-22T15:21:28Z")

</div>

> [@alexbk66](#):
>
> So “Speed 1” _command_ is the shortcut for SetSpeed(1) _action_ ?

Yes, but I hesitate to call it a shortcut because you’d have to request the whole table of commands to find the action/argument you’re looking for. You then have to store the dictionary of IDs and action/argument pairs, which may be invalidated by the user recording a new command or deleting a command.

In the above case, calling the SetSpeed action with argument 1 ([PUT device/\<dev\_id\>/actions/SetSpeed {“argument”: 1}](http://docs-local.appbond.com/#tag/Device-Actions/paths/~1v2~1devices~1%7Bdevice_id%7D~1actions~1%7Baction_id%7D/put)) just transmits the signal associated with the “Speed 1” command. The same thing happens when you directly tx the command’s signal ([PUT device/\<dev\_id\>/commands/\<command\_id\>/signal/tx](http://docs-local.appbond.com/#tag/Device-Command-Transmit)),

Our mobile apps use the Commands API (they use the individual commands to build the panel), but our Google Home, Alexa, and SmartThings integrations use the Actions API (they just need to be aware of available actions). I’d suggest anyone building their own integration to use the Actions API as well, because it requires much fewer GETs to find out what you need to know about a device.

---

<div class="post-metadata">

**Author:** ![jacob](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/jacob/32/312_2.png) [@jacob](https://forum.bondhome.io/u/jacob)\
**Post date:** [January 22, 2020, 3:27pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/14 "2020-01-22T15:27:03Z")

</div>

Another advantage to Actions:

The user’s device has a power off Command, as well as 6 speed Commands. There’s no power on Command.

But the user does have a TurnOn _Action_. This action uses one of the speed commands (that of the last-seen speed) to turn the fan on. So, by using the Actions API you don’t need to think about this relationship between SetSpeed and PowerOff.

---

<div class="post-metadata">

**Author:** ![jacob](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/jacob/32/312_2.png) [@jacob](https://forum.bondhome.io/u/jacob)\
**Post date:** [January 22, 2020, 6:30pm UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/15 "2020-01-22T18:30:54Z")

</div>

One more reason 🙂

The user has a ToggleLight Command (just named “Light”). When the user presses this button, it will always transmit the toggle signal, just like the remote.

We expose two Actions: TurnLightOn and TurnLightOff. And we allow users to customize what happens when an unexpected action comes in. Say the Bond Bridge thinks the light is off, but the user asks it to “TurnLightOff” (and, again, we can only toggle the light). There’s two potentially correct behaviors:

1. The Bond is wrong about the light being off, it’s on and the Bond should send the signal, turning it off.
2. The light is really off but the user may not be around to see that it’s off, or the user is, for example, wanting to turn off all lights in their home. In this case, the Bond should ignore the action and do nothing.

The way we handle these two possible behaviors is with the `trust_state` property, documented [here](http://localhost:8080/#tag/Device-Properties). Situation 1) is the behavior with a disabled `trust_state` (the default). Situation 2) is the behavior with an enabled `trust_state`. The commands API doesn’t take these kinds of things into consideration.

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 23, 2020, 1:33am UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/16 "2020-01-23T01:33:02Z")

</div>

Now I seem to have better understanding.  
So actions are convenience wrappers for commands.  
Still I don’t get - if I call SetSpeed(5) - and there’s no corresponding command?

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 23, 2020, 1:36am UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/17 "2020-01-23T01:36:23Z")

</div>

> [@jacob](#):
>
> I’d suggest anyone building their own integration to use the Actions API

Just to confirm - I can do without Commands API, just use Actions?

---

<div class="post-metadata">

**Author:** ![jacob](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.bondhome.io/jacob/32/312_2.png) [@jacob](https://forum.bondhome.io/u/jacob)\
**Post date:** [January 23, 2020, 2:00am UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/18 "2020-01-23T02:00:55Z")

</div>

> [@alexbk66](#):
>
> Still I don’t get - if I call SetSpeed(5) - and there’s no corresponding command?

You’ll get a response with a status of 400 (Bad Request) with an error message in the body describing the error, in this case it’s something like “invalid argument”. EDIT: actually, for this one, if the argument is above `max_speed` it gets set to `max_speed`.

> [@alexbk66](#):
>
> So actions are convenience wrappers for commands.

Yes, that’s a good way to think of it.

> [@alexbk66](#):
>
> Just to confirm - I can do without Commands API, just use Actions?

Yes, definitely.

---

<div class="post-metadata">

**Author:** ![alexbk66](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@alexbk66](https://forum.bondhome.io/u/alexbk66)\
**Post date:** [January 23, 2020, 2:02am UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/19 "2020-01-23T02:02:36Z")

</div>

Great, thank you @jacob

---

<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:** [January 23, 2020, 8:26am UTC](https://forum.bondhome.io/t/homeseer-integration-questions/1237/20 "2020-01-23T08:26:40Z")

</div>

> [@alexbk66](#):
>
> Just to confirm - I can do without Commands API, just use Actions?

In fact, if you base your driver on the Commands API, your driver will not work with the SBB devices. The Actions API is the higher level portable API.

[Next page](https://forum.bondhome.io/t/homeseer-integration-questions/1237.md?page=2)
