Skip to content

Commit

Permalink
add origin to hass config
Browse files Browse the repository at this point in the history
  • Loading branch information
jblance authored Jan 15, 2025
1 parent 5865494 commit e31dff8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion powermon/outputformats/hass.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import json as js
import logging
from datetime import datetime
import construct as cs
from enum import Enum

import construct as cs

from powermon.commands.command import Command
from powermon.commands.reading import Reading
from powermon.commands.result import Result
from powermon.libs.version import __version__ # noqa: F401
from powermon.outputformats.abstractformat import AbstractFormat

log = logging.getLogger("hass")
Expand Down Expand Up @@ -106,6 +108,13 @@ def format(self, command: Command, result: Result, device_info) -> list:
"manufacturer": device_info.manufacturer,
}

# Add origin info
payload["origin"] = {
"name": "powermon",
"sw_version": __version__,
"support_url": "https://github.com/jblance/powermon"
}

# Add unit of measurement
if unit and unit != "bool":
payload["unit_of_measurement"] = f"{unit}"
Expand Down

0 comments on commit e31dff8

Please sign in to comment.