deepin20安装homeassistant,并添加米家台灯,米家空调伴侣
Tofloor
poster avatar
houyawei
deepin
2020-05-16 16:41
Author
本帖最后由 houyawei 于 2020-5-16 08:44 编辑

最终目的是用树莓派上的wukong-robot控制一些智能家具,在这里记录一下。


1.安装homeassistant(venv (as another user)),进入官网选择alternative installation methods

链接在此:https://www.home-assistant.io/docs/installation/raspberry-pi/
  1. sudo apt-get update
  2. sudo apt-get upgrade -y
  3. sudo apt-get install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev autoconf
Copy the Code
  1. sudo useradd -rm homeassistant -G dialout,gpio,i2c
Copy the Code
  1. cd /srv
  2. sudo mkdir homeassistant
  3. sudo chown homeassistant:homeassistant homeassistant
Copy the Code
  1. sudo -u homeassistant -H -s
  2. cd /srv/homeassistant
  3. python3 -m venv .
  4. source bin/activate
Copy the Code
  1. python3 -m pip install wheel
  2. pip3 install homeassistant
  3. hass
Copy the Code
往用户组里面添加提示错误,忽略即可,那个是树莓派里面的用户组



2.homeassistant添加米家台灯一代
  • 查看米家台灯一代型号:MJTD01YL
   

   


  • 在homeassistant配置文件目录修改configuration.yaml,(我在deepin20上测试的,目录在/home/用户名/.homeassistant/configuration.yaml,注意  点homeassiatant  是个隐藏文件夹)添加下面内容。
    1. yeelight:
    2.      devices:
    3.          192.168.0.xxx:
    4.              name: Living Room
    5.              model: lamp1           #ram容量小无法自动发现,必须标注
    6.              use_music_mode: true
    7.              save_on_change: true
    8.              #注意缩进
    Copy the Code
  • 下载yeelight app,打开局域网控制




  • 重启homeassistant即可






3.添加米家空调伴侣

  1. 前提条件:
  2.     Home Assistant version 0.98.0 or newer
  3.     A GitHub account
  4.     Access to the filesystem where Home Assistant is located
  5.     You know how to access the Home Assistant log file
  6.     A stable internet connection with sufficient avaliable data or no data caps
Copy the Code
  1. 支持下面几款空调伴侣:

  2.    Model ID                    Model number               Product name                                        Shape

  3.   acpartner.v1               KTBL01LM                  Aqara Air Conditioning                              Companion          square
  4.   acaprtner.v2               KTBL02LM                 Xiaomi Mi Air Conditioner Companion          round
  5.   acpartner.v3                KTBL11LM               Aqara Air Conditioning Companion               square
Copy the Code



  • 下面来说说我遇到的问题,我是在deepin 20内使用普通方法安装的,python虚拟环境venv(as another user)
1)使用当前用户把hacs压缩包放置好后,并没有成功加载出来。怀疑是权限问题,之后使用homeassistant用户cp加载成功
https://hacs.xyz/docs/configuration/basic
  1. sudo -u homeassistant -H -s
  2. source /srv/homeassistant/bin/activate
  3. cp -r /home/homeassistant/.homeassistant/custom_components
Copy the Code
2)商店插件成功导入,无法安装自定义插件,顶部提示 can not connect api.github.com(记不太清了)之类的,无论有没有科学的网络都有此提示,后来百度了一下这个域名,应该是域名被污染了,在hosts自定义ip解析后成功安装插件。
3)获取token,我使用的是旧版本米家,局域网内所有设备token都在一个log内,很方便获取。
https://www.apkmirror.com/apk/xiaomi-inc/mihome/mihome-5-4-49-release/mi-home-5-4-49-android-apk-download/
      日志在Smarthome/logs,或是smarthome/plugs/logs.



4.使用树莓派上的悟空机器人控制homeassistant

这个部分悟空上的hass插件部分写的很清楚,不过我只会模仿开关,用悟空语音控制空调,台灯的开关。
链接:https://wukong.hahack.com/#/contrib?id=hass



Reply Favorite View the author
All Replies
avatar
走钢丝
deepin
2020-05-16 17:08
#1
看起来挺专业,支持一下。
Reply View the author
avatar
1***t@osxofulk.com
deepin
2025-06-24 06:00
#2

If the callback queue is not empty, the event loop selects the first callback and pushes it onto the call stack for execution. doramas wow

Reply View the author