StephanJoubert / home_assistant_solarman

Home Assistant component for Solarman collectors used with a variety of inverters.
Apache License 2.0
508 stars 190 forks source link

Way to control Deye Inverter #504

Open Ramaddan opened 5 months ago

Ramaddan commented 5 months ago

Hi,

First, one of the best Home Assistant addons out there for me.

I am using a Deye inverter SUN-8K-SG01LP1

I was wondering if there is a way to control anything on the inverter, as in change any setting from Home Assistant.

If there is, then a person can do many interesting things through Home Assistant.

Thanks

ChrisBGL commented 5 months ago

Yes, please integrate control. F.e. (de)active time of use in inverter config.

Ramaddan commented 4 months ago

Yes, one idea in mind is to be able to turn ON and OFF the gen force, remotely

Currently, have to go down and up a building in case I need to force turn ON the generator

krasnoukhov commented 3 weeks ago

I came up with a config to turn gen on/off for the deye invertor. I chose custom_parameters.yaml for the configuration, and changed the file slightly to this:

requests:
  - start: 0x0003
    end: 0x0070
    mb_functioncode: 0x03
  - start: 0x0096
    end: 0x00f9
    mb_functioncode: 0x03
  - start: 0x00FA
    end: 0x0146
    # end: 0x0117
    mb_functioncode: 0x03

parameters:
 # ... all the parameters from deye_hybrid ...
 - group: Settings
   items:
    - name: "Grid Charge Ampere"
      class: "current"
      uom: "A"
      scale: 1
      rule: 1
      registers: [0x00E6]
      icon: 'mdi:current-dc'
    - name: "Gen Force"
      class: ""
      uom: ""
      state_class: ""
      scale: 1
      rule: 1
      registers: [0x0146]
      icon: 'mdi:generator-stationary'
      lookup:
        - key: 0
          value: "Off"
        - key: 8192
          value: "On"

requests needs a change to be able to query 0x0146 which is "gen force" option. And then I have template switch that uses the service to turn on/off:

switch:
  - platform: template
    switches:
      gen_force:
        friendly_name: "Deye Gen Force"
        value_template: |
          {{ is_state("sensor.deye_gen_force", "On") }}
        turn_on:
          service: solarman.write_multiple_holding_registers
          data:
            register: 326
            values: "{{ [8192] }}"
        turn_off:
          service: solarman.write_multiple_holding_registers
          data:
            register: 326
            values: "{{ [0] }}"
        icon_template: >-
          {% if is_state("sensor.deye_gen_force", "On") %}
            mdi:engine
          {% else %}
            mdi:engine-off
          {% endif %}
Ramaddan commented 3 weeks ago

Hi,

Great!!! I will try to see if I can do it. Thanks

Ramaddan commented 3 weeks ago

Sorry, do I make the file custom_parameters.yaml, or is it supposed to be there?

If I make it, how do I make it recognizable to the system? Where do I call it?

Thanks

krasnoukhov commented 3 weeks ago

image

You can use "configure" for your existing integration to switch to custom parameters config. This is a file you edit manually, in solarman custom component directory

Ramaddan commented 3 weeks ago

Ok. Will try it when I am free. Thanks