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

Add dmaker.fan.1c support #62

Closed
richahl opened this issue Jun 4, 2020 · 30 comments
Closed

Add dmaker.fan.1c support #62

richahl opened this issue Jun 4, 2020 · 30 comments

Comments

@richahl
Copy link

richahl commented Jun 4, 2020

I can't get the new Xiaomi Mi Smart Standing Fan 1C to work with current config and haven't been able to get properties from it yet.

mirobo --ip 192.168.1.23 --token e2300f54d47ec358XXf6586a8f92d6e7 raw-command get_prop "['$PROP']"
Sending cmd get_prop with params ['']
Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip 192.168.1.23 --token e2300f54d47ec358XXf6586a8f92d6e7 info
Model: dmaker.fan.1c
Hardware version: esp8266
Firmware version: 2.0.4

@frickmaister
Copy link

@richahl Did you manage to fix it?

@richahl
Copy link
Author

richahl commented Jun 17, 2020

@richahl Did you manage to fix it?

No not yet, I'm looking into if I can use mqtt instead like this https://github.com/roth-m/mqttmiot-airpurifier3

Update: I've now managed to control the fan by using mqtt and a modified version of the script I mentioned.

@HELEMAALNIKS
Copy link

HELEMAALNIKS commented Jun 24, 2020

Hi, I've been also wanting to buy a 1C fan. Could you please share your modified script so that I can use it in Home Assistant?

@jelmerkk
Copy link

Same here, can't make it work with the 1C that I just bought.

@richahl
Copy link
Author

richahl commented Jun 25, 2020

I have uploaded the script here: https://github.com/richahl/mqttmiot-dmaker1c I then use the MQTT Fan device in Home Assistant to control it.

@dok0001
Copy link

dok0001 commented Jun 30, 2020

I have uploaded the script here: https://github.com/richahl/mqttmiot-dmaker1c I then use the MQTT Fan device in Home Assistant to control it.

how is this setup in your configuration.yaml ?

@richahl
Copy link
Author

richahl commented Jul 1, 2020

I have uploaded the script here: https://github.com/richahl/mqttmiot-dmaker1c I then use the MQTT Fan device in Home Assistant to control it.

how is this setup in your configuration.yaml ?

My setup is below

  • platform: mqtt
    name: "Xiaomi Smart Fan"
    state_topic: "mifanpower/state"
    command_topic: "mifanpower"
    oscillation_state_topic: "mifanrotate/state"
    oscillation_command_topic: "mifanrotate"
    speed_state_topic: "mifanfanspeed/state"
    speed_command_topic: "mifanfanspeed"
    qos: 0
    payload_on: "ON"
    payload_off: "OFF"
    payload_oscillation_on: "ON"
    payload_oscillation_off: "OFF"
    payload_low_speed: "LOW"
    payload_medium_speed: "MEDIUM"
    payload_high_speed: "HIGH"
    speeds:
    • low
    • medium
    • high

@daggr8
Copy link

daggr8 commented Aug 5, 2020

Any other solution than having to setup mqtt?

@bfbones
Copy link

bfbones commented Aug 10, 2020

Any updates on this?
Would appreciate it, if we can use this custom component together with https://github.com/ikaruswill/lovelace-fan-xiaomi also for the 1C.

@nervous-inhuman
Copy link

nervous-inhuman commented Aug 10, 2020

It seems like support for 1C has been added to a Homebridge plugin for integrating Xiaomi Fan devices.
https://github.com/merdok/homebridge-xiaomi-fan/blob/7719bfb511849eb6dfc9567dcc0f1530c58932a4/devices/miot/miotDmakerAcFan.js#L9

I suppose it could help with adding 1C support to python-miio/xiaomi_fan.

Also, thanks for the link to the lovely custom component, @bfbones. I was looking for something like it.

@Rikkie80
Copy link

Rikkie80 commented Aug 12, 2020

@richahl

Probably a noob question, but how to get the script running? I added it to my python_scripts folder in Custom_components but that seems not to work...

I changed the variables in the script, but doubt if it's correct...

mqtt_username="myun"
mqtt_password="mypw"
mqtt_prefix="mifan/"        <-- can be anything, right?
mqtt_broker="192.168.1.yyy" <-- without port (1883)?
miot_broker="192.168.1.yyy" <-- ip of my fan
miot_port=54321             <-- ok?
miot_len_max=1480
miot_did=u"123456789";      <-- should the 'u' be there?
miot_token="32-digit number";

@richahl
Copy link
Author

richahl commented Aug 14, 2020

@richahl

Probably a noob question, but how to get the script running? I added it to my python_scripts folder in Custom_components but that seems not to work...

I changed the variables in the script, but doubt if it's correct...

mqtt_username="myun"
mqtt_password="mypw"
mqtt_prefix="mifan/"        <-- can be anything, right?
mqtt_broker="192.168.1.yyy" <-- without port (1883)?
miot_broker="192.168.1.yyy" <-- ip of my fan
miot_port=54321             <-- ok?
miot_len_max=1480
miot_did=u"123456789";      <-- should the 'u' be there?
miot_token="32-digit number";

Your settings seems correct, what happens when you run the script, any error messages?

@ststrell
Copy link

Probably another noob question:
How exactly do you guys run the script? I did not do that in home assistant before, I had a quick look yesterday, but could not get it to work... Would be glad if someone could give me a brief introduction.
Thanks!

@BrendanxP
Copy link

Same for me! I'm also interested in more detailed steps to get the script running.

@Rikkie80
Copy link

Rikkie80 commented Aug 14, 2020

@richahl
Probably a noob question, but how to get the script running? I added it to my python_scripts folder in Custom_components but that seems not to work...
I changed the variables in the script, but doubt if it's correct...

mqtt_username="myun"
mqtt_password="mypw"
mqtt_prefix="mifan/"        <-- can be anything, right?
mqtt_broker="192.168.1.yyy" <-- without port (1883)?
miot_broker="192.168.1.yyy" <-- ip of my fan
miot_port=54321             <-- ok?
miot_len_max=1480
miot_did=u"123456789";      <-- should the 'u' be there?
miot_token="32-digit number";

Your settings seems correct, what happens when you run the script, any error messages?

2020-08-14 10:58:14 ERROR (SyncWorker_4) [homeassistant.components.python_script.mqttmiot.py] Error executing script: import not found
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "mqttmiot.py", line 1, in
ImportError: import not found

Edit:
Ok, clearly a restriction of the python_script integration, but now I'm stuck in how to proceed... AppDeamon, Command line script?

Edit2:
Got a bit further by using SSH... No I get stuck in this:

connecting to broker  192.168.1.xxx
Something in the queue
Sending: get_properties - [{'did': '123456789', 'siid': 2, 'piid': 7}]
Got error when receiving: timed out
No valid reply! Bad request?
Something in the queue
Sending: get_properties - [{'did': '123456789', 'siid': 2, 'piid': 2}]
Got error when receiving: timed out
No valid reply! Bad request?
Something in the queue
Sending: get_properties - [{'did': '123456789', 'siid': 2, 'piid': 11}]
Got error when receiving: timed out
No valid reply! Bad request?
Something in the queue
Sending: get_properties - [{'did': '123456789', 'siid': 2, 'piid': 1}]
No valid reply! Bad request?
Something in the queue
Sending: get_properties - [{'did': '123456789', 'siid': 2, 'piid': 3}]
Got error when receiving: timed out
No valid reply! Bad request?

Edit3:
never mind... token changed due to a reset and forgot to update it in the configuration :)

@damianpasek
Copy link

If someone would be interested, I've created for myself a fork repo and I've added support for 1C fan - https://github.com/damianpasek/xiaomi_fan. You can just copy content of custom_components folder and it should be working. I was not testing everything yet so you are installing it on your own risk but for me it seems to be working fine (or at least features which I'm using).

When everything will be working fine I can prepare pull requests to python-miio library and to this repo to officially add support for this fan 🙂

@BrendanxP
Copy link

BrendanxP commented Aug 17, 2020 via email

@jelmerkk
Copy link

Hard to troubleshoot, I don't get any sensors. In the logging I see a lot of "empty" stuff:
today at 11:44 AM 2020-08-18 11:44:54 DEBUG (MainThread) [miio.miioprotocol] 192.168.1.247:54321 >>: {'id': 203, 'method': 'miIO.info', 'params': []} today at 11:44 AM 2020-08-18 11:44:59 DEBUG (MainThread) [miio.miioprotocol] Retrying with incremented id, retries left: 1 today at 11:44 AM 2020-08-18 11:44:59 DEBUG (MainThread) [miio.miioprotocol] Got a response: Container: today at 11:44 AM data = Container: today at 11:44 AM data = b'' (total 0) today at 11:44 AM value = b'' (total 0) today at 11:44 AM offset1 = 32 today at 11:44 AM offset2 = 32 today at 11:44 AM length = 0 today at 11:44 AM header = Container: today at 11:44 AM data = b'!1\x00 \x00\x00\x00\x00\x0ea\xf7\xfa\x00\x00\x0e3' (total 16) today at 11:44 AM value = Container: today at 11:44 AM length = 32 today at 11:44 AM unknown = 0 today at 11:44 AM device_id = b'\x0ea\xf7\xfa' (total 4) today at 11:44 AM ts = 1970-01-01 01:00:35 today at 11:44 AM offset1 = 0 today at 11:44 AM offset2 = 16 today at 11:44 AM length = 16 today at 11:44 AM checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16) today at 11:44 AM 2020-08-18 11:44:59 DEBUG (MainThread) [miio.miioprotocol] Discovered 0e61f7fa with ts: 1970-01-01 01:00:35, token:

And the main HA log reports that the component is not ready:
[homeassistant.components.fan] Setup of fan platform xiaomi_miio_fan is taking over 10 seconds. today at 11:45 AM 2020-08-18 11:45:04 WARNING (MainThread) [homeassistant.components.fan] Platform xiaomi_miio_fan not ready yet. Retrying in 120 seconds.

@mhorsselenberg
Copy link

If someone would be interested, I've created for myself a fork repo and I've added support for 1C fan - https://github.com/damianpasek/xiaomi_fan. You can just copy content of custom_components folder and it should be working. I was not testing everything yet so you are installing it on your own risk but for me it seems to be working fine (or at least features which I'm using).

When everything will be working fine I can prepare pull requests to python-miio library and to this repo to officially add support for this fan 🙂

Works great! Thank you 👍

@daggr8
Copy link

daggr8 commented Aug 21, 2020

If someone would be interested, I've created for myself a fork repo and I've added support for 1C fan - https://github.com/damianpasek/xiaomi_fan. You can just copy content of custom_components folder and it should be working. I was not testing everything yet so you are installing it on your own risk but for me it seems to be working fine (or at least features which I'm using).

When everything will be working fine I can prepare pull requests to python-miio library and to this repo to officially add support for this fan 🙂

Great job! Works perfectly!

@asifma
Copy link

asifma commented Aug 27, 2020

If someone would be interested, I've created for myself a fork repo and I've added support for 1C fan - https://github.com/damianpasek/xiaomi_fan. You can just copy content of custom_components folder and it should be working. I was not testing everything yet so you are installing it on your own risk but for me it seems to be working fine (or at least features which I'm using).

When everything will be working fine I can prepare pull requests to python-miio library and to this repo to officially add support for this fan 🙂

Great work!!
For those of you who bought a Mi Fan 1C (Europe version), but are using other gadgets in Mi Home with (Mainland China) and cant find your fan in the app.
This is what i followed to get the token: https://community.home-assistant.io/t/guide-to-retrieve-xiaomi-roborock-and-other-tokens/120174%20@

@asifma
Copy link

asifma commented Aug 28, 2020

Okey, Now its final. With GUI and all :D. Thank you once again!

image

@D4NH
Copy link

D4NH commented Sep 16, 2020

@asifma can you share all your scripts/settings with us? thanks!

@syssi syssi changed the title Support device model dmaker.fan.1c Add dmaker.fan.1c support Oct 18, 2020
@syssi
Copy link
Owner

syssi commented Apr 19, 2021

@olskar I would be happy if you could handle issues of the fork at the fork? :-P

@matteos1
Copy link

If someone would be interested, I've created for myself a fork repo and I've added support for 1C fan - https://github.com/damianpasek/xiaomi_fan. You can just copy content of custom_components folder and it should be working. I was not testing everything yet so you are installing it on your own risk but for me it seems to be working fine (or at least features which I'm using).

When everything will be working fine I can prepare pull requests to python-miio library and to this repo to officially add support for this fan 🙂

not work anymore

@mohannadalsharief
Copy link

@matteos1 I got No 'version' key in the manifest file for custom integration 'xiaomi_miio_fan'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'xiaomi_miio_fan'

can you please fix

@JeroLajHub
Copy link

If I am not wrong, it should be coming soon 👍 rytilahti/python-miio#1012

@vmax77
Copy link

vmax77 commented May 6, 2021

I would hope so too

@aperture1988
Copy link

@matteos1 I got No 'version' key in the manifest file for custom integration 'xiaomi_miio_fan'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'xiaomi_miio_fan'

can you please fix

I am also receiving this error in my log file... please help

@syssi
Copy link
Owner

syssi commented May 6, 2021

I've merged the dmaker.fan.1c support but a bugfix release of Home Assistat containing python-miio==0.5.6 is required. I assume it will be part of HA core 2021.5.1.

@syssi syssi closed this as completed May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests