From df5b6d22ee3dc9f0c57d0a141ee7558013e6cbc7 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Fri, 7 Jul 2023 10:29:31 +0200 Subject: [PATCH] Add another Tasmota status SNS SML example using english keys (#144) --- .../tasmota-http-status-sns-en.json | 23 ++++++++++++ .../tasmota-http-status-sns-en.yaml | 36 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 powermeter-sensor-examples/tasmota-http-status-sns-en.json create mode 100644 powermeter-sensor-examples/tasmota-http-status-sns-en.yaml diff --git a/powermeter-sensor-examples/tasmota-http-status-sns-en.json b/powermeter-sensor-examples/tasmota-http-status-sns-en.json new file mode 100644 index 0000000..8d7b1e8 --- /dev/null +++ b/powermeter-sensor-examples/tasmota-http-status-sns-en.json @@ -0,0 +1,23 @@ +{ + "StatusSNS": { + "SML": { + "amp_p1": 0.7, + "amp_p2": 0.9, + "amp_p3": 0.3, + "curr_w": -141, + "export_total_kwh": 406.3138, + "freq": 50, + "phase_angle_l2_l1": 240, + "phase_angle_l3_l1": 120, + "phase_angle_p1": 233, + "phase_angle_p2": 112, + "phase_angle_p3": 306, + "server_id": "ffffffffffffffffffff", + "total_kwh": 1608.8451, + "volt_p1": 239.7, + "volt_p2": 239.8, + "volt_p3": 239 + }, + "Time": "2023-07-07T09:32:07" + } +} diff --git a/powermeter-sensor-examples/tasmota-http-status-sns-en.yaml b/powermeter-sensor-examples/tasmota-http-status-sns-en.yaml new file mode 100644 index 0000000..d6d758f --- /dev/null +++ b/powermeter-sensor-examples/tasmota-http-status-sns-en.yaml @@ -0,0 +1,36 @@ +# https://github.com/syssi/esphome-soyosource-gtn-virtual-meter/discussions/137 + +substitutions: + tasmota_status_url: "http://192.168.132.5/cm?cmnd=status+10" + +http_request: + id: http_request0 + useragent: esphome/device + timeout: 1000ms + +sensor: + - platform: template + id: powermeter0 + name: "Instantaneous Power" + unit_of_measurement: W + device_class: "power" + accuracy_decimals: 2 + update_interval: never + +interval: + - interval: 1100ms + then: + - http_request.get: + url: ${tasmota_status_url} + headers: + Content-Type: application/json + verify_ssl: false + on_response: + then: + - lambda: |- + std::string response_data = id(http_request0).get_string(); + if(!response_data.empty()) { + json::parse_json(response_data, [](JsonObject root) { + id(powermeter0).publish_state(root["StatusSNS"]["SML"]["curr_w"]); + }); + }