Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajout du unique_id aux sensors du rate et ajout des sensors dans le device du Gateway #307

Merged
merged 3 commits into from
Oct 29, 2023

Conversation

maxyvon
Copy link
Contributor

@maxyvon maxyvon commented Oct 27, 2023

Les rate sensor sont maintenant éditable et ajouté dans le device du gataway au lieu d'être orpheline.
J'ai aussi changé les unités pour le low_threshold comme ça il a les même unités que hilo_energy_total.

@ic-dev21
Copy link
Collaborator

Salut! Peux-tu vérifier pourquoi ça lint pas? Je pense que Black n'est pas respecté

@valleedelisle
Copy link
Contributor

Tiens si ca peut aider (lien). J'pense pas qu'on puisse éditer ta PR sans la refaire (et donc prendre le credit à ta place).

diff --git a/custom_components/hilo/sensor.py b/custom_components/hilo/sensor.py
index f1c0e3b..5c3fa0a 100755
--- a/custom_components/hilo/sensor.py
+++ b/custom_components/hilo/sensor.py
@@ -173,7 +173,9 @@ async def async_setup_entry(
     for tarif, amount in tariff_config.items():
         if amount > 0:
             sensor_name = f"Hilo rate {tarif}"
-            cost_entities.append(HiloCostSensor(hilo, sensor_name, hq_plan_name, amount))
+            cost_entities.append(
+                HiloCostSensor(hilo, sensor_name, hq_plan_name, amount)
+            )
     cost_entities.append(HiloCostSensor(hilo, "Hilo rate current", hq_plan_name))
     async_add_entities(cost_entities)
     # This setups the utility_meter platform
@@ -704,7 +706,9 @@ class HiloCostSensor(HiloEntity, RestoreEntity, SensorEntity):
         if last_state:
             self._last_update = dt_util.utcnow()
             self._amount = last_state.state
-            LOG.info(f"Restoring energy cost sensor {last_state.name} {self.plan_name} Amount: {self._amount}")
+            LOG.info(
+                f"Restoring energy cost sensor {last_state.name} {self.plan_name} Amount: {self._amount}"
+            )
 
     async def async_update(self):
         return

@ic-dev21 ic-dev21 merged commit ee27933 into dvd-dev:main Oct 29, 2023
@ic-dev21
Copy link
Collaborator

Bonne idée pour le gateway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants