Skip to content

Commit

Permalink
Merge pull request #10111 from kabakaev/relay-state-metrics
Browse files Browse the repository at this point in the history
show relay state in prometheus metrics
  • Loading branch information
arendst authored Dec 13, 2020
2 parents 1002f49 + 0564937 commit 205f172
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tasmota/xsns_75_prometheus.ino
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ void HandleMetrics(void)
WSContentSend_P(PSTR("# TYPE energy_power_kilowatts_total counter\nenergy_power_kilowatts_total %s\n"), parameter);
#endif

for (uint32_t device = 0; device < TasmotaGlobal.devices_present; device++) {
power_t mask = 1 << device;
WSContentSend_P(PSTR("# TYPE relay%d_state gauge\nrelay%d_state %d\n"), device+1, device+1, (TasmotaGlobal.power & mask));
}

/*
// Alternative method using the complete sensor JSON data
// For prometheus it may need to be decoded to # TYPE messages
Expand Down

0 comments on commit 205f172

Please sign in to comment.