home_assistant_solarman icon indicating copy to clipboard operation
home_assistant_solarman copied to clipboard

Way to control Deye Inverter

Open Ramaddan opened this issue 1 year ago • 21 comments

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

Ramaddan avatar Jan 30 '24 02:01 Ramaddan

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

ChrisBGL avatar Feb 01 '24 15:02 ChrisBGL

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

Ramaddan avatar Feb 04 '24 00:02 Ramaddan

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 %}

krasnoukhov avatar Jun 05 '24 11:06 krasnoukhov

Hi,

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

Ramaddan avatar Jun 07 '24 16:06 Ramaddan

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

Ramaddan avatar Jun 07 '24 17:06 Ramaddan

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

krasnoukhov avatar Jun 08 '24 08:06 krasnoukhov

Ok. Will try it when I am free. Thanks

Ramaddan avatar Jun 09 '24 23:06 Ramaddan

Hi. I was very busy for a long time from being able to try anything.

I apologize for that.

I am finally going to try right now.

I made my own custom parameter config

I just need to know if I also need to add the template swith in the same file, ex: custom_parameters.yaml

Or does it go into the home assistant configuration.yaml file?

Is it possible to add it to the same file without having to go to configuration.yaml?

Thank you very much for your help

Ramaddan avatar Sep 06 '24 22:09 Ramaddan