mikelawrence / senseme-hacs

Haiku with SenseME fan integration for Home Assistant
MIT License
21 stars 14 forks source link

Add support for Sleep Mode #18

Closed DaveO16176 closed 3 years ago

DaveO16176 commented 3 years ago

Would it be possible to add support for sleep mode so it can be selected via Home Assistant and not just by the fan's remote or the app?

claytonjn commented 3 years ago

Built-in support would be nice. Until then you can just configure a command_line switch manually:

platform: command_line
  switches:
    master_bedroom_fan_sleep_mode:
      command_off: >
        echo "<00:11:22:33:44:55;SLEEP;STATE;OFF>" | nc -w1 -u fan.ip.or.dns 31415
      command_on: >
        echo "<00:11:22:33:44:55;SLEEP;STATE;ON>" | nc -w1 -u fan.ip.or.dns 31415

You just have to replace 00:11:22:33:44:55 with the mac address of the fan and fan.ip.or.dns with the IP address or a DNS address of the fan.

mikelawrence commented 3 years ago

That's a handy way to handle the Sleep Mode in HA. Both of my fans are down right now so I don't have any way to test this, have you tested the switch? The reason I ask is sometimes SenseME commands require a ";SET"

Either way I wouldn't mind adding Sleep Mode Switch to the component once I get fans working again.

claytonjn commented 3 years ago

Yes, I've had that configured since long before you released the senseme component. It's at least working on my "H series" fan.

DaveO16176 commented 3 years ago

Thanks so much for the solution! I had to change it a bit to get it working. This worked for me:

switch:    
  - platform: command_line
    switches:
      master_bedroom_fan_sleep_mode:
        command_off: >
          echo "<00:11:22:33:44:55;SLEEP;STATE;OFF>" | nc -w1 -u fan.ip.or.dns 31415
        command_on: >
          echo "<200:11:22:33:44:55;SLEEP;STATE;ON>" | nc -w1 -u fan.ip.or.dns 31415
claytonjn commented 3 years ago

Yeah, sorry the difference in syntax is from using yaml includes.

mikelawrence commented 3 years ago

Just giving a quick update. I'm working on a pretty substantial update that will include sleep mode.

mikelawrence commented 3 years ago

The new library and senseme integration are shaping up nicely. Whoosh and Sleep are now preset modes. Look for a release soon after HA 2021.3 comes out.

mikelawrence commented 3 years ago

v2.2.0 of this integration has been released and it supports Whoosh and Sleep as preset modes. There is one caveat, this new version requires Home Assistant 2021.3 which is due to be released in a few days.

mikelawrence commented 3 years ago

Now that v2.2.1 of this component has been released this issue is fixed.