GithubHelp home page GithubHelp logo

ikaruswill / lovelace-fan-xiaomi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fineemb/lovelace-fan-xiaomi

65.0 8.0 33.0 23.58 MB

Xiaomi Smartmi Fan Lovelace card with CSS fan animation

License: Apache License 2.0

JavaScript 13.78% TypeScript 86.22%
home-assistant xiaomi hacs lovelace custom-card xiaomi-fan

lovelace-fan-xiaomi's Introduction

Xiaomi Fan Lovelace Card

hacs_badge

Xiaomi Smartmi Fan Lovelace card for HASS/Home Assistant.

Features

  • Supports HACS installation
  • CSS fan blade and oscillation animation
  • UI config of card
  • Wide range of fans support by using HA standard speeds flag

Toggles

  • Oscillation
  • Natural mode
  • Child lock
  • Sleep mode

Cycling

  • Speed level
  • Oscillation angle
  • Timer duration

Requirements

By default, the Xiaomi Miio native integration will be used.

If you have a model that's not supported by the native integration yet, this card also supports the Xiaomi Mi Smart Pedestal Fan integration.

HACS Installation

Search for Xiaomi Smartmi Fan Card

Manual Installation

  1. Download fan-xiaomi.js
  2. Copy to www/community/lovelace-fan-xiaomi/fan-xiaomi.js
  3. Add the following to your Lovelace resources
    resources:
      - url: /community_plugin/lovelace-fan-xiaomi/fan-xiaomi.js
        type: js

Card Configuration

Example of Lovelace config views.cards key

entity: fan.entity_id
name: Fan Name
type: "custom:fan-xiaomi"
platform: xiaomi_miio_airpurifier
Card attribute Default Description
entity_id - entity_id of your fan
type - Must be custom:fan-xiaomi
name - (Optional) Fan name shown on card title
platform default (Optional) If using Xiaomi Mi Smart Pedestal Fan integration, specify xiaomi_miio_fan.
disable_animation False (Optional) Disable fan image and animation
force_sleep_mode_support False (Optional) Enables Sleep button in UI which sets speed to 1%
hide_led_button False (Optional) Hide LED toggle for supported models

Preview

Contributing

  1. Clone the repo and install the latest node LTS
  2. Run npm install then npm run build from the root of the repo

Build output should appear in the /dist directory.

Development Inner Loop

  1. npm install
  2. Run npm run start to do a watch build and host the built files at http://127.0.0.1:8234/xiaomi-fan-card.js.
  3. On a running Home Assistant installation add this to your Lovelace resources:
- url: "http://127.0.0.1:8234/xiaomi-fan-card.js"
  type: module

You may need to change "127.0.0.1" to the IP of your development machine if you are developing remotely.

If your Home Assistant UI is running on https, you'll need to provide the resources via https as well. Use npm run start -- --https to serve via https, and switch the url: http://127.0.0.1 above to url: https://localhost.

Credits

fineemb (Original author)

shaonianzhentan

花神

lovelace-fan-xiaomi's People

Contributors

alexkalopsia avatar carlba avatar cyberden avatar fineemb avatar ian-craig avatar ikaruswill avatar insajd avatar jhesketh avatar mrwogu avatar rhuba8324 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lovelace-fan-xiaomi's Issues

Custom element doesn`t exist: fan-xiaomi

Hi,

i try to add your nice looking custom fan card. But its not working. Iam using syssis xiamo_fan integration and added your frontend repo via Hacs but it shows the following error:

image

br
Doxlike

Fan Speed issue with zhimi.fan.za5

I own the Pedelstan Fan 3 and got a issue with the Fan Speed:

model: zhimi.fan.za5
integration: xiaomi_miio_fan

The Error:
"Fehler beim Aufrufen des Diensts fan/set_speed. The speed Level 4 is not a valid speed."

So Speed 3 is the Limit and because of this Error i can not switch back to Speed 1.

Thats the Attributes:

speed_list:

  • 'off'
  • low
  • medium
  • high
  • 'off'
  • Level 1
  • Level 2
  • Level 3
    preset_modes:
  • 'off'
  • Level 1
  • Level 2
  • Level 3
    oscillating: false
    speed: Level 3
    percentage: 100
    percentage_step: 33.333333333333336
    preset_mode: Level 3
    model: zhimi.fan.za5

Card not display in dashboard.

Hi,
I installed your card ( v2.2.1) and it does not appear when I use the xiaomi_miio_fan platform.
You can see on the pictures with xiaomi_miio_fan selected or by default.
No error in log.

platform: xiaomi_miio_fan ( if you change the options of the card in UI, the card reappears in the UI. But as soon as we save, it disappears from the dashboard.)
fan card

platform: default (but not full options working)
fan card 2

my fan model is the Mi Smart Standing Fan 2 (dmaker.fan.p18).
HAOS 8.4
Core 2022.8.0
Supervisor 2022.7.0

Is this a glitch?

Option to hide angle

Hi

First of all, thanks for the great job !

Is it possible to add an option for hiding angle ? for my dmaker.fan.1c Angle is not an available option, so it show this information empty (and not usefull).

FEATURE REQUEST: Add battery info

Great card. Unfortunately it does not integrate battery status. I would love for this to be added.
The relevant attributes are:

battery_charge: complete

Some fans also have fairly accurate temperature and humidity sensors:

humidity: 76

This is less pressing as the sensors can always be called from elsewhere.

Move project ownership to an organization

As I'm no frontend developer, this card has been increasingly difficult to maintain for me. In time to come, I'll be shifting this project to an organization so that it can be co-owned by maintainers. Ping me if you'd like to join.

Unable to turn off natural mode / Timer not showing correct time

For dmaker.fan.p15 I'm unable to turn on/off nature mode. Even if Fan is in mode: nature, leaf icon stays black. After trigger it turns green for couple of seconds and goes black again without changing mode at all.
As for timer, it shows 1h, then 1m and stays like that.

My config is:

type: 'custom:fan-xiaomi'
entity: fan.xiaomi_smart_fan_pro
disable_animation: false
name: Wentylator
platform: xiaomi_miio_fan

Card broken in 0.110.0

In latest HA there's an issue with the card. May be caused by new icon's loading mode in frontend?

image

Only see fan speed and oscillation

Hello,

Since it is getting warmer in here (Netherlands) i plugged in my xiaomi fan 1C back in again.
in the past the card works like a charm but now i only see 3 parameters to adjust: power, speed (1,2,3) and oscillation.
afbeelding
my config wor the card is like:
afbeelding
and the config for the fan intself is:
afbeelding

Am i doing somthing wrong?

Failed to call service fan/set_speed

It seems that fan.set_speed is no longer a supported service. fan.set_percentage works in automations for Xiaomi fans so that may work as a replacement.

Multiple Fans: Angle function applies to all fans

v1.5.1

I've got 2 Xiaomi fans zhimi.fan.za4 and zhimi.fan.sa1

Both controlled using this fine lovelace card, but all controls being good, only one is giving me problems, if I click on the Angle(°) on any of the fans, both are starting to oscillate and same angle value is set for both fans. However if I click on the Oscillate function, it applies only to the selected fan.
Again if all functions are working fine for each individual fan, the Angle(°) function applies to all my all fans.

Capture d’écran 2020-06-12 à 23 36 33

v1.5.2) calling services of Natural mode in Lovelace

notitle
{syssi's Xiaomi Mi Smart Pedestal Fan Integration version : 0.3.1
your's Xiaomi Smartmi Fan Card frontend version : 1.5.2}

Cannot call service natural mode on/off either from Lovelace UI
I can call service in developer mode but not in your Lovelace custom frontend.

Card in HA Mobile application

Hello. I've noticed that on the official mobile application there is a small UI issue. Looks like the height of the card is not enough to display it correctly. It is a little bit cut at the bottom.

PS. Thanks for that card, it is really awesome :)

2020-07-06 18 28 52

fan xiaomi.zhimi.fan.v3 ver.1.5

Version 1.5, lost the ability to control speed, causes an error, lost animation. Version 1.4 does not show any such problems.

image

Deprecation of core support for syssi/xiaomi_fan integration

Background

  • xiaomi_fan integration is increasing the code complexity by many orders of magnitude
  • It's already challenging to support the native miio integration with various number/select entities for the same features
  • Most fans are already supported by the native miio integration and many more have integrations in progress

Proposal

  • Deprecate core support for the xiaomi_fan integration
  • Fall back to the xiaomi_fan integration if the fan is not supported yet.
  • Platform option will also be removed in favor of graceful degradation to xiaomi_fan integration.

Action items

  • Remove platform option
  • Refactor code to remove xiaomi_fan logic, and assume native miio integration as default
  • Implement comprehensive checks for supported attributes/models
    • If not detected, fallback to xiaomi_fan services/attributes/models, this avoids model-specific code
    • (Thanks @ian-craig for your pioneering work on this)
  • Refactor services and attributes to global object
    • Supported attributes and state checks refer to the object for the entity to look for
    • Service calls refer to the object for the service to call

Speed button no longer works

when pressing the Speed button on the card the following error message is displayed:

"failed to call service fan/set_speed. Service not found"

Button also does not display the correct fan speed
fan card

Formatting of lovelace config

The format of the data for lovelace is not correct.

Yours:

  • entity: fan.entity_id
    name: Fan Name
    type: 'custom:fan-xiaomi'

The right way:

entity: fan.entity_id
name: Fan Name
type: 'custom:fan-xiaomi'

thank for the great work

Update readme

Hello

Thanks for your great work! 👍
Just for information, the installation documentation is not up to date :

- url: /hacsfiles/lovelace-fan-xiaomi/fan-xiaomi.js
  type: module

to

- url: /hacsfiles/lovelace-fan-xiaomi/xiaomi-fan-card.js
  type: module

Handle case when no valid entity is set yet

When creating a new card using the default options without a valid entity_id specified, the card fails to render with errors in console.

Default options:

name: Xiaomi Fan
platform: default
entity: fan.fan
disable_animation: false
use_standard_speeds: true
force_sleep_mode_support: false
hide_led_button: false
type: custom:fan-xiaomi

Console:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'device_id')
    at FanXiaomi.configureAsync

Text colors are not good on a dark theme :-)

Hi Guys

Hey, this card is über cool, and I really like having it in the interface.
But the text color on the bottom isn't great with a dark theme:

image

Any hint on how to make this more legible?

2.0.0-rc2 za4 `default` platform compatibility issues

ZA4 seems to have issues with the default platform

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'state')
    at FanXiaomi.updateUI (fan-xiaomi.js?hacstag=2310157592002:565:64)
    at fan-xiaomi.js?hacstag=2310157592002:79:26

Early digging shows a probable issue with the led_brightness entity logic

Speed button has no effect right after fan is powered on via power button

Steps to reproduce:

  1. Load HA
  2. Tap on the power button in the middle of the fan
  3. Tap the speed button which does not respond

Speed does not increase nor does the button change number. The service is also not called as there is no error and the fan does not beep in acknowledgement of a command

device card disappears if device is offline

If the device is offline oder unplugged the card seems to disappear and with that the whole panel with all the elements where the card is configured. happens on latest version of hassio.
is it just me? for now i have it on a sparate panel since the fan has no battery status and you never know when it will dissappear.

dmaker.fan.p18 issue

Using my new: Mi Smart Standing Fan 2 | dmaker.fan.p18 | BPLDS02DM | AC, 15W, 30.2-55.8bBi... with xiaomi_miio_fan custom integration from hacs, i found these problems:

  • I can't operate with angle 140° (120 switch directly to 30). This fan support it by native app. (see picture)
  • 4 speeds have different position respects the 4 speeds in app, for example Speed 1 in card is just before speed 2 in app. (see picture)
  • Pressing "Natural" it correctly switch from direct to natural mode in the app, but i can't see te right status on the card (if natural is active or not and change it to direct mode again)
  • This device have the hide led option, I enabled it in the card but i can't see any button or status for it.
  • This device have the "sound on\off" switch, there is a way for have it in the card?

IMG_0BE880AEE22D-1

Schermata 2022-05-22 alle 21 07 46

thanks.

Timer not work dmaker.fan.p9

When I tap on timer button nothing happens. But in. Logs I see an error:
Logger: miio.miioprotocol
Source: /usr/local/lib/python3.9/site-packages/miio/miioprotocol.py:255
First occurred: 11:43:40 (1 occurrences)
Last logged: 11:43:40

Got error when receiving: {'code': -30001, 'message': 'Resp invalid json.'}

Home assistant 2022.5.5
Fan model: dmaker.fan.p9

Natural mode button not working (Smart Mi 2s)

I just updated to 2.1.0 and it seems that the natural mode is broken. If the natural mode is off i can turn it on via the card, but the status is not reflected (always off). Turning the natural mode off is not working at all.
Calling the service directly is working fine. There is no error visible in the logs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.