homeassistant
Posted _WILLPOWER_
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了homeassistant相关的知识,希望对你有一定的参考价值。
安装完了不是立马可以进入,而是要等系统安装一系列依赖等,还有就是addon可能也不会很快出来,最好保证网络通畅,让其更新.
supervisor添加第三方Home Assistant Community Add-ons
教程官网
在gitee上面创建一个同步仓库URL为https://github.com/hassio-addons/repository
然后
然后添加自己同步的gitee链接即可
Home Assistant Add-on: Terminal & SSH
安装完后,配置
authorized_keys: ["这里是你的公钥"]
apks: []
password: '这里是你的密码'
server:
tcp_forwarding: false
网络要设置一个端口才可以访问
如果没有设置密码PasswordAuthentication会设置为no,那么你就不能够使用密码验证登录会报错
ssh No supported authentication methods available (server sent:publickey,keyboard-interactive)
ESPHOME
在插入nodemcu后重新进入一下界面即可显示
显示组件
显示组件
SSD1306 OLED显示器
DHT温度+湿度传感器
esphome:
name: nodemcu
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "V10"
password: "13699689976"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Nodemcu Fallback Hotspot"
password: "0yKsM7vxVPKr"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "1152679377"
ota:
password: "1152679377"
switch:
- platform: gpio
name: "led"
id: led
pin: 16
inverted: yes
#初始化为off
restore_mode: ALWAYS_OFF
i2c:
sda: D2
scl: D1
sensor:
- platform: dht
pin: D7
temperature:
name: "Living Room Temperature"
id: temperature1
humidity:
id: humidity1
name: "Living Room Humidity"
update_interval: 10s
model: DHT11
font:
- file: "fonts/SIMYOU.ttf"
id: my_font
size: 12
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
lambda: |-
it.print(0, 0, id(my_font), "WillPower:");
it.printf(0, 15, id(my_font), "Temp: %.1f°C", id(temperature1).state);
it.printf(0, 30, id(my_font), "Humidity: %.1f%%", id(humidity1).state);
if (id(led).state) {
it.print(0, 45, id(my_font), "state: ON");
}
else {
it.print(0, 45, id(my_font), "state: OFF");
}
PWM调光
output:
- platform: esp8266_pwm
pin: D0
frequency: 1000 Hz
id: pwm_output
inverted: yes
fan:
- platform: speed
output: pwm_output
name: "Living Room Fan"
ESP32相机组件
显示时间
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
lambda: |-
it.strftime(0, 0, id(my_font1), "%H:%M:%S", id(homeassistant_time).now());
显示温度等各种参数
sensor:
# Minimal configuration of the standard time and date sensor
- platform: time_date
display_options:
- 'date_time_iso'
- 'time'
# Build on the standard sensor to produce one that can be customized
- platform: template
sensors:
time_formatted:
friendly_name: "Date and time"
value_template: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A %B-%d %H:%M:%S') }}"
icon_template: mdi:calendar-clock
# 平台名,不用多说
- platform: command_line
name: CPU Temperature
# 用于获取温度数据的命令
command: "cat /sys/class/thermal/thermal_zone0/temp"
#传感器数据的单位
unit_of_measurement: "°C"
# 若未定义模板,则直接将 command 传回的数据作为传感器的值。
value_template: '{{ value | multiply(0.001) | round(1) }}'
#(可选)更新间隔,默认为 60s
scan_interval: 20
#(可选)命令执行超时设置,默认为 15s
command_timeout: 15
使用树莓派自带摄像头
usermod -a -G video hass
将用户加入摄像头的使用组中,然后重启
Raspberry Pi Camera
安装hacs
github链接
在上述链接下载最新的hacs.zip
然后在Homeassistant的根目录新建custom_components
和www
两个文件夹,再在custom_components
文件夹中新建hacs文件夹
,将下载的hacs.zip解压到hacs
文件夹中,然后重启homeassistant,然后在集成中搜索hacs安装
然后
打开这个网址,将其中的key填入重启即可
以上是关于homeassistant的主要内容,如果未能解决你的问题,请参考以下文章