本帖最后由 johnchenme 于 2020-5-9 11:14 编辑
因为小米净水器厨上版没有显示tds数值的功能,所以想自己用esp8266做一个。小米净水器已经接入ha了,tds显示数值的实体为senor.filtered_water,,根据论坛和官方的文档,代码如下:屏幕能正常显示,但就是读不到ha里面senor.filtered_water的数据,希望大家一起帮忙找找原因:
esphome:
name: oled
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "SSID"
password: "PASSWORD"
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "admin"
ota:
password: "admin"
time:
- platform: homeassistant
timezone: Asia/Shanghai
id: time1
i2c:
sda: 05
scl: 04
scan: False
font:
- file: 'ziti.ttf'
id: font1
size: 18
glyphs: 信息余额温度湿时间电费水卡室内状态元显示器!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
id: my_display
pages:
- id: page1
lambda: |-
it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "信息");
if (id(tds).has_state()) {
it.printf(0, 20, id(font1), TextAlign::TOP_LEFT, "tds: %.1f", id(tds).state);
}
sensor:
- platform: homeassistant
id: tds
entity_id: sensor.filtered_water
internal: true
|