Bond integration with Home Assistant

Greetings.

I understand that controlling dimming is not possible, as the light value is stateless. It will only understand a constant increase or decrease until a stop signal is sent.

Would it be possible to understand how to get this capability added to have the opportunity to have a light output choice between a fully dim or fully bright state?

Thanks,
James

What device are you controlling? (Let us know the FCC ID from the back of the remote control).

Most of the ceiling fans have a single “hold-to-dim” button, which we call CycleBrightness. It doesn’t even have separate IncreaseBrightness and DecreaseBrightness signals, just one CycleBrightness signal. This means that we cannot even achieve what you request, to be able to get 100% or 1% light output.

If there were a ceiling fan with discrete IncreaseBrightness / DecreaseBrightness signals and known course time from 1–>100% and 100–>1%, then yes in theory we could give you a SetBrightness action and a slider in the app. But sadly this was not foreseen by the designers of non-smart r/c cf controls.

[EDIT]: BTW, welcome! Thanks for coming by the forums. We love getting questions and suggestions from new users, so keep it coming :slight_smile:

Merck,

Thank you for the welcome. Here is the info you requested: FCC ID: CHQ7225T

We originally purchased this fan from Home Depot years ago, if only for the features. I was initially frustrated that no wall control existed, but still appreciated the energy savings. ;).

Recently we discovered that the old fan was bond compatible, and purchased a second one. Integration into Home Assistant was great, because at least we could turn on the light (always set at dim) on at sunset. Anytime a brighter light is required, the remote (or Bond app) is nearby.

There are actually 3 buttons that control the light. They are on/off, increase brightness, and decrease brightness.

Thanks again,
James

Ok, thanks. Indeed this is one of the very few with discrete Inc/Dec brightness signals.

So, you could script something on your integration to send a “StartIncreasingBrightness” action or “StartDecreasingBrightness” action to the device. This would transmit a long sequence of holding + or - buttons on the remote, and would be interrupted by the next command sent to the bridge after a 2 sec delay.

It would be theoretically possible to do the dead-reckoning I described above, but we don’t have enough of these remotes in the field to justify it TBH.

That is great news. I got the hang of using a script. I use one to replicate a sequence of turning on and turning off other lights in a very specific time sequence.

That said… I understand the principal, but am lost on the target or syntax. For example, in this yaml below, I am unclear where this would go.

sequence:

  • type: turn_on
    device_id: 5c30a614b48dadc0c02a9eaa9330a483
    entity_id: light.tornado
    domain: light
  • type: startincreasingbrightness
    device_id: 5c30a614b48dadc0c02a9eaa9330a483
    entity_id: light.tornado
    domain: light
    mode: single
    alias: test dimming up

If I try to insert a type: starting teasing tightness, it throws a syntax error, because it isn’t a recognized option.

:frowning:

Ok… Stepping into my uncomfort zone… I started down the rabbit hole of the documentation found at docs-local.appbond.com

I was able to use a win10 laptop to send curl commands to baby step turning the light on then off as well as performing dimming changes. Since the available actions do not include a light value, then the proposed solution of setting a time value between commands would be the “adjustment”.

Is this along the path you were thinking the solution would be found?

James

Ok, solution identified. Using CURL commands, I was able to produce the results I wanted.

With Home Assistant, the configuration.yaml is modified to include your new Shell Commands. After reloading the configuration, there are services available that can be used in scripts (or automation).

So… I spoke too soon. I was able to correctly identify the correct commands for StartIncreasingBrightness, StartDecreasingBrightness, and Stop. I can verify that StartIncreasingBightness and Stop work as intended, as well as other commands. When I call the StartDecreasingBrightness command, I get:

HTTP/1.1 400 Bad Request
Content-Length: 54
Content-Type: application/json; charset=utf-8

{"_error_id":61,"_error_msg":“action not supported”}

It looks like this command was broken in firmware v2.20.12 (or at least I assume, as I just had a firmware upgrade available a couple of days ago.

@merck just following up with partial success and and specific error using Curl commands

1 Like

@Jpfamily : I’m glad you have been able to get as far as you have so far - it is so encouraging to see other “stubborn” people in the community documenting their process and successes / challenges on here. :grinning:

Were you able to get a “mere mortal” version of this working for Home Assistant? :neutral_face:
Have tried everything but stand on my head and spit nickels to try and get the light “turn_on” service with brightness, brightness_pct & all the other variations and all I can get is the light to toggle on and off. Really frustrated at this point. I don’t think Bond is reporting the state back to HA and I don’t know what the issue is with dimming.
Does anyone else know or have a solution to get light dimming?

tk,
There are a lot of variables at play here. Let me start by saying that in Home Assistant, I could see both entities of the ceiling fan. I could set different speeds on the fan and also change the direction of flow. For the light, I could only see it on or off. My first suspicion was that there could be an update to the Bond integration, but that is not the issue. Bond replies back with what “states” report back from the fan. If brightness is not a valid state, then it is unaware of the setting.

This opens up the problem of coding for a value that you don’t know what you are starting with or ending with. My fan can only see the command to increase brightness, stop brightness change, and decrease brightness. The work around concept is using known values of time to approximate the results that you want. For example, if you want to make sure that your light is dim… it is possible that it may have been turned off while brighter than the lowest setting. The fan light will turn on to the last value, but Bond doesn’t know what it was. To ensure lowest dim, you could command the light to turn on, then follow up with a dim for a duration of time to ensure the lowest value.

Ok, that was a little background to the problem. Here is the cliff notes. I tested out commands individually on my windows laptop until I got the results that I wanted. Once I knew the command, I needed to put it into home assistant as a service. I have 2 ceiling fans, so I needed 6 separate services added to my configuration.yaml.

Here is a reddit link where I documented what I did.
Bond integration for functions not readily available (like light dimming) : homeassistant (reddit.com)

I hope this answers your question. You are correct, your light may not be reporting the state. If you want to confirm, here is the command that I ran. Note that my token will be redacted and the device ID will be redacted as well. you can see the response only includes light:0, because it is off. If turned on, it will be 1.

curl -H “BOND-Token: 5d8eXXXXXXXXc570” -i http://192.168.1.47/v2/devices/4XXXXXX9/state

HTTP/1.1 200 OK
Content-Length: 62
Content-Type: application/json; charset=utf-8

{“power”:1,“speed”:1,“direction”:1,“light”:0,"_":“8d3d411c”}

1 Like

Home Assistant doesn’t have support for increase or decrease dimming in the light entity model Light Entity | Home Assistant Developer Docs. Something like this would have to be implemented as a bond specific service in the bond integration.

bdraco,

Correct. It would be a tremendous ask of the home assistant bond integration devs to keep and maintain a separate list of models that have dimming with the different methods of dimming that Bond is aware of and how to perform that method appropriately. I applaud their efforts with the current product.

I am happy with the work around, and with the recent release of a certain scene controller switch, am looking forward to being able to have a physical switch in an expected location near the entryway, and have it be able to duplicate all fundamental remote control operations.

Is Home Assistant currently using the commands API or the actions API?

The actions API is highly recommended, because then they don’t need to worry about whether the device internally supports increase/decrease signals or setbrightness signals, they just use TurnLightOn/Off and SetBrightness. (However, Bond Bridge doesn’t always know how to provide a SetBrightness action for some devices, even if they have dimming-related signals.)

from the source code:

from bond_api import Action, BPUPSubscriptions, DeviceType

but the rub is the state, as defined:

def _apply_state(self, state: dict) → None:
self._attr_is_on = state.get(“light”) == 1
brightness = state.get(“brightness”)
self._attr_brightness = round(brightness * 255 / 100) if brightness else None

as confirmed, if my device does not support the state of “brightness”, which it does not, then additional work would have to be done to shim this request in and wreck havoc on other users that have non-diming lights.

Right. And that extra work should ideally happen on the Bond side. The Bridge is in the best position to know the details of how the device works.

The lack of a SetBrightness/brightness is basically the Bridge is saying “I don’t really know how to control brightness on this device, YMMV”. We just have the Inc/Dec Brightness commands so that the app can replicate the functionality of the remote.

Question: Is this a manually recorded device? Or does it use a template? If so, what template?

For template devices, we could probably add SetBrightness action / brightness state for this device. — For manually recorded devices, we’d have to add some kind of course_time property to know how long of a transmission corresponds to what change in % brightness. Possible, but requires some refactoring on our end to handle this kind of thing cleanly.

It’s a template, it uses FCC ID: CHQ7225T

It has 3 buttons for the light control: increase brightness, toggle light, and decrease brightness. I’ve read the forum on dimming controls. I understand the difficulty in accommodating devices that do not report “brightness” state value.

I believe you are the one that helped me with the argument on the StartDecreasingBrightness command. I called it good as soon as I could reliably issue commands and get wanted results.

Actions: bond-api/action.py at master · prystupa/bond-api · GitHub

It should be a relatively small PR to add a bond.start_increasing_brightness and bond.start_decreasing_brightness to Home Assistant using Entity services in the light platform: core/light.py at dev · home-assistant/core · GitHub

The constants are already available here:

Would there need to be a stop brightness as well? On the Bond app, once you press increase brightness (dim up), the button changes to a stop. You have to issue a second command to stop increasing or decreasing brightness.