How to debug HomeKit bridge?

Hi, i’m noob on HA so sorry in advance.
I’m having some issues with a slider that works right on HA but not on HomeKit bridge. How can i see what is doing?

Thanks a lot.

Hi Boniata,

So I am a bit confused, sorry for my Confusion, but HASS doesn’t actually refer to any specific thing in current use that I know of within Home Assistant.

First a note to remember for the future. As a new Home Assistant person you probably wouldn’t know this. The term HASS means hate in German, so the Home Assistant Project has not used that anywhere a customer will see it for 4 or 5 years. There are some internal code references that have not been converted yet and that gets fixed as things are edited. Some custom components have not caught up to that yet.

If you can tell us a little more what you want to do and what integrations/themes/custom integrations you are using, that would help. It seems to have something to do with a dashboard, but I’m not sure after that.

How to help us help you - or How to ask a good question.

Sorry for my confusion, I’ve seen the term on some forums and my HomeKit bridge has that name in the Home app.

I have changed the original post to eliminate it.

I’m really new to HA and I appreciate your explanation and your help, as you know some people on the forums are not nice to noob people.

I would try to explain my problem better: I have a ceiling fan that works right on HA, this fan have a slider to change the speed and it send different commands to the fan.
When I use it on the home app, the percentage doesn’t change the first time on HA, so the command I send is wrong.
So I’d like to see what the HomeKit bridge is doing and why it’s not working properly.

Thanks

That is a much nicer explanation that should get you some help. However I have basically no knowledge of the homekit inner working, having only 1 device, an AC unit, and I set the temp, turn that on and off via HA and that’s it.

I have a good feeling someone with the knowledge will come about and help you.

1 Like

That is something many in our community are working on. If you run into any issues to the opposite. let me now I will pass it on.

2 Likes

What ceiling fan do you have integrated into HA? If it’s a standard Fan entity then HomeKit should absolutely work with it properly, I have five HA fans running perfectly in HomeKit currently.

As for debugging it, there is no HomeKit debugger that is easy for me to instruct you how to use, as it would require quite a bit of fooling around to use. But, HA should properly reflect it, so if it’s not then something is wrong. Also remember that many fans don’t support percentages and will convert to Low, Medium and High, perhaps this is where the confusion is happening.

That is unacceptable behavior on this forum, feel free to DM any one of us that have “Regular” titles or to any mod or admin to be addressed. You can also flag their comment as inappropriate. There is very little tolerance here for toxicity from members.

1 Like

I have a BroadLink sending RF commands to the fan. The fan has 5 speed presets but I use a slider with 5 speed percentages (20-40-60-80-100%). I did it this way because I mostly use it on home app.
The on/off works right on HomeKit but when I use the slider (eg 40%) on HA doesn’t change until I change the slider again on home app, and then HA take the last value (40%) not the actual.

I’m using the fan template and maybe something is wrong in my code, that’s why I wanted to know what is HomeKit bridge doing.

Thanks for your help.

Go to your integrations page in HA. You can enable debug logging or download a diagnostic file for every integration. It might not be easy to decipher, but if you post the output here we can have a look (I cannot promise though). Otherwise, with good info like that you can log an issue against the HA core repo. Let’s first have a look here, though.

This is likely the root cause, post the code for your fan template.

Sure,

configuration.yalm

# Keep track of the fan state
input_boolean:
  juno_fan_state:

# Keep track of fan speed
input_number:
  juno_fan_percentage:
    name: Juno Fan Percentage
    min: 0
    max: 100




fan:
  - platform: template
    fans:
      juno_fan:
        friendly_name: "Juno Fan"
        unique_id: juno_fan
        value_template: "{{ states('input_boolean.juno_fan_state') }}"
        percentage_template: "{{ states('input_number.juno_fan_percentage') }}"
        turn_on:
          service: script.juno_fan_on
        turn_off:
          service: script.juno_fan_off
        set_percentage:
          service: script.juno_fan_set_speed
          data:
            percentage: "{{ percentage }}"
        speed_count: 5
script: !include scripts.yaml

And the scripts

juno_fan_on:
  alias: juno_fan_on
  sequence:
  - service: remote.send_command
    data:
      command: 'b64: sgB0AwoXChgKGAoLFxcLFwsKFwsXFwsXChgKCxcLFgsXCxcKGAoYChgKGBcKCxcXCgsXFwoLFxcLCxcKFwoYChgKGAoYAAElCxcKGAoYCgsXFwoYCgsXChgXChgKFwsLFwoXCxcKGAoYChgKFwsXFwsKFxcLChcYCgsXFwoLFwoXCxcLFwsXChgAASULFgsXCxcLCxYYChcLCxYLFxcLFwsXCwoXCxcLFwoYChgKGAoYChgWCwoYFgsLFxcKCxcXCgsXCxcLFwoXCxcLFwABJQsXCxcKGAoLFxcKGAoLFwoYFwoYChcLChgKFwsXCxcLFwsXCxcLFxcKCxcXCgsXFwoLFxcLChgKFwsXChgKGAoYAAEkCxcLFwsXCgsXFwoYCgsXCxcXChgKFwsLFwoXCxcLGAoXCxcLFwsXFwoLFxcKCxcXCgsXFwsKFwsXChgKGAoYChgAASQLFwsXChgKCxcXCxcKCxcKGBcKFwsXCwoYChgKGAoXCxcKGAoXCxcYCgsXFwoLFxcKCxcXCgsXCxcKGAoYChgKFwABJQsWCxcLFwsLFhgKFwsKGAoXFwsXCxcLChcLFwsXCxcKGAoXCxcLFxcLChcXCwoXFwsKFxcLChgKFwsXCxcKGAoYAAEkCxcLFwsXCgsXFwoYCgsXCxcXChgKGAoKGAoYChcLFwsXChgKGAoYFgsKGBYLChgWCwsXFwoLFwoYChcLFwsXCxcAASQMFgsXCxcLChcXCxcKCxcLFxcLFwoYCgsXChgKGAoYChcLFwsXCxcXCgsXFwoLFxcKCxcXCwoXCxcLFwoXCxcLFwABJQsXChcLFwsKGBYLFwsLFgsXFwsXCxcKCxcLFwoYChgKFwsXCxcLFxcLChcXCwoXFwsKFxcLCxYLFwsXCxcKGAoYAAEkCxcKGAoYCgoYFwoXCwsWCxcYChcLFwsKFwsXCxcKGAoYChgKFwsXFwsKFxcKCxgWCwoYFgsLFgsXCxcLFwoYChgAASQLFwoYChgKCxcXChgKCxcKGBcKFwsXCwoXCxcLFwsXChcLFwsYChcXCwoXFwsKFxcLChgWCwoXCxgKFwsXCxcKFwABJQwWCxcKGAoLFxcKFwsLFwoXGAoXCxcLChcLFwoYChcLFwsXChgKGBYLCxcWCwsXFwoLFxcKCxcLFwoXCxcLFwoXAAXcAAAAAA=='
      device: Broadlink
    target:
      device_id: 0c7a6d7d85bc03ebdfeff305b5794861
      entity_id: remote.broadlink
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.juno_fan_state
    data: {}
  mode: single
juno_fan_off:
  alias: juno_fan_off
  sequence:
  - service: remote.send_command
    data:
      command: 'b64: sgB0AwoXChgKGAoLFxcLFwsKFwsXFwsXChgKCxcLFgsXCxcKGAoYChgKGBcKCxcXCgsXFwoLFxcL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sXFwoLFxcKCxcLFwoXCxcLFwoXAAXcAAAAAA=='
    target:
      device_id: 0c7a6d7d85bc03ebdfeff305b5794861
      entity_id: remote.broadlink
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.juno_fan_state
    data: {}
  mode: single
juno_fan_set_speed:
  alias: juno_fan_set_speed
  sequence:
  - service: input_number.set_value
    target:
      entity_id: input_number.juno_fan_percentage
    data:
      value: '{{ percentage }}'
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - choose:
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '0.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgB0AwoXChgKGAoLFxcLFwsKFwsXFwsXChgKCxcLFgsXCxcKGAoYChgKGBcKCxcXCgsXFwoLFxcLCxcKFwoYChgKGAoYAAElCxcKGAoYCgsXFwoYCgsXChgXChgKFwsLFwoXCxcKGAoYChgKFwsXFwsKFxcLChcYCgsXFwoLFwoXCxcLFwsXChgAASULFgsXCxcLCxYYChcLCxYLFxcLFwsXCwoXCxcLFwoYChgKGAoYChgWCwoYFgsLFxcKCxcXCgsXCxcLFwoXCxcLFwABJQsXCxcKGAoLFxcKGAoLFwoYFwoYChcLChgKFwsXCxcLFwsXCxcLFxcKCxcXCgsXFwoLFxcLChgKFwsXChgKGAoYAAEkCxcLFwsXCgsXFwoYCgsXCxcXChgKFwsLFwoXCxcLGAoXCxcLFwsXFwoLFxcKCxcXCgsXFwsKFwsXChgKGAoYChgAASQLFwsXChgKCxcXCxcKCxcKGBcKFwsXCwoYChgKGAoXCxcKGAoXCxcYCgsXFwoLFxcKCxcXCgsXCxcKGAoYChgKFwABJQsWCxcLFwsLFhgKFwsKGAoXFwsXCxcLChcLFwsXCxcKGAoXCxcLFxcLChcXCwoXFwsKFxcLChgKFwsXCxcKGAoYAAEkCxcLFwsXCgsXFwoYCgsXCxcXChgKGAoKGAoYChcLFwsXChgKGAoYFgsKGBYLChgWCwsXFwoLFwoYChcLFwsXCxcAASQMFgsXCxcLChcXCxcKCxcLFxcLFwoYCgsXChgKGAoYChcLFwsXCxcXCgsXFwoLFxcKCxcXCwoXCxcLFwoXCxcLFwABJQsXChcLFwsKGBYLFwsLFgsXFwsXCxcKCxcLFwoYChgKFwsXCxcLFxcLChcXCwoXFwsKFxcLCxYLFwsXCxcKGAoYAAEkCxcKGAoYCgoYFwoXCwsWCxcYChcLFwsKFwsXCxcKGAoYChgKFwsXFwsKFxcKCxgWCwoYFgsLFgsXCxcLFwoYChgAASQLFwoYChgKCxcXChgKCxcKGBcKFwsXCwoXCxcLFwsXChcLFwsYChcXCwoXFwsKFxcLChgWCwoXCxgKFwsXCxcKFwABJQwWCxcKGAoLFxcKFwsLFwoXGAoXCxcLChcLFwoYChcLFwsXChgKGBYLCxcWCwsXFwoLFxcKCxcLFwoXCxcLFwoXAAXcAAAAAA=='
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '20.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgAwAwoXChgKFwsXCxcLChcXCxcLFwsXCxcLChcLFwsXCxcLFwoYChgKFxcLChgWCwsXFwsKFxcLChcLFwoYChgKFwsXAAElCxcLFwsXChgKGAoLFxcKGAsXChcLFwsLFgsXCxcLGAoXCxcKGAsXFwoLFxcLChcXCwoXFwsKGAoXChgKGAoYChgAASQLFwsXCxcLFwoYCgsXFwoYChcLFwsXCwoXCxcLFwsXCxcKGAoYChgWCwsXFwsKFxcKCxcXCwoXCxcLFwsXChgKGAABJAsXCxcLFwoYCxcKCxcXCxcKGAoYChgKChgKGAoYChcLFwsXChgKGBcKCxcXCgsXFwoLFxcLChcLFwsXCxcLFwsXAAEkCxcLFwoYChgKGAoLFxcLFwoYChgKFwsLFwoXCxcLFwsXChgKGAoYFgsLFhgKCxcXCgsXFwsKFwsXChgKGAoYChcAASULFwsXChgKGAoXCwsWGAoXCxcLFwsXCgsXCxcLFwoYChgKGAoXCxcXCwoXFwsLFhgKChgXCgsXChcLFwsXCxcLFwABJAwXChcLFwsXCxcLChcXCxcLFwoYChgKCxcLFwoXCxcLFwsXCxcLFxcKCxcXCgsXFwsKFxcLChcLFwsXCxcLFwoYAAEkCxcLFwoYChgKFwsLFxcLFwoXCxcLFwsKFwsXCxcLFwsXChgKFwsXFwsLFhcLChgWCwsXFwsKFwsXCxcKFwsXCxcAASULFwsWCxcLFwsXCwoXFwsXCxcLFwoXCwsXChgKGAoXCxgKFwsXCxcXCgsXFwoLFxcKCxcXCwoXCxcLFwsXCxcKGAABJAsXCxcLFwoYChcLCxcXCxYLFwsXCxcLChcLFwsXChgKGAoYChcLFxcLChcXCwoXFwsKGBcKCxcKGAoYChgKFwsXAAEkDBcKFwsXCxcKGAoLFxcLFwoYChcLFwsKGAoYChgKFwsXCxcLFwoYFgsLFxcKChgXCgsXFwsKFwoYChgLFwoYChgAASQLFwsXChgKGAoXCwoYFgsYChcLFwsXCwoXCxcLFwoYChcLFwsXCxcXCwoXFwoLFxcLChcYCgoYChcKGAoYChgKFwAF3AAAAAAAAAAA'
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '40.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgGEAwoKGAoXCxcLFwoYChgAASQMFgsXCxcLFwsXCxYLFwsLFxcLFwoYCgoYChgKGAoYChgKGAoXCxcXCwoXFwsKFxgKChgWCwsXCxcLFwoXCxcLFwABJQsXCxcKGAoYCxYLGAoXCwoYFgsXCxgKChgKGAoXChgLFwoYChgKGBcKChgWCwsXFwsKFxcLChgKFwsXChgKGAoYAAElCxcKFwsXCxcLFwsXCxcKCxcXCxcKGAoLFwsXChgKGAoXCxcLGAoXFwsKFxcLChcXCwoYFwoLFwoYChgKFwsXCxgAASMMFwsXCxcKGAoXCxcLFwsKFxcLFwsXCwoXCxgKFwoYChgLFwoYChgWCwoXFwsLFxcLCRgXCwoXCxcLFwoYChgKFwABJQsXCxcLFwsXChgKFwsYCgsXFgwXChcLChcLGAoXCxcLFwsXChgKGBcKCxcXCgsXFwsKGBcKChgKGAoXCxcLFwoYAAEkDBcKFwsXCxcLFwoYChgKCxcXCxcLFgsLFwoYChgKGAkYCxcLFwsXFwsKFxcLChcXCwoXFwwJGAoYChgKFwoYCxcAASQLGAsWCxcLFwsXCxcLFwsJGBcLFwsXCgoYCxcKGAoYChgKFwsXCxcXCwoYFgsKGBYLCxcXCgsXCxcKGAoXCxcKGAABJAwWCxgKGAoXCxcLFwsXCwoXFwsXCxcKCxcLFwsXChgKGAoYChgJGBcLChgWCwoYFwoLFxcKCxcLFwoYChgKFwsYAAEkCxcLFgsXCxgKFwsXCxcLChcXCxcLFwsKGAoYCRgLFwoYChcLGAoYFgsKFxgKChgXCwoXFwoLFwsXCxcKFwsYChgAASQLFwsXChgKFwwWCxcLFwsKGBcKFwsXCwoXCxcLGAoXChgLFwoYChgXCgoYFwoLFxcKCxcXCwoXCxcLFwoYChgKGAABJAsXCxcLFwsXChgKFwsXCwsWGAoXCxcLChgKFwsXCxcKGAsXChgKGBcKChgWCwsXFwsKFxcLChcLGAoXCxcKGAoYAAEkCxcLFwsXCxcLFwoYChcLCxcXCxcKFwsLFwoYChgKGAoXCxcKGAoYFwoLFxcLChcWDAoYFgsKGAoYCRgLFwsXCxcAASULFgsXCxcLFwsXChgLFgsLFxcKGAoXCwsXChgLFwoYCRgLFwsXCxcXCwoXFwsKFxgKChgXCgsYCRcLFwoYChgKFwAF3AAAAAA='
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '60.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgGEAwoLFwoYChgKG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cLFwsXCxcAASULChcYCgoYFgsXCwsXFwsKFxcKGAoYCgsXCxYLFwsXCxcKGAoYChgXCgsWGAoLFxcKCxcXCwoXCxYLFwsXCxcLFwAF3AAAAAA='
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '80.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgB4AgsKGBYLCxcKFwsXCxcLFwoYAAEkDBYLCxcXCxcLFwoYChcLFwsXCxcLFwsKFwsXChgKFwsXCxcLFwsXFwoLFxcLChgWCwoXFwsKGAsWCxcLFwoYChgAASQMFgsKGBcKFwsXCxcLFwsXCxcKGAsXCgsXChcLFwsXCxcLFwoYChgXCgoYFwsKFxcLChcXCwoYChcLFwoYChgKFwABJQwWCwoYFwoXCxcLFwsXCxcKGAoYChgKCxcKFwsXCxcLFwsXChgKGBYLCxcXCgsXFwsKFxcLChgKFwsXChgKFwsXAAElDBYLChgXChcLFwsXCxcLFwoYChcLGAoLFwoXChgKGAoYChcLGAoXFwsKFxcLChgXCgsXFwsKFwoYChgKGAoXCxcAASUMFgsKGBYLFwsXCxcKFwsXCxgKFwsXCwoYChcKGAoYChgKFwsXCxcXCwoXFwsKGBYLChgWCwsXCxYLFwsXCxcLFwABJQsWCwsXFwsXChgKFwsXCxcLFwsXCxcLChcLFwoYChgKGAkYChgKGBcLChcXCwoYFgsKGBYMCRgKFwoYChgKGAoYAAEkDBYLCxcXCxYLFwsXCxcLFwsXCxcLFwoLFwsXChgJGAoYChgKGAoYFgsLFxcLChcXCwoXFwsKGAoXChgKGAoXCxgAASQMFgsKGBYLFwsXCxcLFwsXCxcLFgsXCwoYChcLFwoYChgKGAoXCxcXCwoYFgsLFxcLChcXCwoXCxcKGAoYChgJGAABJQsXCwoXFwsXCxcLFwsXChcLFwsXCxcLChgKGAoXCxcLFwoYChgKGBYLChgWCwsXFwsKGBYLChcLFwoYChgKGAoXAAXc'
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '100.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgB2AhcXCwoXCxcKGAoXCxcLFwABJQsXCwoYFgsXCxcLFwsXCxcKFwsXCxcLCxcKFwoYChgKGAoYChgKFxcLChgWCwsXFwsJGBcLChgJGAoXCxcLFwsXAAElCxcLChgWCxcLFwsXCxYLFwsXCxcLFwsKGAoXChgKGAoYChcLGAoXFwsKFxcLChcXCwoYFgsLFwoXCxcLFwsXCxcAASQMFgsLFxcLFwoYChcLFwsXCxcLFwsXCwoYCRgKFwsXCxcLFwoYChgXCgsXFwoLFxcLChcXCwoYChcLFwoYChgKGAABJAwWCwoYFwsWCxcLFwsXCxcLFwsXCxcLCRgKFwsXCxcKGAoYChgKGBYLChgXCgsXFwsKFxcLChgKFwoYChgKFwsXAAElDBYKCxcXCxcLFwsXCxcKFwsXCxcLFwsKGAoXChgKGAoXCxcLFwsXFwsKFxcLChgWCwsXFgsLFwoXCxcLFwsXCxcAASQMFgsLFxcLFwoXCxcLFwsXCxcLFwsXCwoXChcLFwsYCRgKGAoYChgXCgoYFwsKGBYLChgWCwoYChcKGAoYChgKGAABJAwWCwoYFgsXCxcLFwsXCxcKGAoXCxcLChgKFwoYChgKGAoYChgKFxcLChgWCwoYFwoLFxcKCxcKGAoXCxcLFwsXAAElCxcLChcXCxcLFwoXCxcLFwsXCxcLFwoLGAkYChgKFwsYCRgKGAoYFwoLFxcLChcXCwoYFgsKGAoXCxcKGAoYChgAASQLFwsKGBYLFwsXCxcLFwsXCxYLGAsXCgoYChgKGAoYChcKGAoYCxcXCwoXFwsKFxcLChgWCwoYChcLFwoYChgKGAAF3AAA'
    default: []
  mode: single
juno_fan_set_speed_2:
  alias: juno_fan_set_speed_2
  sequence:
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - choose:
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '0.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgB0AwoXChgKGAoLFxcLFwsKFwsXFwsXChgKCxcLFgsXCxcKGAoYChgKGBcKCxcXCgsXFwoLFxcLCxcKFwoYChgKGAoYAAElCxcKGAoYCgsXFwoYCgsXChgXChgKFwsLFwoXCxcKGAoYChgKFwsXFwsKFxcLChcYCgsXFwoLFwoXCxcLFwsXChgAASULFgsXCxcLCxYYChcLCxYLFxcLFwsXCwoXCxcLFwoYChgKGAoYChgWCwoYFgsLFxcKCxcXCgsXCxcLFwoXCxcLFwABJQsXCxcKGAoLFxcKGAoLFwoYFwoYChcLChgKFwsXCxcLFwsXCxcLFxcKCxcXCgsXFwoLFxcLChgKFwsXChgKGAoYAAEkCxcLFwsXCgsXFwoYCgsXCxcXChgKFwsLFwoXCxcLGAoXCxcLFwsXFwoLFxcKCxcXCgsXFwsKFwsXChgKGAoYChgAASQLFwsXChgKCxcXCxcKCxcKGBcKFwsXCwoYChgKGAoXCxcKGAoXCxcYCgsXFwoLFxcKCxcXCgsXCxcKGAoYChgKFwABJQsWCxcLFwsLFhgKFwsKGAoXFwsXCxcLChcLFwsXCxcKGAoXCxcLFxcLChcXCwoXFwsKFxcLChgKFwsXCxcKGAoYAAEkCxcLFwsXCgsXFwoYCgsXCxcXChgKGAoKGAoYChcLFwsXChgKGAoYFgsKGBYLChgWCwsXFwoLFwoYChcLFwsXCxcAASQMFgsXCxcLChcXCxcKCxcLFxcLFwoYCgsXChgKGAoYChcLFwsXCxcXCgsXFwoLFxcKCxcXCwoXCxcLFwoXCxcLFwABJQsXChcLFwsKGBYLFwsLFgsXFwsXCxcKCxcLFwoYChgKFwsXCxcLFxcLChcXCwoXFwsKFxcLCxYLFwsXCxcKGAoYAAEkCxcKGAoYCgoYFwoXCwsWCxcYChcLFwsKFwsXCxcKGAoYChgKFwsXFwsKFxcKCxgWCwoYFgsLFgsXCxcLFwoYChgAASQLFwoYChgKCxcXChgKCxcKGBcKFwsXCwoXCxcLFwsXChcLFwsYChcXCwoXFwsKFxcLChgWCwoXCxgKFwsXCxcKFwABJQwWCxcKGAoLFxcKFwsLFwoXGAoXCxcLChcLFwoYChcLFwsXChgKGBYLCxcWCwsXFwoLFxcKCxcLFwoXCxcLFwoXAAXcAAAAAA=='
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '20.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgAwAwoXChgKFwsXCxcLChcXCxcLFwsXCxcLChcLFwsXCxcLFwoYChgKFxcLChgWCwsXFwsKFxcLChcLFwoYChgKFwsXAAElCxcLFwsXChgKGAoLFxcKGAsXChcLFwsLFgsXCxcLGAoXCxcKGAsXFwoLFxcLChcXCwoXFwsKGAoXChgKGAoYChgAASQLFwsXCxcLFwoYCgsXFwoYChcLFwsXCwoXCxcLFwsXCxcKGAoYChgWCwsXFwsKFxcKCxcXCwoXCxcLFwsXChgKGAABJAsXCxcLFwoYCxcKCxcXCxcKGAoYChgKChgKGAoYChcLFwsXChgKGBcKCxcXCgsXFwoLFxcLChcLFwsXCxcLFwsXAAEkCxcLFwoYChgKGAoLFxcLFwoYChgKFwsLFwoXCxcLFwsXChgKGAoYFgsLFhgKCxcXCgsXFwsKFwsXChgKGAoYChcAASULFwsXChgKGAoXCwsWGAoXCxcLFwsXCgsXCxcLFwoYChgKGAoXCxcXCwoXFwsLFhgKChgXCgsXChcLFwsXCxcLFwABJAwXChcLFwsXCxcLChcXCxcLFwoYChgKCxcLFwoXCxcLFwsXCxcLFxcKCxcXCgsXFwsKFxcLChcLFwsXCxcLFwoYAAEkCxcLFwoYChgKFwsLFxcLFwoXCxcLFwsKFwsXCxcLFwsXChgKFwsXFwsLFhcLChgWCwsXFwsKFwsXCxcKFwsXCxcAASULFwsWCxcLFwsXCwoXFwsXCxcLFwoXCwsXChgKGAoXCxgKFwsXCxcXCgsXFwoLFxcKCxcXCwoXCxcLFwsXCxcKGAABJAsXCxcLFwoYChcLCxcXCxYLFwsXCxcLChcLFwsXChgKGAoYChcLFxcLChcXCwoXFwsKGBcKCxcKGAoYChgKFwsXAAEkDBcKFwsXCxcKGAoLFxcLFwoYChcLFwsKGAoYChgKFwsXCxcLFwoYFgsLFxcKChgXCgsXFwsKFwoYChgLFwoYChgAASQLFwsXChgKGAoXCwoYFgsYChcLFwsXCwoXCxcLFwoYChcLFwsXCxcXCwoXFwoLFxcLChcYCgoYChcKGAoYChgKFwAF3AAAAAAAAAAA'
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '40.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgGEAwoKGAoXCxcLFwoYChgAASQMFgsXCxcLFwsXCxYLFwsLFxcLFwoYCgoYChgKGAoYChgKGAoXCxcXCwoXFwsKFxgKChgWCwsXCxcLFwoXCxcLFwABJQsXCxcKGAoYCxYLGAoXCwoYFgsXCxgKChgKGAoXChgLFwoYChgKGBcKChgWCwsXFwsKFxcLChgKFwsXChgKGAoYAAElCxcKFwsXCxcLFwsXCxcKCxcXCxcKGAoLFwsXChgKGAoXCxcLGAoXFwsKFxcLChcXCwoYFwoLFwoYChgKFwsXCxgAASMMFwsXCxcKGAoXCxcLFwsKFxcLFwsXCwoXCxgKFwoYChgLFwoYChgWCwoXFwsLFxcLCRgXCwoXCxcLFwoYChgKFwABJQsXCxcLFwsXChgKFwsYCgsXFgwXChcLChcLGAoXCxcLFwsXChgKGBcKCxcXCgsXFwsKGBcKChgKGAoXCxcLFwoYAAEkDBcKFwsXCxcLFwoYChgKCxcXCxcLFgsLFwoYChgKGAkYCxcLFwsXFwsKFxcLChcXCwoXFwwJGAoYChgKFwoYCxcAASQLGAsWCxcLFwsXCxcLFwsJGBcLFwsXCgoYCxcKGAoYChgKFwsXCxcXCwoYFgsKGBYLCxcXCgsXCxcKGAoXCxcKGAABJAwWCxgKGAoXCxcLFwsXCwoXFwsXCxcKCxcLFwsXChgKGAoYChgJGBcLChgWCwoYFwoLFxcKCxcLFwoYChgKFwsYAAEkCxcLFgsXCxgKFwsXCxcLChcXCxcLFwsKGAoYCRgLFwoYChcLGAoYFgsKFxgKChgXCwoXFwoLFwsXCxcKFwsYChgAASQLFwsXChgKFwwWCxcLFwsKGBcKFwsXCwoXCxcLGAoXChgLFwoYChgXCgoYFwoLFxcKCxcXCwoXCxcLFwoYChgKGAABJAsXCxcLFwsXChgKFwsXCwsWGAoXCxcLChgKFwsXCxcKGAsXChgKGBcKChgWCwsXFwsKFxcLChcLGAoXCxcKGAoYAAEkCxcLFwsXCxcLFwoYChcLCxcXCxcKFwsLFwoYChgKGAoXCxcKGAoYFwoLFxcLChcWDAoYFgsKGAoYCRgLFwsXCxcAASULFgsXCxcLFwsXChgLFgsLFxcKGAoXCwsXChgLFwoYCRgLFwsXCxcXCwoXFwsKFxgKChgXCgsYCRcLFwoYChgKFwAF3AAAAAA='
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '60.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgGEAwoLFwoYChgKGAoYChcAASULCxcXCgsXFwsXCgsXFwsKFxcLFwsXCwoXCxcLFwoYChgKGAoYChcXCwoYFgsLFxcKCxcXCwoXCxcLFwsXCxcKGAABJAwKFxcLChcXCxcLChcYCgoYFgsYChgKChgKGAoXCxcLFwsXChgKGBYLCxcXCgsXFwsKGBYLChgKGAoXCxcLFwoYAAElCwoXFwsKGBcKFwsKGBcLChcXChgLFgsLFwoYChgKGAoYChcLFwsXFwoLFxcLChcXCwsXFgsLFwoXCxcLFwsXCxcAASULCxcXCgoYFwsWCwsXFwsKFxcLFwsXCwoXCxcKGAoYChgKGAoXCxcXCwoXFwsKGBYLCxcXCgsXCxcKGAoXCxcLFwABJQwKFxcKCxcXCxcKCxcXCwoXGAoXCxcLChgKFwsXCxcLFwoYChcLFxgKChgXCgsXFwsKFxcKCxcLFwsXChgLFwoYAAEkDAoXFwoLFxcLFwsKFxcLChgWCxcLFwsKGAoYChcLFwsXChgKGAoYFgsLFxcKCxcXCwoXFwsKFwsXCxcLFwoYChgAASQMChgWCwsXFwoXCwoYFgsLFxcKGAoYCgsXChgKFwsYChcLGAoXCxcXCwoXFwoLFxcLChcXCwsXChgKGAoYChcLFwABJQsKGBcKCxcXChgLChcXCwoXFwsXCxcLChcLFwoYChgKGAoYChgKFxcLChcXCwsXFwoLFxcKCxcLFwsXChcLFwsXAAElCwsXFwsKFxcLFwsKFxgKChgWCxcLFwsKFwsXCxgKFwsXCxcLFwoXGAoLFxcKCxcXCwoXFwsKFwsXCxcKGAoYChgAASQMChcXCwoYFwoXCwoXGAoLFxcKGAoYCgsXCxcKGAoXCxcLFwsXChgXCwoXFwsKFxcLChgXCgoYChgKFwsXCxcLFwABJQsLFxYLCxcXCxcKCxcXCwoXFwsXCxcLChcLFwsXChgKGAoXCxcLFxcLChcYCgoYFgsLFxcKCxcLFwsXChgKGAoXAAElDAoXFwsKGBYLFwoLFxcLCxYYChgKFwsKGAoYChcLFwsXCxcLFwoXGAoLFxcKCxcXCwoXFwsKFwsXCxcLFwsXCxcAASULChcYCgoYFgsXCwsXFwsKFxcKGAoYCgsXCxYLFwsXCxcKGAoYChgXCgsWGAoLFxcKCxcXCwoXCxYLFwsXCxcLFwAF3AAAAAA='
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '80.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgB4AgsKGBYLCxcKFwsXCxcLFwoYAAEkDBYLCxcXCxcLFwoYChcLFwsXCxcLFwsKFwsXChgKFwsXCxcLFwsXFwoLFxcLChgWCwoXFwsKGAsWCxcLFwoYChgAASQMFgsKGBcKFwsXCxcLFwsXCxcKGAsXCgsXChcLFwsXCxcLFwoYChgXCgoYFwsKFxcLChcXCwoYChcLFwoYChgKFwABJQwWCwoYFwoXCxcLFwsXCxcKGAoYChgKCxcKFwsXCxcLFwsXChgKGBYLCxcXCgsXFwsKFxcLChgKFwsXChgKFwsXAAElDBYLChgXChcLFwsXCxcLFwoYChcLGAoLFwoXChgKGAoYChcLGAoXFwsKFxcLChgXCgsXFwsKFwoYChgKGAoXCxcAASUMFgsKGBYLFwsXCxcKFwsXCxgKFwsXCwoYChcKGAoYChgKFwsXCxcXCwoXFwsKGBYLChgWCwsXCxYLFwsXCxcLFwABJQsWCwsXFwsXChgKFwsXCxcLFwsXCxcLChcLFwoYChgKGAkYChgKGBcLChcXCwoYFgsKGBYMCRgKFwoYChgKGAoYAAEkDBYLCxcXCxYLFwsXCxcLFwsXCxcLFwoLFwsXChgJGAoYChgKGAoYFgsLFxcLChcXCwoXFwsKGAoXChgKGAoXCxgAASQMFgsKGBYLFwsXCxcLFwsXCxcLFgsXCwoYChcLFwoYChgKGAoXCxcXCwoYFgsLFxcLChcXCwoXCxcKGAoYChgJGAABJQsXCwoXFwsXCxcLFwsXChcLFwsXCxcLChgKGAoXCxcLFwoYChgKGBYLChgWCwsXFwsKGBYLChcLFwoYChgKGAoXAAXc'
    - conditions:
      - condition: state
        entity_id: input_number.juno_fan_percentage
        state: '100.0'
      sequence:
      - service: remote.send_command
        target:
          device_id: 0c7a6d7d85bc03ebdfeff305b5794861
          entity_id: remote.broadlink
        data:
          command: 'b64: sgB2AhcXCwoXCxcKGAoXCxcLFwABJQsXCwoYFgsXCxcLFwsXCxcKFwsXCxcLCxcKFwoYChgKGAoYChgKFxcLChgWCwsXFwsJGBcLChgJGAoXCxcLFwsXAAElCxcLChgWCxcLFwsXCxYLFwsXCxcLFwsKGAoXChgKGAoYChcLGAoXFwsKFxcLChcXCwoYFgsLFwoXCxcLFwsXCxcAASQMFgsLFxcLFwoYChcLFwsXCxcLFwsXCwoYCRgKFwsXCxcLFwoYChgXCgsXFwoLFxcLChcXCwoYChcLFwoYChgKGAABJAwWCwoYFwsWCxcLFwsXCxcLFwsXCxcLCRgKFwsXCxcKGAoYChgKGBYLChgXCgsXFwsKFxcLChgKFwoYChgKFwsXAAElDBYKCxcXCxcLFwsXCxcKFwsXCxcLFwsKGAoXChgKGAoXCxcLFwsXFwsKFxcLChgWCwsXFgsLFwoXCxcLFwsXCxcAASQMFgsLFxcLFwoXCxcLFwsXCxcLFwsXCwoXChcLFwsYCRgKGAoYChgXCgoYFwsKGBYLChgWCwoYChcKGAoYChgKGAABJAwWCwoYFgsXCxcLFwsXCxcKGAoXCxcLChgKFwoYChgKGAoYChgKFxcLChgWCwoYFwoLFxcKCxcKGAoXCxcLFwsXAAElCxcLChcXCxcLFwoXCxcLFwsXCxcLFwoLGAkYChgKFwsYCRgKGAoYFwoLFxcLChcXCwoYFgsKGAoXCxcKGAoYChgAASQLFwsKGBYLFwsXCxcLFwsXCxYLGAsXCgoYChgKGAoYChcKGAoYCxcXCwoXFwsKFxcLChgWCwoYChcLFwoYChgKGAAF3AAA'
    default: []
  mode: single 

Your fan set up looks a bit convoluted and I’m betting your problem is in there. Everything else aside, using device ID’s is usually a bad practice, it’s one of those things you may come to regret down the road if you ever change devices.

That being said, I would start by stripping down your set speed code to the basics, because you report the issue as being HomeKit and HA but it may be down to your IR commands and logic.

I have several template fans using the same system on Dyson fans that I cannot control otherwise, it’s a trial and error system where you first get it to set the first speed and see what the problems are, then you fix and keep increasing logic until you have the end result.

You also don’t need a script, you could have coded all of that directly in your template - but that’s not a problem, just an observation. But, in that spirit, I would just start debugging with lighter code directly in the template one step at a time.

Excuse my ignorance, what can I use instead the device id?
My codes is taking from this post

Use the entity ID of the entity you are comparing, rather than the device ID, which then also uses the entity ID.