jmcollin78 / solar_optimizer

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

Using complex service calls which require data to be passed #11

Closed vyruz1986 closed 10 months ago

vyruz1986 commented 10 months ago

I came across your repository when scrolling through new HACS integrations yesterday, thanks a lot for making this, it is exactly what I was looking for!

I would like to start using this integration by enabling an electric heater I have connected to HA, but it doesn't operate with a simple on/off switch, it is configured as a climate entity.

The heater will have a preconfigured temperature, and needs to be set to 'heat' mode in order to start working towards achieving the set temperature.

An example of the action I have configured in an automation which enables this heater:

service: climate.set_hvac_mode
data:
  hvac_mode: heat

Is this possible with your integration? I assume not since the README doesn't mention this anywhere. I could of course create a helper switch with a linked automation that would take care of this, but that feels more convoluted in terms of maintainability down the line.

jmcollin78 commented 10 months ago

The action is already configurable (climate.set_hvac_mode) but I guess you don't have the possibility to specify the hvac_mode: heat which is specific to your UC.

What you can do, is to create a virtual switch that is controlled by the Solar Optimizer. This virtual switch call the seh_hvac_mode.

A model is this one (in another UC):

- platform:template
   switches:
     radiator_soan:
         friendly_name: radiator_soan_inv
         value_template: "{{ is_state('switch.radiateur_soan', 'off') }}"
         turn on:
           service: switch.turn_off
           data:
             entity_id: switch.radiateur_soan
         turn_off:
           service: switch.turn_on
           data:
             entity_id: switch.radiateur_soan
         icon_template: "{% if is_state('switch.radiateur_soan', 'on') %}mdi:radiator-disabled{% else %}mdi:radiator{% endif %}"
jmcollin78 commented 10 months ago

Is it ok for you ? May I close the issue ?