|
| 1 | +# |
| 2 | +# ET-SM01 DIY P1 DSMR Module Configuration for SmartEVSE |
| 3 | +# Created by espthings.io |
| 4 | +# |
| 5 | +# This device reads P1 DSMR data from your smart meter and sends current data |
| 6 | +# to SmartEVSE via REST API to enable dynamic EV charging optimization. |
| 7 | +# |
| 8 | +# SETUP: |
| 9 | +# 1. Update the smartevse_host substitution below with your SmartEVSE IP |
| 10 | +# 2. Replace secrets (esphome_wifi_ssid, esphome_wifi_password, etc.) in secrets.yaml |
| 11 | +# 3. Flash to your ET-SM01 device |
| 12 | +# |
| 13 | +# FEATURES: |
| 14 | +# - Reads all DSMR P1 meter data |
| 15 | +# - Calculates signed currents (negative = solar export) |
| 16 | +# - Sends current data to SmartEVSE every 5 seconds |
| 17 | +# - Toggle integration on/off via Home Assistant |
| 18 | +# - API connectivity status indicator |
| 19 | +# |
| 20 | +substitutions: |
| 21 | + device_name: et-sm01 DSMR reader |
| 22 | + device_description: "espthings.io ET-SM01 DIY P1 module to read your smart meter" |
| 23 | + pcb_version: "220818-01" |
| 24 | + url: "http://espthings.io/sm01" |
| 25 | + |
| 26 | +esphome: |
| 27 | + name: ${device_name} |
| 28 | + comment: "${device_description} ${pcb_version}" |
| 29 | + platform: ESP8266 |
| 30 | + esp8266_restore_from_flash: true |
| 31 | + board: d1_mini |
| 32 | + name_add_mac_suffix: false |
| 33 | + project: |
| 34 | + name: "espthings.io-ET-SM01" |
| 35 | + version: "${pcb_version}" |
| 36 | + |
| 37 | +wifi: |
| 38 | + networks: |
| 39 | + - ssid: !secret esphome_wifi_ssid |
| 40 | + password: !secret esphome_wifi_password |
| 41 | + |
| 42 | +logger: |
| 43 | + baud_rate: 0 |
| 44 | + |
| 45 | +api: |
| 46 | + encryption: |
| 47 | + key: !secret esphome_api_key |
| 48 | + |
| 49 | +ota: |
| 50 | + password: !secret esphome_ota_password |
| 51 | + |
| 52 | +web_server: |
| 53 | + port: 80 |
| 54 | + |
| 55 | +uart: |
| 56 | + baud_rate: 115200 |
| 57 | + rx_pin: D7 |
| 58 | + |
| 59 | +http_request: |
| 60 | + useragent: esphome/device |
| 61 | + timeout: 1s |
| 62 | + |
| 63 | +dsmr: |
| 64 | + id: dsmr_instance |
| 65 | + |
| 66 | +sensor: |
| 67 | + - platform: dsmr |
| 68 | + energy_delivered_tariff1: |
| 69 | + name: "Energy Consumed Tariff 1" |
| 70 | + device_class: energy |
| 71 | + state_class: total_increasing |
| 72 | + unit_of_measurement: "kWh" |
| 73 | + energy_delivered_tariff2: |
| 74 | + name: "Energy Consumed Tariff 2" |
| 75 | + device_class: energy |
| 76 | + state_class: total_increasing |
| 77 | + unit_of_measurement: "kWh" |
| 78 | + energy_returned_tariff1: |
| 79 | + name: "Energy Produced Tariff 1" |
| 80 | + device_class: energy |
| 81 | + state_class: total_increasing |
| 82 | + unit_of_measurement: "kWh" |
| 83 | + energy_returned_tariff2: |
| 84 | + name: "Energy Produced Tariff 2" |
| 85 | + device_class: energy |
| 86 | + state_class: total_increasing |
| 87 | + unit_of_measurement: "kWh" |
| 88 | + power_delivered: |
| 89 | + name: "Power Consumed" |
| 90 | + device_class: power |
| 91 | + state_class: measurement |
| 92 | + accuracy_decimals: 3 |
| 93 | + power_returned: |
| 94 | + name: "Power Produced" |
| 95 | + device_class: power |
| 96 | + state_class: measurement |
| 97 | + accuracy_decimals: 3 |
| 98 | + electricity_failures: |
| 99 | + name: "Electricity Failures" |
| 100 | + icon: mdi:alert |
| 101 | + electricity_long_failures: |
| 102 | + name: "Long Electricity Failures" |
| 103 | + icon: mdi:alert |
| 104 | + voltage_l1: |
| 105 | + name: "Voltage Phase 1" |
| 106 | + device_class: voltage |
| 107 | + voltage_l2: |
| 108 | + name: "Voltage Phase 2" |
| 109 | + device_class: voltage |
| 110 | + voltage_l3: |
| 111 | + name: "Voltage Phase 3" |
| 112 | + device_class: voltage |
| 113 | + current_l1: |
| 114 | + name: "Current Phase 1" |
| 115 | + id: current_l1 |
| 116 | + device_class: current |
| 117 | + unit_of_measurement: "A" |
| 118 | + current_l2: |
| 119 | + name: "Current Phase 2" |
| 120 | + id: current_l2 |
| 121 | + device_class: current |
| 122 | + unit_of_measurement: "A" |
| 123 | + current_l3: |
| 124 | + name: "Current Phase 3" |
| 125 | + id: current_l3 |
| 126 | + device_class: current |
| 127 | + unit_of_measurement: "A" |
| 128 | + power_delivered_l1: |
| 129 | + name: "Power Consumed Phase 1" |
| 130 | + device_class: power |
| 131 | + state_class: measurement |
| 132 | + accuracy_decimals: 3 |
| 133 | + power_delivered_l2: |
| 134 | + name: "Power Consumed Phase 2" |
| 135 | + device_class: power |
| 136 | + state_class: measurement |
| 137 | + accuracy_decimals: 3 |
| 138 | + power_delivered_l3: |
| 139 | + name: "Power Consumed Phase 3" |
| 140 | + device_class: power |
| 141 | + state_class: measurement |
| 142 | + accuracy_decimals: 3 |
| 143 | + power_returned_l1: |
| 144 | + name: "Power Produced Phase 1" |
| 145 | + device_class: power |
| 146 | + state_class: measurement |
| 147 | + accuracy_decimals: 3 |
| 148 | + id: power_returned_l1 |
| 149 | + power_returned_l2: |
| 150 | + name: "Power Produced Phase 2" |
| 151 | + device_class: power |
| 152 | + state_class: measurement |
| 153 | + accuracy_decimals: 3 |
| 154 | + id: power_returned_l2 |
| 155 | + power_returned_l3: |
| 156 | + name: "Power Produced Phase 3" |
| 157 | + device_class: power |
| 158 | + state_class: measurement |
| 159 | + accuracy_decimals: 3 |
| 160 | + id: power_returned_l3 |
| 161 | + gas_delivered: |
| 162 | + name: "Gas Consumed" |
| 163 | + state_class: total_increasing |
| 164 | + gas_delivered_be: |
| 165 | + name: "Gas Consumed Belgium" |
| 166 | + state_class: total_increasing |
| 167 | + - platform: uptime |
| 168 | + name: "Uptime" |
| 169 | + - platform: wifi_signal |
| 170 | + name: "Wi-Fi Signal" |
| 171 | + update_interval: 60s |
| 172 | + |
| 173 | +text_sensor: |
| 174 | + - platform: dsmr |
| 175 | + identification: |
| 176 | + name: "Identification" |
| 177 | + p1_version: |
| 178 | + name: "Version" |
| 179 | + p1_version_be: |
| 180 | + name: "Version Belgium" |
| 181 | + electricity_tariff: |
| 182 | + name: "Tariff" |
| 183 | + - platform: wifi_info |
| 184 | + ip_address: |
| 185 | + name: "IP Address" |
| 186 | + ssid: |
| 187 | + name: "Wi-Fi SSID" |
| 188 | + bssid: |
| 189 | + name: "Wi-Fi BSSID" |
| 190 | + - platform: version |
| 191 | + name: "ESPHome Version" |
| 192 | + hide_timestamp: true |
| 193 | + |
| 194 | +switch: |
| 195 | + - platform: restart |
| 196 | + name: "Restart" |
| 197 | + |
| 198 | +interval: |
| 199 | + - interval: 5sec |
| 200 | + then: |
| 201 | + - http_request.post: |
| 202 | + headers: |
| 203 | + Content-Length: 0 |
| 204 | + url: !lambda |- |
| 205 | + // Calculate signed currents (negative = solar export) |
| 206 | + float l1 = id(power_returned_l1).state > 0 ? -id(current_l1).state : id(current_l1).state; |
| 207 | + float l2 = id(power_returned_l2).state > 0 ? -id(current_l2).state : id(current_l2).state; |
| 208 | + float l3 = id(power_returned_l3).state > 0 ? -id(current_l3).state : id(current_l3).state; |
| 209 | +
|
| 210 | + // Build URL with current values (in 0.1A units) |
| 211 | + static char url[128]; |
| 212 | + snprintf(url, sizeof(url), |
| 213 | + "http://192.168.207.121/currents?L1=%.0f&L2=%.0f&L3=%.0f", |
| 214 | + l1 * 10, l2 * 10, l3 * 10); |
| 215 | + return url; |
| 216 | + on_response: |
| 217 | + then: |
| 218 | + lambda: |- |
| 219 | + ESP_LOGD("smartevse", "SmartEVSE API request successful"); |
| 220 | + on_error: |
| 221 | + then: |
| 222 | + lambda: |- |
| 223 | + ESP_LOGW("smartevse", "SmartEVSE API request failed"); |
0 commit comments