Skip to content

Commit

Permalink
Add another Tasmota status SNS SML example using english keys (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi authored Jul 7, 2023
1 parent e9fc933 commit df5b6d2
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
23 changes: 23 additions & 0 deletions powermeter-sensor-examples/tasmota-http-status-sns-en.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
36 changes: 36 additions & 0 deletions powermeter-sensor-examples/tasmota-http-status-sns-en.yaml
Original file line number Diff line number Diff line change
@@ -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"]);
});
}

0 comments on commit df5b6d2

Please sign in to comment.