diff --git a/p1-dongle-pro-h2o-dsmr22.yaml b/p1-dongle-pro-h2o-dsmr22.yaml new file mode 100644 index 0000000..2ab920a --- /dev/null +++ b/p1-dongle-pro-h2o-dsmr22.yaml @@ -0,0 +1,308 @@ +substitutions: + device_name: p1-dongle-pro-h2o + device_description: "P1 Dongle Pro + H2O counter" + friendly_name: P1 Dongle Pro H2O + prj_version: "2024.08.01" + +esphome: + name: ${device_name} + comment: "${device_description}" + name_add_mac_suffix: false + project: + name: "smartstuff.p1_dongle_pro_h2o" + version: ${prj_version} + platformio_options: + upload_speed: 1500000 + +esp32: + board: esp32-c3-devkitm-1 + +improv_serial: + next_url: http://{{ip_address}} + +api: + services: + - service: p1_dongle_reboot + then: + - button.press: + id: reboot + - service: set_water_total + variables: + set_value: int + then: + - globals.set: + id: totalWaterUsage + value: !lambda 'return set_value;' + +globals: + - id: totalWaterUsage + type: int + restore_value: true # aanpassen naar no indien de nieuwe waarde onder de oude ligt + initial_value: '0' + +ota: + platform: esphome + +captive_portal: +web_server: +wifi: +# Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: ${device_name} + ap_timeout: 15s + +dashboard_import: + package_import_url: github://mhendriks/esphome-p1/p1-dongle-pro-h2o-dsmr22.yaml@main + +# Enable logging +logger: + level: ERROR + +dsmr: + crc_check: false + +uart: + rx_pin: + number: 10 + inverted: true + rx_buffer_size: 1700 + baud_rate: 9600 + data_bits: 7 + parity: EVEN + stop_bits: 1 + +light: + - platform: status_led + name: "status led" + output: status_output + internal: true + - platform: neopixelbus + variant: WS2812 + pin: 8 + num_leds: 1 + name: "_Status LED" + id: esp32c3_rgb_led + entity_category: config + restore_mode: ALWAYS_OFF + internal: true +# method: +# type: esp32_rmt +# channel: 0 + +switch: + - platform: template + id: status_led_switch + # name: "Status LED Switch" + optimistic: true + on_turn_on: + - light.turn_on: + id: esp32c3_rgb_led + red: 0% + green: 0% + blue: 100% + brightness: 40% + transition_length: 50ms + on_turn_off: + - light.turn_off: + id: esp32c3_rgb_led + transition_length: 50ms + +output: + - platform: template + id: status_output + type: binary + write_action: + - if: + condition: + lambda: return state > 0; + then: + - if: + condition: + switch.is_off: status_led_switch + then: + switch.turn_on: status_led_switch + else: + - if: + condition: + switch.is_on: status_led_switch + then: + switch.turn_off: status_led_switch + +button: + - platform: restart + name: "_Restart device" + id: reboot + - platform: factory_reset + name: "_Restart with Factory Default Settings" + +binary_sensor: + - platform: gpio + pin: + number: 9 + inverted: true + mode: + input: true + pullup: true + name: _PushButton + on_press: + then: + - switch.toggle: status_led_switch + +sensor: + - platform: pulse_meter + name: "Watermeter pulse" + pin: + number: 0 + mode: + input: true + pullup: true + id: h2o_pulse + state_class: measurement + unit_of_measurement: 'L' + device_class: water + internal_filter: 13us + internal_filter_mode: EDGE + icon: mdi:flash-outline + accuracy_decimals: 0 + # total: + # name: "Water Total" + # id: h2o_total + # state_class: total_increasing + # icon: mdi:water + # unit_of_measurement: L + # accuracy_decimals: 0 + - platform: template + name: "Watermeter total" + state_class: "total_increasing" + device_class: "water" + icon: mdi:water + update_interval: 1s + unit_of_measurement: L + accuracy_decimals: 0 + lambda: |- + if (id(h2o_pulse).state > 0) id(totalWaterUsage) += 1; + return id(totalWaterUsage); + + - platform: dsmr +# energy_delivered_lux: +# name: "Energy Consumed Luxembourg" +# state_class: total_increasing + energy_delivered_tariff1: + name: "Energy Consumed Tariff 1" + state_class: total_increasing + energy_delivered_tariff2: + name: "Energy Consumed Tariff 2" + state_class: total_increasing +# energy_returned_lux: +# name: "Energy Produced Luxembourg" +# state_class: total_increasing + energy_returned_tariff1: + name: "Energy Produced Tariff 1" + state_class: total_increasing + energy_returned_tariff2: + name: "Energy Produced Tariff 2" + state_class: total_increasing + power_delivered: + name: "Power Consumed" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_returned: + name: "Power Produced" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + electricity_failures: + name: "Electricity Failures" + icon: mdi:alert + electricity_long_failures: + name: "Long Electricity Failures" + icon: mdi:alert + voltage_l1: + name: "Voltage Phase 1" + voltage_l2: + name: "Voltage Phase 2" + voltage_l3: + name: "Voltage Phase 3" + current_l1: + name: "Current Phase 1" + current_l2: + name: "Current Phase 2" + current_l3: + name: "Current Phase 3" + power_delivered_l1: + name: "Power Consumed Phase 1" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_delivered_l2: + name: "Power Consumed Phase 2" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_delivered_l3: + name: "Power Consumed Phase 3" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_returned_l1: + name: "Power Produced Phase 1" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_returned_l2: + name: "Power Produced Phase 2" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_returned_l3: + name: "Power Produced Phase 3" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + gas_delivered: + name: "Gas Consumed" + state_class: total_increasing + gas_delivered_be: + name: "Gas Consumed Belgium" + state_class: total_increasing + - platform: uptime + name: "_Uptime" + - platform: wifi_signal + name: "_Wi-Fi Signal" + update_interval: 60s + +text_sensor: + - platform: dsmr + identification: + name: "DSMR Identification" + p1_version: + name: "DSMR Version" + p1_version_be: + name: "DSMR Version Belgium" + - platform: wifi_info + ip_address: + name: "_IP Address" + ssid: + name: "_Wi-Fi SSID" + bssid: + name: "_Wi-Fi BSSID" + - platform: version + name: "_ESPHome Version" + hide_timestamp: true \ No newline at end of file diff --git a/p1-dongle-pro-h2o.yaml b/p1-dongle-pro-h2o.yaml index 9617969..dda8312 100644 --- a/p1-dongle-pro-h2o.yaml +++ b/p1-dongle-pro-h2o.yaml @@ -2,7 +2,7 @@ substitutions: device_name: p1-dongle-pro-h2o device_description: "P1 Dongle Pro + H2O counter" friendly_name: P1 Dongle Pro H2O - prj_version: "2023.12.1" + prj_version: "2024.08.01" esphome: name: ${device_name} @@ -41,6 +41,8 @@ globals: initial_value: '0' ota: + platform: esphome + captive_portal: web_server: wifi: diff --git a/p1-dongle-pro-mbus2.yaml b/p1-dongle-pro-mbus2.yaml new file mode 100644 index 0000000..8caccbd --- /dev/null +++ b/p1-dongle-pro-mbus2.yaml @@ -0,0 +1,200 @@ +substitutions: + device_name: p1-dongle-pro + device_description: "P1 Dongle Pro (ESP32) module to read your smart meter" + friendly_name: P1 Dongle Pro + prj_version: "2024.08.01" + +esphome: + name: ${device_name} + comment: "${device_description}" + name_add_mac_suffix: false + project: + name: "smartstuff.p1_dongle_pro" + version: ${prj_version} + platformio_options: + upload_speed: 921600 + platform: espressif32@4.3.0 + board_build.flash_mode: dio + +esp32: + board: esp32-c3-devkitm-1 + framework: + type: arduino + version: 2.0.3 + +status_led: + pin: + number: 7 + inverted: true + +api: + services: + - service: p1_dongle_reboot + then: + - button.press: + id: reboot +ota: + platform: esphome + +wifi: + power_save_mode: none +# Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: ${device_name} + ap_timeout: 15s + +dashboard_import: + package_import_url: github://mhendriks/esphome-p1/p1-dongle-pro.yaml@main + +captive_portal: + +web_server: + port: 80 + +# Enable logging +logger: + level: INFO + +uart: + rx_pin: + number: 10 + inverted: true + baud_rate: 115200 + rx_buffer_size: 1700 + +dsmr: + id: dsmr_instance + receive_timeout: 200ms + max_telegram_length: 1700 + gas_mbus_id: 2 + + +button: + - platform: restart + name: "Reboot device" + id: reboot + +sensor: + - platform: dsmr +# energy_delivered_lux: +# name: "Energy Consumed Luxembourg" +# state_class: total_increasing + energy_delivered_tariff1: + name: "Energy Consumed Tariff 1" + state_class: total_increasing + energy_delivered_tariff2: + name: "Energy Consumed Tariff 2" + state_class: total_increasing +# energy_returned_lux: +# name: "Energy Produced Luxembourg" +# state_class: total_increasing + energy_returned_tariff1: + name: "Energy Produced Tariff 1" + state_class: total_increasing + energy_returned_tariff2: + name: "Energy Produced Tariff 2" + state_class: total_increasing + power_delivered: + name: "Power Consumed" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_returned: + name: "Power Produced" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + electricity_failures: + name: "Electricity Failures" + icon: mdi:alert + electricity_long_failures: + name: "Long Electricity Failures" + icon: mdi:alert + voltage_l1: + name: "Voltage Phase 1" + voltage_l2: + name: "Voltage Phase 2" + voltage_l3: + name: "Voltage Phase 3" + current_l1: + name: "Current Phase 1" + current_l2: + name: "Current Phase 2" + current_l3: + name: "Current Phase 3" + power_delivered_l1: + name: "Power Consumed Phase 1" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_delivered_l2: + name: "Power Consumed Phase 2" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_delivered_l3: + name: "Power Consumed Phase 3" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_returned_l1: + name: "Power Produced Phase 1" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_returned_l2: + name: "Power Produced Phase 2" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + power_returned_l3: + name: "Power Produced Phase 3" + unit_of_measurement: "W" + state_class: "measurement" + accuracy_decimals: 0 + filters: + - multiply: 1000 + gas_delivered: + name: "Gas Consumed" + state_class: total_increasing + gas_delivered_be: + name: "Gas Consumed Belgium" + state_class: total_increasing + - platform: uptime + name: "Uptime" + - platform: wifi_signal + name: "Wi-Fi Signal" + update_interval: 60s + +text_sensor: + - platform: dsmr + identification: + name: "DSMR Identification" + p1_version: + name: "DSMR Version" + p1_version_be: + name: "DSMR Version Belgium" + - platform: wifi_info + ip_address: + name: "IP Address" + ssid: + name: "Wi-Fi SSID" + bssid: + name: "Wi-Fi BSSID" + - platform: version + name: "ESPHome Version" + hide_timestamp: true diff --git a/p1-dongle-pro-smr2_2.yaml b/p1-dongle-pro-smr2_2.yaml index 3460c86..b9b9f8b 100644 --- a/p1-dongle-pro-smr2_2.yaml +++ b/p1-dongle-pro-smr2_2.yaml @@ -2,7 +2,7 @@ substitutions: device_name: p1-dongle-pro-smr2 device_description: "P1 Dongle Pro (ESP32) module to read your smart meter" friendly_name: P1 Dongle Pro - prj_version: "2023.3.1" + prj_version: "2024.08.01" esphome: name: ${device_name} @@ -13,15 +13,9 @@ esphome: version: ${prj_version} platformio_options: upload_speed: 1500000 -# platform: espressif32@4.3.0 -# board_build.flash_mode: dio - esp32: board: esp32-c3-devkitm-1 -# framework: -# type: arduino -# version: 2.0.6 status_led: pin: @@ -35,18 +29,19 @@ api: - button.press: id: reboot ota: + platform: esphome wifi: power_save_mode: none - # Enable fallback hotspot (captive portal) in case wifi connection fails +# Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: ${device_name} ap_timeout: 15s -captive_portal: - dashboard_import: - package_import_url: github://mhendriks/esphome-p1/p1-dongle-pro-smr2_2.yaml + package_import_url: github://mhendriks/esphome-p1/p1-dongle-pro-smr2_2.yaml@main + +captive_portal: web_server: port: 80 @@ -69,9 +64,11 @@ dsmr: button: - platform: restart - name: "Reboot device" + name: "_Restart device" id: reboot - + - platform: factory_reset + name: "_Restart with Factory Default Settings" + sensor: - platform: dsmr # energy_delivered_lux: @@ -112,6 +109,18 @@ sensor: electricity_long_failures: name: "Long Electricity Failures" icon: mdi:alert + voltage_l1: + name: "Voltage Phase 1" + voltage_l2: + name: "Voltage Phase 2" + voltage_l3: + name: "Voltage Phase 3" + current_l1: + name: "Current Phase 1" + current_l2: + name: "Current Phase 2" + current_l3: + name: "Current Phase 3" power_delivered_l1: name: "Power Consumed Phase 1" unit_of_measurement: "W" @@ -157,6 +166,9 @@ sensor: gas_delivered: name: "Gas Consumed" state_class: total_increasing + gas_delivered_be: + name: "Gas Consumed Belgium" + state_class: total_increasing - platform: uptime name: "Uptime" - platform: wifi_signal @@ -169,8 +181,8 @@ text_sensor: name: "DSMR Identification" p1_version: name: "DSMR Version" - gas_delivered_text: - name: "gas delivered raw" + p1_version_be: + name: "DSMR Version Belgium" - platform: wifi_info ip_address: name: "IP Address"