Code Monkey home page Code Monkey logo

Comments (9)

iquix avatar iquix commented on September 3, 2024 1

Finally I successfully can control my P11 fan.

I found out that urn:miot-spec-v2:property:status:00000007:dmaker-p11:1, which is "siid":2,"piid":6 is speed 0~100.

So I modified fan_miot.py line 92 to
speed=PropertyAdapter("fan", "status")

and after that, without modifying the custom_component, everything works fine.

Thank you so much.

from hass-config-milo.

swim2sun avatar swim2sun commented on September 3, 2024

Hi @xrays72, this repo is my home assistant configuration, it's not a hass.io component.

Do you want integrate xiaomi_fan? If yes, the steps are like this:

You need do this on the machine where you installed your home assistant.

  1. Clone this repo (star this repo is better 😄)
  2. Uninstall the python-miio which installed by HA.
pip uninstall python-miio
  1. Install the python-miio provided by this repo
pip install libs/python_miio-0.5.3-py3-none-any.whl
  1. Copy the custom_components/xiaomi_miio_fan to your custom_components.
cp custom_components/xiaomi_miio_fan path/to/your/custom_components
  1. Add xiaomi_fan configuration to your configuration.yaml
fan:
  - platform: xiaomi_miio_fan
    name: xiaomi_fan
    host: 192.168.xx.xx
    token: xxxxxxxxxxxxxxx

Good luck!

from hass-config-milo.

iquix avatar iquix commented on September 3, 2024

Thank you very much for your HA custom_component and pull request into python-miio for miot fan.

Is it possible to add support for dmaker-p11 fan?
http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:fan:0000A005:dmaker-p11:1

from hass-config-milo.

swim2sun avatar swim2sun commented on September 3, 2024

@iquix Looks like the spec is similar to p9/p10, I can have a try when I have time

from hass-config-milo.

iquix avatar iquix commented on September 3, 2024

@swim2sun Thank you so much!

from hass-config-milo.

swim2sun avatar swim2sun commented on September 3, 2024

Hi, @iquix , I updated libs/python_miio-0.5.3-py3-none-any.whl and custom_components/xiaomi_miio_fan for supporting p11, could you help to test it?

from hass-config-milo.

iquix avatar iquix commented on September 3, 2024

@swim2sun
Thank you so much for your effort.

I tried to install this but I failed.

I'm using homeassistant with docker image homeassistant/raspberrypi3-homeassistant:stable, which is HA version 0.116.4
But when I try to install the miio whl with pip in the docker container, it gives me dependency error for 'cryptography'.

In homeassistant/raspberrypi3-homeassistant:stable docker image, python cryptography 2.9.2 is installed, but in the whl file, it requires python cryptography version >3.0.
So pip automatically tries to install cryptography 3.x version, but there's no gcc installed in the docker image, so it fails to install using pip.

I need to install gcc in the docker container to install cryptography 3.x, but its such a hard work, because HA docker image is a lightweight image, and it contains merely nothing.

I'll give it a try later, when I find out how to install python cryptography version >3.0 in docker container.

Anyway, thank you so much for your effort.

from hass-config-milo.

iquix avatar iquix commented on September 3, 2024

I just changed dependency settings in the whl file to allow python cryptography 2.9.2, and installation was successful.

However, I cannot set the fan speed "level" , nor speed "level" is always fixed to "Level 1" . The reason is as follow.
This model does not have 0~100 level in the miot spec, so in the python-miio library fan_miot.py, it is defined as
speed=PropertyAdapter("fan", "fan-level"), which is in the range 1 to 4

But in the custom_component, line 579 in the fan.py
if speed in FAN_SPEED_VALUES:
speed = FAN_SPEED_VALUES[speed]

This part makes speed always "Level 1", because 'speed' is always in the range 1 to 4, and FAN_SPEED_VALUES is defined as
FAN_SPEED_VALUES = {
SPEED_OFF: 0,
FAN_SPEED_LEVEL1: 1,
FAN_SPEED_LEVEL2: 35,
FAN_SPEED_LEVEL3: 74,
FAN_SPEED_LEVEL4: 100,
}

Therefor, codes that uses FAN_SPEED_VALUES, as well as codes with FAN_SPEED_LIST needs to be fixed in the custom_compoent, since speed=PropertyAdapter("fan", "fan-level").

Again, thank you so much.

from hass-config-milo.

swim2sun avatar swim2sun commented on September 3, 2024

@iquix sry for the late reply. I'm glad that the component can work.

I'll fix the bug of setting speed, thx for your feedback.

from hass-config-milo.

Related Issues (2)

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.