solar_optimizer
solar_optimizer copied to clipboard
For the attribute power_entity_id, the select domain is not accepted
First thanks for a great application!
This is related to #2 and similar in nature.
The BMW / Mini integration uses a selection list to set the charging current in steps of 1 A https://www.home-assistant.io/integrations/bmw_connected_drive#selects
If I put this in my configuration:
power_entity_id: "select.x1_xdrive25e_ac_charging_limit"
then I get an error:
Invalid config for 'solar_optimizer' at solar_optimizer.yaml, line 22: Entity select.x1_xdrive25e_ac_charging_limit belongs to domain select, expected ['input_number', 'number'] for dictionary value 'solar_optimizer->devices->0->power_entity_id', got 'select.x1_xdrive25e_ac_charging_limit'
I changed init.py for my installation a bit to test: ...
from homeassistant.components.number import DOMAIN as NUMBER_DOMAIN from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN from homeassistant.components.select import DOMAIN as SELECT_DOMAIN
... vol.Optional("power_entity_id"): selector.EntitySelector( selector.EntitySelectorConfig( domain=[INPUT_NUMBER_DOMAIN, NUMBER_DOMAIN, SELECT_DOMAIN]
After that the selection list is accepted and I can use service call select.select_option to set the value directly: ...the power change is done by a service call change_power_service: "select/select_option"
I'm using a input_number helper and automation for the moment to set the value but it's difficult to keep the values in sync as they can be changed by multiple applications. So it would be clearer and more stable to have a direct setup.
... action: select.select_option target: entity_id: select.x1_xdrive25e_ac_charging_limit data: option: "{{ int(states('input_number.x1_xdrive25e_ac_charging_limit')) }}"