-
Notifications
You must be signed in to change notification settings - Fork 2
/
powermeter.yaml
143 lines (134 loc) · 3.46 KB
/
powermeter.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
substitutions:
devicename: powermeter
location_id: livingroom
domoticz_device_id: "94"
esphome:
name: $devicename
platform: ESP8266
board: nodemcuv2
<<: !include common/base.yaml
mqtt:
<<: !include common/mqtt.yaml
logger:
esp8266_store_log_strings_in_flash: false
baud_rate: 0
uart:
id: uart_bus
tx_pin: GPIO15 # D8
rx_pin: GPIO13 # D7
baud_rate: 4800
modbus:
# flow_control_pin: 5
id: mod_bus
modbus_controller:
- id: lt518
address: 0x1
modbus_id: mod_bus
setup_priority: -10
update_interval: 30s
switch:
- platform: modbus_controller
modbus_controller_id: lt518
id: reset_energy_reading
register_type: coil
address: 0x1
name: "Reset Energy Reading"
write_lambda: |-
// reset energy reading:01 4A 53 59 03 85 98
payload.push_back(0x01); // device address
payload.push_back(0x4a);
payload.push_back(0x53);
payload.push_back(0x59);
payload.push_back(0x03);
payload.push_back(0x85);
payload.push_back(0x98);
return false;
sensor:
- platform: modbus_controller
modbus_controller_id: lt518
name: "Voltage"
id: powermeter_voltage
register_type: holding
address: 0x0048
value_type: U_DWORD
# custom_command: [ 0x01, 0x03, 0x00, 0x48, 0x00, 0x08, 0xc4, 0x1a]
device_class: "voltage"
state_class: "measurement"
accuracy_decimals: 1
unit_of_measurement: "V"
filters:
- multiply: 0.0001
- platform: modbus_controller
modbus_controller_id: lt518
name: "Current"
id: powermeter_current
register_type: holding
address: 0x0049
value_type: U_DWORD
device_class: "current"
state_class: "measurement"
accuracy_decimals: 2
unit_of_measurement: "A"
filters:
- multiply: 0.0001
- platform: modbus_controller
modbus_controller_id: lt518
name: "Power"
id: powermeter_power
register_type: holding
address: 0x004a
value_type: U_DWORD
device_class: "power"
state_class: "measurement"
accuracy_decimals: 0
unit_of_measurement: "W"
filters:
- multiply: 0.0001
- platform: modbus_controller
modbus_controller_id: lt518
name: "Energy"
id: powermeter_energy
register_type: holding
address: 0x004b
value_type: U_DWORD
device_class: "energy"
state_class: "total_increasing"
accuracy_decimals: 0
unit_of_measurement: "kWh"
filters:
- multiply: 0.0001
on_value:
then:
- lambda: |-
id(mqtt_client).publish_json("domoticz/in", [=](JsonObject root) {
root["command"] = "udevice";
root["idx"] = ${domoticz_device_id};
root["nvalue"] = 0;
root["svalue"] = String(id(powermeter_power).state) + ";" + String(1000 * x);
});
- platform: modbus_controller
modbus_controller_id: lt518
name: "Power Factor"
id: powermeter_power_factor
register_type: holding
address: 0x004c
value_type: U_DWORD
device_class: "power_factor"
state_class: "measurement"
accuracy_decimals: 2
unit_of_measurement: ""
filters:
- multiply: 0.001
- platform: modbus_controller
modbus_controller_id: lt518
name: "CO2"
id: powermeter_co2
register_type: holding
address: 0x004d
value_type: U_DWORD
# register_count: 4 # skip next register (32bit): 0x4e
state_class: "total_increasing"
accuracy_decimals: 0
unit_of_measurement: "kg"
filters:
- multiply: 0.0001