finity69x2 / fan-percent-button-row

Frontend plugin to control fans in Home Assistant using percent values for speeds
32 stars 19 forks source link

Off doesn't turn fan off #4

Closed broyuken closed 3 years ago

broyuken commented 3 years ago

Using the off button it doesn't turn the fan off, it just changes the speed. My fan uses a different IR code for on/off and change speed. Can you make the off button actually send the off command?

febalci commented 3 years ago

For sonoff ifan03, i face the same problem. Even tough the speed is 0 when i press the OFF button, the on/off switch is still ON.

finity69x2 commented 3 years ago

Yes, I'll look into it.

I've just now mostly figured out how these new fan control changes are supposed to work.

broyuken commented 3 years ago

Appreciate it, this change to fans in HA is annoying but in the end I think it will be helpful overall.

finity69x2 commented 3 years ago

I just made a change to the code.

Could you try it with the latest and see if it works OK now?

remember to clear the cache to force the new code to be reloaded after you restart HA.

finity69x2 commented 3 years ago

in the end I think it will be helpful overall.

Unfortunately I'm not as optimistic as you are.

I think they could have left the speed list stuff intact and just added the percentage stuff for people who needed it. It would have been way easier than trying to figure out how to transition to the new stuff for people who's fans were already working perfectly fine.

But that's water under the bridge now.

broyuken commented 3 years ago

Turning it off works as expected now, however if the fan is off and I click one of the speeds, nothing happens. The fan doesn't turn on.

Stupco commented 3 years ago

I also had the same issue with OFF not working, thought it was my code so didn't raise an issue.

Confirmed it kind of works in v1.3 (better than before), however after it turns off, 3 seconds later is is turned back on automatically.

My code as follows:

#CONFIGURATION
fan:
  - platform: template
    fans:
      b3_fan:
        friendly_name: "Bedroom 3 Fan"
        value_template: "{{ states('input_boolean.b3_fan_state') }}"
        percentage_template: "{{ states('input_select.b3_fan_speed') }}"
        turn_on:
          service: script.fan_on
        turn_off:
          service: script.fan_off
        set_percentage:
          service: script.fan_set_speed
          data:
            percentage: "{{ percentage }}"
            name: "b3"

#SCRIPT
fan_off:
  alias: Fan Off
  sequence:
    - service: remote.send_command
      data:
        entity_id: remote.rmpro_remote
        command: b64:sgDKAAsXCxcLChgXChcLChgKGAoYChgKGAoYChcKGAsXChgKGBcLFwoYCgsXFwsXCwoXFwsKGBcKCxcLFwoYChgKGAABCAwXCxcKGAoLFxcKFwsLFwoYChgKGAoYChgKGAoYChgKGAoXFwsXCxcLChgWDBYLChgXCwoXFwsKFwsXChgKFwsYAAEIDBYLFwsXCgsXFwsXCwoYChgKGAoXCxcKGQoXChgKGAoYChgXChgKFwsLFxcLFwoLFxcLChcXCwoYChcLFwoYCxcABdwAAAAAAAAAAAAAAAAAAA==
    - service: input_boolean.turn_off
      data:
        entity_id: input_boolean.b3_fan_state

Two things additional to this issue:

  1. Can you have it so that the state can still be called even if it is currently selected (ie. Let me call the OFF service, even if Fan Percent Button Row thinks the fan is OFF)?
  2. When will this be available on HACS? :)
finity69x2 commented 3 years ago

@broyuken

Are you sure the fan works otherwise not using the plugin?

I have a template fan that I'm testing it with and it's working fine.

Could you post your fan config along with any associated scripts and/or automations in the forum and tag me in the post?

I find it's easier to communicate there than here.

And I'm not really sure it's an issue with this plugin.

finity69x2 commented 3 years ago

@Stupco

  1. I'd rather not. It would be better to figure out the reason that your fan is behaving like that instead of providing a workaround in the plugin. If you are a member of the HA forum would you mind posting your fan code there (along with all associated scripts/automations/input_x entities and tag me in the post so I can look at it there?

  2. I have no idea. Ludeeus said he was going to start going thru them a few days ago but he never has yet. So I'm just waiting on him now.

broyuken commented 3 years ago

Yep, nevermind. You pointed me in the right direction and I was able to fix it. My script didn't have a condition to turn the fan on first if it was off, it just changed the speed which did nothing since the fan was off. Fixed my script and all is well now. Closing.

Stupco commented 3 years ago

@Stupco

  1. I'd rather not. It would be better to figure out the reason that your fan is behaving like that instead of providing a workaround in the plugin. If you are a member of the HA forum would you mind posting your fan code there (along with all associated scripts/automations/input_x entities and tag me in the post so I can look at it there?
  2. I have no idea. Ludeeus said he was going to start going thru them a few days ago but he never has yet. So I'm just waiting on him now.

@finity69x2

  1. I honestly think there is a STRONG use case for allowing the currently active button to be called in my honest opinion. Example: My fans are controlled via RF, but if a user decides to change the setting of the fan using the RF remote and not using HA, the HA status doesn't update. The Fan Percent Button Row won't allow me to turn off a fan that it thinks is off it is really on.

Posted the code where I have the issue of the Fan Percent Button Row not turning off: HA Forum post

  1. No drama, thought I'd ask :) Just easier to push your updates.
broyuken commented 3 years ago

That’s why you need to add a smart switch with power monitoring :) then you know what speed the fan is on even if it’s controlled by someone outside of HA

Stupco commented 3 years ago

Can't argue with that, but that's just extra $$$ :(

Don't see why you couldn't re-activate a fan level that is already active?

broyuken commented 3 years ago

Not arguing with that either I think it would be a great addition, but I picked up a sonoff switch for power monitoring and am extremely happy with how my fan works now.

Stupco commented 3 years ago

Definitely the better way, probably should have just replaced the whole ceiling fan.

Can you set power ouptut for your sonoff fan and that sets the DC ceiling fan speed?

broyuken commented 3 years ago

Oh mine isn’t a ceiling fan, mine is a floor oscillating fan with a remote. That wouldn’t work for a ceiling fan unless you had a sonoff that could go online or something. Probably better off with an Inovelli fan control switch to control it instead.

Stupco commented 3 years ago

I'm programming a Lanbon L8 using HASP-LVGL, so I just need an in ceiling solution (not a switch plate).

ugh, oh well :) Thanks mate for all your advice and help.

broyuken commented 3 years ago

ooh I like that, so if you control the fan via the switch then HA would know about it. But if you use the remote it wouldn’t. So just hide the remote and only use HA or the switch to control it.

Is there no switch for controlling on/off for the fan? Is it hard wired on and only controllable via rf?

Stupco commented 3 years ago

Yeah basically. I will hide the remotes, but I have rare occasions where for some reason sending the RF code via HA doesn't work, and it thinks it's in a different state.

Hence my request to allow for the action of an already active button.

Should I make a seperate Feature Request to track this? Or should I leave it alone haha