Skip to content

Commit

Permalink
fix: fix sensor class
Browse files Browse the repository at this point in the history
  • Loading branch information
m4dm4rtig4n committed Feb 29, 2024
1 parent 1680068 commit c1ffbc5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/models/export_home_assistant_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def load_config(self):
if self.config is not None:
if "url" in self.config:
self.url = self.config["url"]
if "ssl" in self.config and self.config["ssl"]:
if self.config.get("ssl"):
url_prefix = "wss"
else:
url_prefix = "ws"
Expand Down Expand Up @@ -85,7 +85,7 @@ def connect(self):
if check_ssl and "gateway" in check_ssl:
sslopt = {"cert_reqs": ssl.CERT_NONE}
self.ws = websocket.WebSocket(sslopt=sslopt)
logging.info(f"Connexion au WebSocket Home Assistant %s", self.url)
logging.info("Connexion au WebSocket Home Assistant %s", self.url)
self.ws.connect(
self.url,
timeout=5,
Expand Down Expand Up @@ -257,7 +257,7 @@ def import_data(self): # noqa: C901
statistic_id = f"{statistic_id}_hp_{measurement_direction}"
cost = value * self.usage_point_id_config.consumption_price_hp / 1000
tag = "hp"
elif plan == "TEMPO":
elif plan.upper() == "TEMPO":
if 600 <= hour_minute < 2200:
hour_type = "HP"
else:
Expand Down Expand Up @@ -382,7 +382,7 @@ def import_data(self): # noqa: C901
uniq_id=statistic_id,
unit_of_measurement="EURO",
state=truncate(data["sum"]),
device_class="energy",
device_class="monetary",
numPDL=self.usage_point_id,
)

Expand Down Expand Up @@ -520,7 +520,7 @@ def import_data(self): # noqa: C901
uniq_id=statistic_id,
unit_of_measurement="EURO",
state=truncate(data["sum"]),
device_class="energy",
device_class="monetary",
numPDL=self.usage_point_id,
)
except Exception as _e:
Expand Down

0 comments on commit c1ffbc5

Please sign in to comment.