sarahhenkens / home-assistant-iocare

27 stars 15 forks source link

Proposed Enhancement: Smart (Auto) Mode, Filter Life, Light #1

Closed RobertD502 closed 3 years ago

RobertD502 commented 4 years ago

Just wanted to see if there are any plans of adding the Smart Mode/Night Mode along with the Filter Life and Light control - curious as I saw those referenced in the iocare api library.

kylerw commented 4 years ago

@robertd502 I've submitted a PR for the switch/light on the front of the purifier (https://github.com/sarahhenkens/home-assistant-iocare/pull/2). The default fan from HA doesn't support non-standard speeds/modes as far as I can tell so it'll be extending those... something I can try to play with over the next few days.

sarahhenkens commented 4 years ago

@kylerw @RobertD502 I've approved both PRs that were pending review.

The mode selector is the most useful I agree. I think we HA supports fan speed modes which we can leverage.

skynet01 commented 3 years ago

Yes indeed this would be great :)

RobertD502 commented 3 years ago

Just to circle back to the topic of fan speed- It seems that the Dyson component got around the fan speed limitation by creating a set speed service (dyson.set_speed to be specific). In addition, they also added support for auto mode and night mode. This way users can use input numbers from the front end to call the desired services. Pulling in the current fan speed in form of a number, auto mode (On/Off), night mode (On/Off) as attributes would be helpful when building a lovelace card on the frontend to show current states. Not to keep adding on, but would it be possible to pull the pre-filter and filter remaining life in as an attribute? I noticed that the python-iocare library already has functions for setting auto, night, as well as pulling in filter information.

Edit: I have gone ahead and pulled in the state of auto mode, night mode, pre-filter percentage, and MAX2 filter percentage as an attribute for the fan entity. Will be filing a PR soon.

RobertD502 commented 3 years ago

Going to go ahead and close this issue as all of the proposed enhancements have been covered with the recent PRs

GTPatriots commented 3 years ago

@sarahhenkens @RobertD502 Please forgive me as I'm new to Home Assistant. I've added the IoCare integration and I can see the options for night and auto mode in the card I added to the home overview page, but they are read only unlike the fan speed selection. Am I missing something? How do I control setting the fan to auto/smart?

RobertD502 commented 3 years ago

@GTPatriots

Auto mode and night mode are turned on by calling the service iocare.set_auto_mode_on and iocare.set_night_mode_on, respectively. You can test this out by clicking on "Developer Tools" on the side and then the "Services" tab. From there select the iocare.set_auto_mode_on service and enter the entity_id for your purifier- for example, fan.office_purifier. This should auto populate the Service Data box with "entity_id: fan.name_of_your_purifier". You then press the "Call Service" button and this will set the purifier you picked to auto-mode. If you want to use the service call on the front-end so that pushing a button turns on auto mode for a select purifier, you will need to use a card that can make service calls. The easiest way, and prettiest in my opinion, is a purifier card that was just recently released. You can find it here. Follow steps 1,2, and 3i.

Once you have done so, go to your dashboard and add a "Manual" card. The type in this code, but be sure to replace "fan.office_purifier" and "air_quality.office_purifier" with the names of your entities:

type: 'custom:purifier-card'
entity: fan.office_purifier
stats:
  - attribute: pre_filter_percent
    unit: '%'
    subtitle: Pre-Filter
  - attribute: max2_filter_percent
    unit: '%'
    subtitle: Max2 Filter
  - attribute: auto_mode
    subtitle: Auto Mode
  - attribute: night_mode
    subtitle: Night Mode
aqi:
  entity_id: air_quality.office_purifier
actions:
  - name: Auto Mode
    icon: 'mdi:brightness-auto'
    service: iocare.set_auto_mode_on
    service_data:
      entity_id: fan.office_purifier
  - name: Night Mode
    icon: 'mdi:weather-night'
    service: iocare.set_night_mode_on
    service_data:
      entity_id: fan.office_purifier
action: null
show_name: true
show_state: true
show_toolbar: true

What you will get is a card that looks like this. Pressing on the "A" logo in the lower right hand corner will set the purifier to auto mode and pressing on the moon logo will set the purifier to night mode. Besides that, you can change the speed by clicking on the upper left hand corner and selecting low, medium, or high.