Skip to content

Commit

Permalink
Streamline powermeter examples (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi authored Jul 6, 2023
1 parent 465e247 commit e9fc933
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions powermeter-sensor-examples/esphome-http-rest-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ http_request:

sensor:
- platform: template
id: powermeter
id: powermeter0
name: "Instantaneous Power"
unit_of_measurement: W
device_class: "power"
Expand All @@ -29,6 +29,6 @@ interval:
std::string response_data = id(http_request0).get_string();
if(!response_data.empty()) {
json::parse_json(response_data, [](JsonObject root) {
id(powermeter).publish_state(root["value"]);
id(powermeter0).publish_state(root["value"]);
});
}
4 changes: 2 additions & 2 deletions powermeter-sensor-examples/shelly-3em-http-status-json.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ http_request:

sensor:
- platform: template
id: powermeter
id: powermeter0
name: "Instantaneous Power"
unit_of_measurement: W
device_class: "power"
Expand All @@ -29,6 +29,6 @@ interval:
std::string response_data = id(http_request0).get_string();
if(!response_data.empty()) {
json::parse_json(response_data, [](JsonObject root) {
id(powermeter).publish_state(root["total_power"]);
id(powermeter0).publish_state(root["total_power"]);
});
}
4 changes: 2 additions & 2 deletions powermeter-sensor-examples/tasmota-http-status-sns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ http_request:

sensor:
- platform: template
id: powermeter
id: powermeter0
name: "Instantaneous Power"
unit_of_measurement: W
device_class: "power"
Expand All @@ -31,6 +31,6 @@ interval:
std::string response_data = id(http_request0).get_string();
if(!response_data.empty()) {
json::parse_json(response_data, [](JsonObject root) {
id(powermeter).publish_state(root["StatusSNS"]["SML"]["Leistung"]);
id(powermeter0).publish_state(root["StatusSNS"]["SML"]["Leistung"]);
});
}

0 comments on commit e9fc933

Please sign in to comment.