Skip to content

Commit

Permalink
👌 IMPROVE: Start with Logfire
Browse files Browse the repository at this point in the history
  • Loading branch information
unl0ck committed Dec 24, 2024
1 parent 9a468bb commit e7041c5
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .bumpversion-edge.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "2.11.25"
current_version = "2.11.26"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
Expand Down
6 changes: 6 additions & 0 deletions GridboxConnectorAddon-edge/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->

## 2.11.26

### 🚀 Added

- start with logfire implementation

## 2.11.25

### 🔨 Fixed
Expand Down
2 changes: 2 additions & 0 deletions GridboxConnectorAddon-edge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ LABEL \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}

ENV LOGFIRE_TOKEN=${LOGFIRE_TOKEN}

RUN \
apk add --no-cache \
python3 py3-pip
Expand Down
10 changes: 10 additions & 0 deletions GridboxConnectorAddon-edge/GridboxConnector/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from importlib.resources import files
from utils import SensitiveDataFilter, get_bool_env
import threading
import logfire
opens_file_path = '/data/options.json'
#logging.basicConfig(format='%(asctime)s %(filename)s:%(lineno)d %(levelname)s - %(message)s', level=logging.getLevelName(os.getenv('LOG_LEVEL', 'INFO')))
logger = logging.getLogger(__name__)
Expand All @@ -17,6 +18,15 @@
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
logger.addFilter(SensitiveDataFilter())
# Retrieve logfire token from environment variable
try:
logfire_token = os.getenv('LOGFIRE_TOKEN', None)
if logfire_token:
logfire.configure()
logfire.instrument_requests()
logger.addHandler(logfire.LogfireLoggingHandler())
except Exception as e:
logger.error(f"Error configuring logfire: {e}")

def load_gridbox_config():
config_file = files('viessmann_gridbox_connector').joinpath('config.json')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ha-mqtt-discoverable==0.16.3
requests==2.32.3
viessmann-gridbox-connector==1.6.0
logfire==2.11.0
2 changes: 1 addition & 1 deletion GridboxConnectorAddon-edge/cloudSettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.11.25",
"version": "2.11.26",
"urls": {
"login": "https://gridx.eu.auth0.com/oauth/token",
"gateways": "https://api.gridx.de/gateways",
Expand Down
2 changes: 1 addition & 1 deletion GridboxConnectorAddon-edge/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
---
name: Viessmann Gridbox Connector (edge)
version: "2.11.25"
version: "2.11.26"
slug: "gridbox_connector_edge"
description: "Viessmann Gridbox Connector (edge)"
url: "https://github.com/unl0ck/homeassistant-addon-viessmann-gridbox/tree/main/GridboxConnectorAddon-edge"
Expand Down
2 changes: 1 addition & 1 deletion GridboxConnectorAddon-edge/rootfs/share/cloudSettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.11.25",
"version": "2.11.26",
"urls": {
"login": "https://gridx.eu.auth0.com/oauth/token",
"gateways": "https://api.gridx.de/gateways",
Expand Down

0 comments on commit e7041c5

Please sign in to comment.