owenb321 / hampton-bay-fan-mqtt

MQTT / RF Bridge for Hampton Bay Fan control
69 stars 18 forks source link

MQTT changes #7

Closed sbritto0228 closed 1 month ago

sbritto0228 commented 1 month ago

Hi Owen,

I used your code and it works great. However with the new MQTT changes I had to change the switch part and the speed of the fan does not work. Basically running on pretty much one speed but on & off are working. Anything I am doing wrong I have tried:

` - fan: name: "Family Room Fan" state_topic: "home/hamptonbay/1101/on/state" command_topic: "home/hamptonbay/1101/on/set" preset_mode_command_topic: "home/hamptonbay/1101/speed/state" preset_mode_command_template: "home/hamptonbay/1101/speed/set" preset_modes:

` - fan: name: "Family Room Fan" state_topic: "home/hamptonbay/1101/on/state" command_topic: "home/hamptonbay/1101/on/set" percentage_state_topic: "home/hamptonbay/1101/percent" percentage_command_topic: "home/hamptonbay/1101/percent" preset_mode_state_topic: "home/hamptonbay/1101/speed" preset_mode_command_topic: "home/hamptonbay/1101/speed" preset_modes:

owenb321 commented 1 month ago

Looks like I updated it in my own config and never changed it here 😬 This is what I'm using now:

- name: "Bedroom Fan"
  state_topic: "home/hamptonbay/1000/on/state"
  command_topic: "home/hamptonbay/1000/on/set"
  percentage_state_topic: "home/hamptonbay/1000/speed/state"
  percentage_value_template: >-
    {% if value == 'low' -%}
    1
    {%- elif value == 'medium' -%}
    2
    {%- else -%}
    3
    {%- endif %}
  percentage_command_topic: "home/hamptonbay/1000/speed/set"
  percentage_command_template: >-
    {% if value | int(default=0) <= 1 -%}
    low
    {%- elif value | int(default=0) == 2 -%}
    medium
    {%- else -%}
    high
    {%- endif %}
  speed_range_max: 3

I'll update that in the readme

sbritto0228 commented 1 month ago

I used your code kinda -- had to add platform mqtt but now the fan does not turn on or off and no speeds `fan:

light:

image

owenb321 commented 1 month ago

You're right, mine's not working as well now that I actually go try it (don't use the fan too often). There must have been a breaking change at some point that invalidated this config, I'll see if I can work out what needs to be changed.

owenb321 commented 1 month ago

Just pushed a fix for this, it requires re-flashing and a new config, but should handle the states that Home Assistant is sending now.

Let me know if it works now with those changes.

sbritto0228 commented 1 month ago

Can't wait to try it out. For now I am having issues with MQTT. Even though I have defined the entitites in cnfiguration.yaml they are not showing up under MQTT entities. Very strange I have to figure that out before I can get to this however thank you!

sbritto0228 commented 1 month ago

- light: name: "Kim Fan Light" command_topic: "home/hamptonbay/1010/light/state" state_topic: "home/hamptonbay/1010/light/set" The speeds are working well but the light is not working now

owenb321 commented 1 month ago

I think there was an issue with the transmitted state being looped back into the received state, just made a change to try to prevent that, can you flash with the current code an try again?

sbritto0228 commented 1 month ago

Thanks again. I re-compiled and uploaded the new sketch. The light works however I have to turn the light on and then turn on the fan. The on and off by itslef do not work. When I turn the fan off, the light does not turn off. I have to turn the off on the light and then the off on the fan. The room has 4 recessed lights and two lamps so we rarely if at all use the fan light. So not very important for me.