Skip to content

Commit 58d2aec

Browse files
committed
fix name issue
HA integration
1 parent aab5452 commit 58d2aec

16 files changed

+82
-84
lines changed

Pipfile

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,4 @@ verify_ssl = true
77

88
[packages]
99
esphome = "*"
10-
#voluptuous = "==0.11.5"
11-
#tornado = "*"
12-
#esptool = "*"
13-
#pillow = "*"
14-
#pillow = "*"
10+
#pillow = "<10.0.0"

Pipfile.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

automations/air_quality.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ then:
33
- switch.turn_on: pms_set
44
- delay: 45s
55
- lambda: !lambda |-
6-
id(mqtt_client).publish_json("domoticz/in", [=](JsonObject &root) {
6+
id(mqtt_client).publish_json("domoticz/in", [=](JsonObject root) {
77
root["command"] = "udevice";
88
root["idx"] = ${domoticz_device_id_2};
99
root["nvalue"] = 0;
1010
root["svalue"] = String(id(${devicename}_${location_id}_pm_2_5).state);
1111
});
12-
id(mqtt_client).publish_json("domoticz/in", [=](JsonObject &root) {
12+
id(mqtt_client).publish_json("domoticz/in", [=](JsonObject root) {
1313
root["command"] = "udevice";
1414
root["idx"] = ${domoticz_device_id_3};
1515
root["nvalue"] = 0;

automations/thermometer.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interval: 60s
22
then:
33
- lambda: !lambda |-
4-
id(mqtt_client).publish_json("domoticz/in", [=](JsonObject &root) {
4+
id(mqtt_client).publish_json("domoticz/in", [=](JsonObject root) {
55
root["command"] = "udevice";
66
root["idx"] = ${domoticz_device_id};
77
root["nvalue"] = 0;

bluetooth-gateway.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
substitutions:
2+
devicename: bluetooth_gateway
3+
location_id: livingroom
4+
15
esphome:
26
name: bluetooth-gateway
37
platform: ESP32

pc-switch.yaml

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
substitutions:
22
devicename: powerswitch
3-
location_id: nas
4-
location_name: NAS机箱
3+
location_id: nas_case
54
domoticz_device_id: "184"
6-
name: NAS
75

86
esphome:
97
name: $devicename
@@ -61,15 +59,16 @@ switch:
6159
- platform: gpio
6260
pin: D7
6361
id: reset_switch
62+
name: "Reset"
6463
on_turn_on:
6564
- delay: 300ms
6665
- switch.turn_off: reset_switch
6766

6867
binary_sensor:
6968
- platform: gpio
7069
pin: D0
71-
id: ${name}_power_sensor
72-
name: "${name} Power State"
70+
id: nas_power_sensor
71+
name: "NAS Power State"
7372
device_class: power
7473
icon: "mdi:desktop-classic"
7574

@@ -78,10 +77,8 @@ sensor:
7877
pin: D3
7978
model: DHT11
8079
temperature:
81-
name: "${location_name}温度 (DHT)"
8280
id: "${devicename}_${location_id}_temp"
8381
humidity:
84-
name: "${location_name}湿度"
8582
id: "${devicename}_${location_id}_hum"
8683
update_interval: 60s
8784

@@ -101,8 +98,8 @@ interval:
10198
payload: |-
10299
root["command"] = "udevice";
103100
root["idx"] = 186;
104-
root["nvalue"] = int(id(${name}_power_sensor).state);
105-
if (id(${name}_power_sensor).state) {
101+
root["nvalue"] = int(id(nas_power_sensor).state);
102+
if (id(nas_power_sensor).state) {
106103
root["svalue"] = "ON";
107104
} else {
108105
root["svalue"] = "OFF";

sensors/bme280.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
platform: bme280
22
temperature:
3-
name: "${location_name}温度"
3+
name: "${location_name} Temperature"
44
id: "${devicename}_${location_id}_temp"
55
oversampling: 16x
66
accuracy_decimals: 1
77
pressure:
8-
name: "${location_name}气压"
8+
name: "${location_name} Pressure"
99
id: "${devicename}_${location_id}_bar"
1010
humidity:
11-
name: "${location_name}湿度"
11+
name: "${location_name} Humidity"
1212
id: "${devicename}_${location_id}_hum"
1313
address: 0x76
1414
update_interval: 15s

sensors/bmp280.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
platform: bmp280
22
temperature:
3-
name: "${location_name}温度"
3+
name: "${location_name} Temperature"
44
id: "${devicename}_${location_id}_temp"
55
oversampling: 16x
66
accuracy_decimals: 1
77
pressure:
8-
name: "${location_name}气压"
8+
name: "${location_name} Pressure"
99
id: "${devicename}_${location_id}_bar"
1010
address: 0x76
1111
update_interval: 15s

sensors/dht11.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ platform: dht
22
pin: D3
33
model: DHT11
44
temperature:
5-
name: "${location_name}温度 (DHT)"
6-
internal: True
5+
name: "${location_name} Temperature (DHT)"
6+
internal: true
77
humidity:
8-
name: "${location_name}湿度"
8+
name: "${location_name} Humidity"
99
id: "${devicename}_${location_id}_hum"
1010
update_interval: 15s

sensors/hum_stat_template.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
platform: template
22
id: "${devicename}_${location_id}_hum_stat"
3-
internal: True
3+
internal: true
44
accuracy_decimals: 0
55
lambda: |-
66
float hum = id(${devicename}_${location_id}_hum).state;

sensors/pms5003.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
platform: pmsx003
22
type: PMSX003
33
pm_2_5:
4-
name: "${location_name} PM2.5 浓度"
4+
name: "${location_name} PM2.5"
55
id: "${devicename}_${location_id}_pm_2_5"
66
pm_10_0:
7-
name: "${location_name} PM10 浓度"
7+
name: "${location_name} PM10"
88
id: "${devicename}_${location_id}_pm_10_0"

weatherstation/bme280.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
sensor:
22
- platform: bme280
33
temperature:
4-
name: "${location_name}温度"
4+
name: "${location_name} Tempearture"
55
id: "${devicename}_${location_id}_temp"
66
oversampling: 16x
77
accuracy_decimals: 1
88
pressure:
9-
name: "${location_name}气压"
9+
name: "${location_name} Pressure"
1010
id: "${devicename}_${location_id}_bar"
1111
humidity:
12-
name: "${location_name}湿度"
12+
name: "${location_name} Humidity"
1313
id: "${devicename}_${location_id}_hum"
1414
address: 0x76
1515
update_interval: 15s

weatherstation/bmp280_dht11.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
sensor:
22
- platform: bmp280
33
temperature:
4-
name: "${location_name}温度"
4+
name: "${location_name} Temperature"
55
id: "${devicename}_${location_id}_temp"
66
oversampling: 16x
77
accuracy_decimals: 1
88
pressure:
9-
name: "${location_name}气压"
9+
name: "${location_name} Pressure"
1010
id: "${devicename}_${location_id}_bar"
1111
address: 0x76
1212
update_interval: 15s
1313
- platform: dht
1414
pin: D3
1515
model: DHT11
1616
temperature:
17-
name: "${location_name}温度 (DHT)"
17+
name: "${location_name} Temperature (DHT)"
1818
internal: True
1919
humidity:
20-
name: "${location_name}湿度"
20+
name: "${location_name} Humidity"
2121
id: "${devicename}_${location_id}_hum"
2222
update_interval: 15s
2323
- platform: template

weatherstation_gongzuojian.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
substitutions:
22
devicename: weatherstation
33
location_id: gongzuojian
4-
location_name: 工作间
4+
location_name: Gong Zuo Jian
55
domoticz_device_id: "92"
66

77
<<: !include weatherstation/base.yaml

weatherstation_livingroom.yaml

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
substitutions:
22
devicename: weatherstation
33
location_id: livingroom
4-
location_name: 客厅
4+
location_name: Living Room
55
domoticz_device_id: "95"
66

77
<<: !include weatherstation/base.yaml
88

99
sensor: !include_dir_list weatherstation/living_room/sensors/
1010
interval: !include_dir_list weatherstation/living_room/automations/
1111

12-
time:
13-
- platform: sntp
14-
id: sntp_time
15-
timezone: Asia/Shanghai
16-
17-
font:
18-
- file: 'fonts/slkscr.ttf'
19-
id: font1
20-
size: 8
21-
- file: 'fonts/BebasNeue-Regular.ttf'
22-
id: font2
23-
size: 48
24-
- file: 'fonts/arial.ttf'
25-
id: font3
26-
size: 14
27-
28-
display:
29-
- platform: ssd1306_i2c
30-
model: "SSD1306 128x64"
31-
reset_pin: D0
32-
address: 0x3C
33-
lambda: |-
34-
it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Living Room");
35-
36-
// Print time in HH:MM format
37-
it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(sntp_time).now());
38-
39-
// Print temperature
40-
if (id(${devicename}_${location_id}_temp).has_state()) {
41-
it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(${devicename}_${location_id}_temp).state);
42-
}
43-
44-
// Print humidity
45-
if (id(${devicename}_${location_id}_hum).has_state()) {
46-
it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.1f%%", id(${devicename}_${location_id}_hum).state);
47-
}
12+
# time:
13+
# - platform: sntp
14+
# id: sntp_time
15+
# timezone: Asia/Shanghai
16+
#
17+
# font:
18+
# - file: 'fonts/slkscr.ttf'
19+
# id: font1
20+
# size: 8
21+
# - file: 'fonts/BebasNeue-Regular.ttf'
22+
# id: font2
23+
# size: 48
24+
# - file: 'fonts/arial.ttf'
25+
# id: font3
26+
# size: 14
27+
#
28+
# display:
29+
# - platform: ssd1306_i2c
30+
# model: "SSD1306 128x64"
31+
# reset_pin: D0
32+
# address: 0x3C
33+
# lambda: |-
34+
# it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Living Room");
35+
#
36+
# // Print time in HH:MM format
37+
# it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(sntp_time).now());
38+
#
39+
# // Print temperature
40+
# if (id(${devicename}_${location_id}_temp).has_state()) {
41+
# it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(${devicename}_${location_id}_temp).state);
42+
# }
43+
#
44+
# // Print humidity
45+
# if (id(${devicename}_${location_id}_hum).has_state()) {
46+
# it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.1f%%", id(${devicename}_${location_id}_hum).state);
47+
# }

weatherstation_zhuwo.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
substitutions:
22
devicename: weatherstation
33
location_id: zhuwo
4-
location_name: 主卧
4+
location_name: "Zhu Wo"
55
domoticz_device_id: "91"
66
domoticz_device_id_2: "96"
77
domoticz_device_id_3: "97"
@@ -18,6 +18,7 @@ switch:
1818
number: D0
1919
id: pms_set
2020
name: "Start measuring"
21+
internal: true
2122

2223
sensor: !include_dir_list weatherstation/bed_room/sensors/
2324
interval: !include_dir_list weatherstation/bed_room/automations/

0 commit comments

Comments
 (0)