alextud / ha-prana

Prana recuperators (fan) for Home Assistant
23 stars 2 forks source link

how to set speed in and out #3

Open luciandf opened 2 years ago

luciandf commented 2 years ago

Hello, I have setup your integration and it is working ok-ish with HA. I am having some issues though:

image

Check out the attached picture. If I want to set the fan direction for both in and out it is not working. Only In or Out. Also how would I go about setting one speed for In and another for Out?

Another question, if you don't mind: how do I access these parameters from within HA in an automation. For example if I want to set the fan speed to 2 and direction In and speed 1 for direction Out at a certain time and run for say 30 mins then switch off. Where can I access these?

Thank you and keep up the good work!

alextud commented 2 years ago

For controlling device from HA, ex: speed in/out - default interface provided by HA is use, and there is not much control to add UI elements. In this case you can switch between manual / auto mode to have speed in/out reseted ...

Regarding automations i'm using NodeRed + HA websocket integration -> https://nodered.org as it provide much granular control... but prana device is exposed as a fan device in HA so you can do automations within HA as well... https://www.home-assistant.io/integrations/fan/

alextud commented 2 years ago

EX: nodred integration

Screenshot 2021-10-13 at 13 07 34
luciandf commented 2 years ago

i have tried the Auto mode but it doesn't reset the speed in/out.

is there no way to make those speed direction buttons to be pressed together in order to turn on speed In/Out?

Regarding automations, I have seen that prana is a fan and I know how to do automations with HA but what I don't understand is how to access the speed_in/speed_out attributes from here:

image

alextud commented 2 years ago

using fan.set_direction

@property
def current_direction(self) -> str:
    """Fan direction."""
    if not self.device.speed:
        return None
    elif not self.device.isAirInOn:
        return "forward"
    elif not self.device.isAirOutOn:
        return "reverse"
    else:
        return "reverse & forward"
alextud commented 2 years ago

For the set direction, we can add an empty string to switch to default, currently is not implemented:

def set_direction(self, direction: str):
    """Set the direction of the fan."""
    if direction == 'reverse':
        if not self.device.isAirInOn:
            self.device.toogleAirInOff()

        self.device.toogleAirOutOff()
    elif direction == 'forward':
        if not self.device.isAirOutOn:
            self.device.toogleAirOutOff()

        self.device.toogleAirInOff()

    dispatcher_send(self.hass, SIGNAL_UPDATE_PRANA + self.device.mac)
luciandf commented 2 years ago

I am sorry, but I can't figure it out. This is what I have as options in HA: image

It appears that the Auto preset works when I select it. And sets the fan on the auto mode where you can select the speed level from 1 to 10. But if I try to set an In speed and a different out speed from the fan card it only does one direction.

image

With nodered works to set different speeds for the in and the out dirs? I have never used nodered.

luciandf commented 2 years ago

would it not be possible to set an option where both those arrows for direction (in the second picture above) can be pressed at once? and that would mean In and Out. Sorry I am not a programmer and don't know the complexity of what i am asking!

Also, the speed slider could be so that if both are pressed, then there is one slider for both and if only one is pressed then the slider is Speed IN (for the In dir) and Speed OUT (for out).

And if these features could be accessed from an automation would be amazing.

alextud commented 2 years ago

I will try to see what's possible ...

luciandf commented 2 years ago

as I said before, I am not a programmer and don't know much but I am curious and I have been looking around in your code and in the code for the fan integration in HA. There they have the following for the direction:

set_direction:
  name: Set direction
  description: Set the fan rotation.
  target:
    entity:
      domain: fan
  fields:
    direction:
      name: Direction
      description: The direction to rotate.
      required: true
      selector:
        select:
          options:
            - "forward"
            - "reverse"

While in your code you have the possibility of a "forward & reverse " option. Can this option ever be satisfied with the current fan integration? I mean I don't see how both directions can be turned on at the same time.

adysxp commented 1 year ago

Hi @alextud ,

can you help me with an email address? Thanks a lot!