Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fan sensor #13

Open
grssll opened this issue Sep 10, 2023 · 4 comments
Open

Fan sensor #13

grssll opened this issue Sep 10, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@grssll
Copy link

grssll commented Sep 10, 2023

When it pulls data from AC is it possible to create sensor.fan for the Fan card in HA?
Thank you

@dalinicus dalinicus added the enhancement New feature or request label Sep 10, 2023
@dalinicus
Copy link
Owner

The only problem I can think of is the UIS protocol doesn't seem to care what type of device is connected, i.e. Lights and Fans are treated identically as far as the data is concerned. I haven't been successful in tracking down where in the data a device type might be consistently provided... but I've been wanting to give it another shot and see if i can't figure that out.

One thought I was tossing around was having users select the correct SensorDeviceClass for each port during configuration.

Of note, I am working on getting control sensors setup right now via #14 which would create sub devices for every port.

Thanks for your suggestion :)

@grssll
Copy link
Author

grssll commented Sep 11, 2023

Thank you for consideration.

@DanDixon
Copy link

DanDixon commented Mar 20, 2024

Thanks for creating this integration, @dalinicus. It works great.

In the meantime, if you want to control it as a fan you can add a fan template.

Add the code below to your configuration.yaml file to create a fan entity for the AC Infinity Device.

Note that I renamed the New Device Port 1 to Office Desk Exhaust so replace mentions of office_desk_exhaust to the name of your device.

fan:
  - platform: template
    fans:
      office_desk_exhaust:
        friendly_name: "Office Desk Exhaust Fan"
        value_template: "{{ states('select.office_desk_exhaust_active_mode') }}"
        percentage_template: >
          {{ states('number.office_desk_exhaust_on_power') | int * 10 if is_state('select.office_desk_exhaust_active_mode', 'On') else 0 }}
        availability_template: "{{ states('binary_sensor.office_desk_exhaust_status') }}"
        turn_on:
          service: select.select_option
          data:
            option: "On"
          target:
            entity_id: select.office_desk_exhaust_active_mode
        turn_off:
          service: select.select_option
          data:
            option: "Off"
          target:
            entity_id: select.office_desk_exhaust_active_mode
        set_percentage:
          - service: select.select_option
            data:
              option: "{{ 'On' if percentage > 0 else 'Off' }}"
            target:
              entity_id: select.office_desk_exhaust_active_mode
          - service: number.set_value
            target:
              entity_id: number.office_desk_exhaust_on_power
            data:
              value: "{{ (percentage / 10) | int }}"
        speed_count: 10

This way you can turn on and set the fan speed to max in a script like this (or turn it off by setting the percentage to 0:

service: fan.set_percentage
data:
  percentage: 100
target:
  entity_id: fan.office_desk_exhaust

And you can adjust it using a Fan Mushroom card:
image

Or by opening up more_info on the fan like this:
image

@MRobi1
Copy link

MRobi1 commented Mar 31, 2024

Modified the template slightly to use the current power sensor to determine on/off and fan speed. Using active_mode did not work for me when using automations setup in the AC Infinity app. All devices just showed as "off"

fan:
  - platform: template
    fans:
      grow_tent_exhaust:
        friendly_name: "Grow Tent Exhaust Fan"
        value_template: >
          {% if is_state('sensor.grow_tent_exhaust_fan_current_power','0') %}
            Off
          {% else %}
            On
          {%endif %}
        percentage_template: >
          {{ states('sensor.grow_tent_exhaust_fan_current_power') | int * 10 if not is_state('sensor.grow_tent_exhaust_fan_current_power','0') else 0 }}
        availability_template: "{{ states('binary_sensor.grow_tent_exhaust_status') }}"
        turn_on:
          service: select.select_option
          data:
            option: "On"
          target:
            entity_id: select.grow_tent_exhaust_fan_active_mode
        turn_off:
          service: select.select_option
          data:
            option: "Off"
          target:
            entity_id: select.grow_tent_exhaust_fan_active_mode
        set_percentage:
          - service: select.select_option
            data:
              option: "{{ 'On' if percentage > 0 else 'Off' }}"
            target:
              entity_id: select.grow_tent_exhaust_fan_active_mode
          - service: number.set_value
            target:
              entity_id: number.grow_tent_exhaust_fan_on_power
            data:
              value: "{{ (percentage / 10) | int }}"
        speed_count: 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants