diff --git a/custom_components/solar_optimizer/binary_sensor.py b/custom_components/solar_optimizer/binary_sensor.py index 2275b3c..c5a2a84 100644 --- a/custom_components/solar_optimizer/binary_sensor.py +++ b/custom_components/solar_optimizer/binary_sensor.py @@ -58,6 +58,8 @@ def update_custom_attributes(self, device): "requested_power": device.requested_power, "duration_sec": device.duration_sec, "duration_power_sec": device.duration_power_sec, + "power_min": device.power_min, + "power_max": device.power_max, "next_date_available": device.next_date_available.astimezone( current_tz ).isoformat(), diff --git a/custom_components/solar_optimizer/coordinator.py b/custom_components/solar_optimizer/coordinator.py index 5e44372..f0ec744 100644 --- a/custom_components/solar_optimizer/coordinator.py +++ b/custom_components/solar_optimizer/coordinator.py @@ -143,6 +143,7 @@ async def _async_update_data(self): calculated_data["total_power"] = total_power # Uses the result to turn on or off or change power + should_log = False for _, equipement in enumerate(best_solution): _LOGGER.debug("Dealing with best_solution for %s", equipement) name = equipement["name"] @@ -155,9 +156,11 @@ async def _async_update_data(self): is_active = device.is_active if is_active and not state: _LOGGER.debug("Extinction de %s", name) + should_log = True await device.deactivate() elif not is_active and state: _LOGGER.debug("Allumage de %s", name) + should_log = True await device.activate(requested_power) # Send change power if state is now on and change power is accepted and (power have change or eqt is just activated) @@ -171,9 +174,13 @@ async def _async_update_data(self): equipement["name"], requested_power, ) + should_log = True await device.change_requested_power(requested_power) - _LOGGER.debug("Calculated data are: %s", calculated_data) + if should_log: + _LOGGER.info("Calculated data are: %s", calculated_data) + else: + _LOGGER.debug("Calculated data are: %s", calculated_data) return calculated_data