Skip to content

Commit

Permalink
Merge pull request #16 from milothomas/feature/ha-power-stats
Browse files Browse the repository at this point in the history
Add monthly power consumption on energy dashboard
  • Loading branch information
milothomas authored Oct 23, 2022
2 parents 8ddfbc1 + 59d2b01 commit a3a1d52
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mqtt/mqtt-discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const generateConfigPayload = device => {
const stateTopic = `miraie-ac/${deviceName}/state`;

const discoMsg = {
icon: 'mdi:air-conditioner',
name: device.friendlyName,
unique_id: deviceName,
mode_cmd_t: `miraie-ac/${deviceName}/mode/set`,
Expand Down Expand Up @@ -52,14 +53,16 @@ const generateMonthlyPowerConsumptionPayload = device => {
const stateTopic = `miraie-ac/${deviceName}/monthly-power-consumption/state`;

const discoMsg = {
name: `Monthly Power Consumption`,
name: `Monthly Power Consumption - ${device.friendlyName}`,
unique_id: `monthly-power-consumption-${deviceName}`,
avty_t: `miraie-ac/${deviceName}/availability`,
pl_avail: 'online',
pl_not_avail: 'offline',
unit_of_meas: 'kWh',
dev_cla: 'energy',
state_class: 'total_increasing',
stat_t: stateTopic,
icon: 'mdi:lightning-bolt',
dev: {
ids: [device.id, device.details.macAddress],
mf: device.details.brand,
Expand All @@ -77,14 +80,15 @@ const generateDailyPowerConsumptionPayload = device => {
const stateTopic = `miraie-ac/${deviceName}/daily-power-consumption/state`;

const discoMsg = {
name: `Daily Power Consumption`,
name: `Daily Power Consumption - ${device.friendlyName}`,
unique_id: `daily-power-consumption-${deviceName}`,
avty_t: `miraie-ac/${deviceName}/availability`,
pl_avail: 'online',
pl_not_avail: 'offline',
unit_of_meas: 'kWh',
dev_cla: 'energy',
stat_t: stateTopic,
icon: 'mdi:lightning-bolt',
dev: {
ids: [device.id, device.details.macAddress],
mf: device.details.brand,
Expand Down

0 comments on commit a3a1d52

Please sign in to comment.