顯示具有 home assistant 標籤的文章。 顯示所有文章
顯示具有 home assistant 標籤的文章。 顯示所有文章

2020/02/20

安裝 HACS 和移除

HACS - Home Assistant Comunity Store

裡面收藏了一些好用的套件,除了可以方便安裝以外,也可追蹤所使用的套件是否有更新。
以下是安裝步驟:

  1. HACS 下載最新版本
  2. 建立目錄 hacs,並將檔案解壓縮至此目錄,確認 hacs 目錄裡面包含隱藏目錄 .translations 。如果沒有則重新下載再解壓縮一次。
  3. 在 config 目錄底下建立 custom_components 目錄,如果已經存在則省略。
  4. 將 hacs 目錄搬移至 custom_components 目錄底下。
  5. 重啟 hassio。
  6. 建立 Github Personal Access Token,可參考此篇
  7. 進去 Home assistant,然後去 Configuration -> Integrations,點擊右下角 +,搜尋 HACS。然後選擇出現的項目。
  8. 貼上步驟 6 的 Token 按確定。如果要重新設定則必須先從 integrations 移除後重新加入。
  9. 如果要手動加入,則在 configuration.yaml 加入以下資料。token 請使用步驟 6 建立的部份。

    hacs:
      token: github_token
    
  10. 重啟 hassio。這樣就會看到側邊有 HACS,安裝就完成了。

參考連結: https://hacs.xyz/docs/installation/manual

如果要移除 HACS 則依照下面步驟。

  1. 從 configuration.yaml 把 hacs 移除。
  2. 去 Configuration -> Integrations 點進去 HACS 然後點擊右上角垃圾桶圖示移除。
  3. 重啟 Hassio 兩次。
  4. 移除 custom_components 底下的 hacs 目錄。
  5. 在 config 底下的 .storage,把關於 hacs 相關資料都移除。
  6. 重啟 Hassio。

參考連結: https://hacs.xyz/docs/installation/remove

2020/02/11

Configurator Add-On

安裝 configurator,這個方便可以直接線上修改相關的設定。
安裝方式很簡單,依照下面步驟:
1. Supervisor -> ADD-ON Store
2. Search 輸入 Configurator
3. 點擊 Configurator,再點擊 INSTALL
4. 安裝完畢,勾選 Show in sidebar,這樣左側選單就會出現 Configurator 快捷按鈕
5. 點擊 START

這樣就安裝完畢了。
建議安裝完 Hass.io 後可以先安裝這個插件。

2020/01/16

Using nmap to do presence-detection

Based on these two posts.
- https://www.home-assistant.io/integrations/nmap_tracker/
- https://www.home-assistant.io/integrations/person/

1. add these lines to configuration.yaml
device_tracker:
  - platform: nmap_tracker
    # global config
    interval_seconds: 15
    consider_home: 180
    new_device_defaults:
      track_new_devices: false
      hide_if_away: false
    # config for nmap_tracker
    hosts: # network address to scan
      - 192.168.1.1/24
    home_interval: 10 # if it is home, not scan this device at least 10 mins
    exclude: # not to scan this device
      - 192.168.1.1
2. restart hass.io
3. check known_devices.yaml in Configurator, this file will be auto generated.
original:
11_22_33_44_55_66:
  hide_if_away: false
  icon:
  mac: 11:22:33:44:55:66
  name: 11 22 33 44 55 66
  picture:
  track: false

22_22_33_44_55_66:
  hide_if_away: false
  icon:
  mac: 22:22:33:44:55:66
  name: 22 22 33 44 55 66
  picture:
  track: false

updated:
me:
  hide_if_away: false
  icon:
  mac: 11:22:33:44:55:66
  name: me
  picture:
  track: true

her:
  hide_if_away: false
  icon:
  mac: 22:22:33:44:55:66
  name: her
  picture:
  track: true
4. go Configuration -> Persons, Click on the account, and select Track Device, in this case, choose device_tracker.me
5. If someone doesn't have the account in hass.io, go to Configurator and edit configuration.yaml.
Add these lines and then restart hass.io
person:
  - name: Her
    id: her1224 # this must be unique.
    device_trackers:
      - device_tracker.her
6. go Configuration -> Persons to check if add successfully.

2020/01/15

How to clean reinstall hassio ?

1. stop services
systemctl stop hassio-supervisor.service
systemctl stop hassio-apparmor.service

2. stop docker container
docker ps #list containers
docker container stop @containerid # remove @containerid with image name start with homeassistant
docker container prune # remove all stopped containers

3. remove docker images
docker images # list all images
docker image remove @imagename # remove @imangename start with homeassistant

4. remove data when install hassio.
# if you install like this 'hassio_install.sh -m raspberrypi3 -d /share/ha_data', remove all data in /share/ha_data
rm -rf /share/ha_data
rm -f /etc/systemd/system/hassio-*