jmcollin78 / solar_optimizer

The Solar Optimizer integration for Home Assistant starts and stops your equipments depending on the Solar net production
MIT License
53 stars 10 forks source link

Incorrect Internal Entity Values When Solar Panels Generate with Negative Household Consumption / not working #14

Closed jeremiesigrist closed 6 months ago

jeremiesigrist commented 6 months ago

Version of the custom_component

last version

Configuration


algorithm:
   initial_temp: 1000
   min_temp: 0.1
   cooling_factor: 0.95
   max_iteration_number: 1000
devices:
   - name: "Triac_solar_optimizer"
     entity_id: "switch.routeur_solaire_fictif"   # ==> créé dans ESPHOME integration
     # The minimum load power is 660 W (i.e. 1 Amp because convert_power_divide_factor=660 too)
     power_min: 25
     # The minimum load power is 3960 W (i.e. 5 Amp (= 3960/600) )
     power_max: 2800
     # the step of 660 or 1 Amp after division by convert_power_divide_factor
     power_step: 25
     # Usable if the charging mode is "Solar" and the car is plugged into the charger and it is charged at less than 90% (so it stops by itself at 90%)
     check_usable_template: "{{ is_state('switch.esp32_1_esp32_1_validation_router', 'on') }}" #"{{ is_state('input_select.charge_mode', 'Solar') and is_state('binary_sensor.tesla_wall_connector_vehicle_connected', 'on') and is_state('binary_sensor.tesla_charger', 'on') and states('sensor.tesla_battery ') | float(100) < states('number.cloucloute_charge_limit') | float(90) }}"
     # 1 hour minimum charge
     duration_min: 5
     # 15 min minimum stop charge
     duration_stop_min: 5
     # The entity that drives the load amperage
     power_entity_id: "input_number.striac_brightness"
     # 5 min minimum between 2 power changes
     duration_power_min: 1
     # activation is done by a service call
     action_mode: "service_call"
     activation_service: "switch/turn_on"
     deactivation_service: "switch/turn_off"
     # the power change is done by a service call
     change_power_service: "number/set_value"
     # the factor used to convert the set power into Amps (number.tesla_charging_amps takes Amps)
     convert_power_divide_factor: 3000     

Describe the bug

When my solar panels generate energy and the household consumption is in the negative range, the internal entity values are not updated correctly, the values of best_objective and total_power entities are unknown. However, the values of power_production and power_production_brut entities seem to be accurate and reflect the actual production. I also have some warning at HA startup on some entities (external and internal to the integration). At the end, the switch and power entity is not triggered.

Warning at HA startup

Logger: homeassistant.components.sensor Source: components/sensor/init.py:528 Integration: Sensor (documentation, issues) First occurred: 10:43:07 (3 occurrences) Last logged: 10:43:07

Entity sensor.total_power (<class 'custom_components.solar_optimizer.sensor.SolarOptimizerSensorEntity'>) is using state class 'total' which is impossible considering device class ('power') it is using; expected None or one of 'measurement'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/jmcollin78/solar_optimizer/issues Entity sensor.power_production (<class 'custom_components.solar_optimizer.sensor.SolarOptimizerSensorEntity'>) is using state class 'total' which is impossible considering device class ('power') it is using; expected None or one of 'measurement'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/jmcollin78/solar_optimizer/issues Entity sensor.power_production_brut (<class 'custom_components.solar_optimizer.sensor.SolarOptimizerSensorEntity'>) is using state class 'total' which is impossible considering device class ('power') it is using; expected None or one of 'measurement'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/jmcollin78/solar_optimizer/issues

jeremiesigrist commented 6 months ago

partially found the problem, the values for price of the exported and applicable tax must be >0

jmcollin78 commented 6 months ago

Yes and Power production and power consumption should be positive values. Else the Solar Optimizer cannot estimate properly

jmcollin78 commented 6 months ago

I close this issue, please reopen if you think, there is finally a real issue.