-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathflower_care.yaml
52 lines (45 loc) · 1.61 KB
/
flower_care.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
substitutions:
living_room_flower_care_mac: !secret living_room_flower_care_mac
living_room_flower_care_name_prefix: Living Room Flower Care
living_room_flower_care_id_prefix: living_room_flower_care
esp32_ble_tracker:
myhomeiot_ble_host:
myhomeiot_ble_client:
- mac_address: ${living_room_flower_care_mac}
service_uuid: '1204'
characteristic_uuid: '1A02'
update_interval: 24h
on_value:
then:
lambda: |-
if (x.size() < 2)
{
ESP_LOGE("myhomeiot_ble_client", "payload has wrong size (%d)", x.size());
return;
};
id(${living_room_flower_care_id_prefix}_battery).publish_state(x[0]);
std::string firmware(x.begin(), x.end());
id(${living_room_flower_care_id_prefix}_firmware).publish_state(firmware.substr(2));
sensor:
- platform: xiaomi_hhccjcy01
mac_address: ${living_room_flower_care_mac}
temperature:
name: ${living_room_flower_care_name_prefix} Temperature
moisture:
name: ${living_room_flower_care_name_prefix} Moisture
illuminance:
name: ${living_room_flower_care_name_prefix} Illuminance
conductivity:
name: ${living_room_flower_care_name_prefix} Conductivity
- platform: template
id: ${living_room_flower_care_id_prefix}_battery
name: ${living_room_flower_care_name_prefix} Battery
device_class: battery
unit_of_measurement: '%'
state_class: measurement
accuracy_decimals: 0
text_sensor:
- platform: template
id: ${living_room_flower_care_id_prefix}_firmware
name: ${living_room_flower_care_name_prefix} Firmware
icon: mdi:new-box