muppet3000 / homeassistant-grott

Home Assistant Integration for Grott - MQTT
MIT License
65 stars 14 forks source link

No battery values #10

Closed bartpaeleman closed 12 months ago

bartpaeleman commented 1 year ago

Got my GROTT docker container set up, and it is talking with my MQTT docker, sending values into my HA container through the Grott integration from Chris. I still have the old integration active too so I can update over all of my automations but I noticed that there are several values missing. I have nothing that shows info related to the batteries. Is this a Grott service or an integration problem?

I only get 1 device coming through MQTT while the old integration had 2. They may have rolled up into one, since the other integration showed my Shinelink LAN box as ID and now I get the Shinelink RF Stick ID that is in my inverter that connects to the Lanbox

I only see 31 entities on my detected device in Home Assistant Grott and none of them contain the battery related values that are now part opf the MQTT message (I installed the latest beta version after talking to the creator of the Grott).

Can I do something to get these into my Home Assistant system?

bartpaeleman commented 1 year ago

My temporary workaround is by adding sensors through my MQTT integration.

  sensor:
  - name: Home Battery Level
    unique_id: 001_batt_home
    state_topic: energy/growatt
    device_class: battery
    unit_of_measurement: "%"
    value_template: "{{ value_json['values']['bms_soc'] }}"
    icon: mdi:battery
Snux commented 1 year ago

In the grott add on, I changed the type to sph and all the missing battery values came through plus a load of other stuff

bartpaeleman commented 1 year ago

You are talking about the grott.ini file? I was in communication with the creator and he suggested since my template was not in the latest stable verrsion, to install the latest beta version with type=min after which I saw some of the values too. The problem is that the HA addon here doesn’t pick up my values since the names are different. My SOC is called bms_soc in the MQTT JSON.

muppet3000 commented 1 year ago

Hi Both,

Sorry for the delayed response, I've been on holiday.

Really glad to see that you've got it partially working and some of the values are coming through. If I remember correctly from the old integration @bartpaeleman your system is a min system, not an sph system, which explains why some of the values are missing.

I appreciate all of the information you've passed above, however, what I would really benefit from is a list of just the values that are missing when you run the integration and what you expect them to map to, that way I can then add them to this integration e.g something like this:

Once I have those I can add them in for you, if you don't know what all of them should be that's fine, just give me the ones that you know.

bartpaeleman commented 1 year ago

Hi @muppet3000, welcome back Chris. When I activate the integration these are the values that I see:

image image image

The values for the battery that you see in the list above (which came from activating the BETA docker-version that I was guided towards by the creator of the component, don’t show up. But there are also a lot of values that don’t seem to get picked up by the Grott docker in itself since the template is not recognized (probably several battery related)

https://github.com/johanmeijer/grott/issues/345

Yes, my sytem must be a MIN indeed, I even had to change the grott.ini file to use this value (upon advise of him) too: invtype = min

bartpaeleman commented 1 year ago

@muppet3000, not sure if this is of any help but I used the MQTT values that I get sent through the experimental ledidobe/grott:2.8.2 image with MIN support to extract a few values that I can use.

MQTT Sensors:

` - name: Home Battery Load unique_id: growatt_batteryload state_topic: energy/growatt device_class: battery unit_of_measurement: "%" value_template: "{{ value_json['values']['bms_soc'] }}" icon: mdi:solar-power

- name: Battery in vandaag
  unique_id: growatt_battery_in_vandaag
  state_topic: energy/growatt
  device_class: battery
  unit_of_measurement: "kWh"
  value_template: "{{ value_json['values']['echrtoday'] | float / 10 }}"
  icon: mdi:battery-plus-outline

- name: Battery uit vandaag
  unique_id: growatt_battery_uit_vandaag
  state_topic: energy/growatt
  device_class: battery
  unit_of_measurement: "kWh"
  value_template: "{{ value_json['values']['edischrtoday'] | float / 10 }}"
  icon: mdi:battery-minus-outline

- name: Battery in totaal
  unique_id: growatt_battery_in_totaal
  state_topic: energy/growatt
  state_class: total_increasing
  device_class: battery
  unit_of_measurement: "kWh"
  value_template: "{{ value_json['values']['echrtotal'] }}"
  icon: mdi:battery-plus-variant

- name: Battery uit totaal
  unique_id: growatt_battery_uit_totaal
  state_topic: energy/growatt
  state_class: total_increasing
  device_class: battery
  unit_of_measurement: "kWh"
  value_template: "{{ value_json['values']['edischrtotal'] }}"
  icon: mdi:battery-minus-variant

- name: Growatt - Datalogger serienr
  unique_id: growatt_datlogger_serial
  state_topic: energy/growatt
  value_template: "{{ value_json['device'] }}" 
  icon: mdi:select-inverse

- name: Growatt - Datum
  unique_id: growatt_date
  state_topic: energy/growatt
  value_template: "{{ as_timestamp(strptime(value_json['time'], '%Y-%m-%dT%H:%M:%S')) | timestamp_custom('%d-%m-%Y') }}" 
  icon: mdi:calendar

- name: Growatt - Tijd
  unique_id: growatt_time
  state_topic: energy/growatt
  value_template: "{{ as_timestamp(strptime(value_json['time'], '%Y-%m-%dT%H:%M:%S')) | timestamp_custom('%H:%M:%S') }}" 
  icon: mdi:clock-digital

- name: Growatt - Status
  unique_id: growatt_status
  state_topic: energy/growatt
  value_template: >
    {% if (value_json['values']['pvstatus'] | int == 0) %}
      Wachtend
    {% elif (value_json['values']['pvstatus'] | int == 1) %}
      Normaal
    {% elif (value_json['values']['pvstatus'] | int == 2) %}
      Fout
    {% else %}
      Onbekend
    {% endif %}
  icon: mdi:power-settings

- name: Growatt - Vermogen uit
  unique_id: growatt_string1_watt
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvgridpower'] | float / 10000 }}" 
  device_class: power
  unit_of_measurement: "kW"

- name: Growatt - Voltage uit
  unique_id: growatt_string1_voltage
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvgridvoltage'] | float / 10 }}" 
  device_class: voltage
  unit_of_measurement: "V"

- name: Growatt - Stroom uit
  unique_id: growatt_string1_current
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvgridcurrent'] | float / 10 }}" 
  device_class: current
  unit_of_measurement: "A"

- name: Growatt - Input wattage (Actueel)
  unique_id: growatt_actual_input_power
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvpowerin'] | float / 10000 }}" 
  device_class: power
  unit_of_measurement: "kW"

- name: Growatt - Output wattage (Actueel)
  unique_id: growatt_actual_output_power
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvpowerout'] | float / 10000 }}" 
  device_class: power
  unit_of_measurement: "kW"

- name: Growatt - Gridfrequentie
  unique_id: growatt_grid_frequency
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvfrequentie'] | float / 100 }}" 
  unit_of_measurement: "Hz"
  icon: mdi:waveform

- name: Growatt - Fase voltage
  unique_id: growatt_phase_voltage
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvgridvoltage'] | float / 10 }}" 
  device_class: voltage
  unit_of_measurement: "V"

- name: Growatt - Opgewekte energie (Vandaag)
  unique_id: growatt_generated_energy_today
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvenergytoday'] | float / 10 }}" 
  device_class: energy
  unit_of_measurement: "kWh"
  icon: mdi:solar-power

- name: Growatt - Opgewekte energie (Totaal)
  unique_id: growatt_generated_energy_total
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvenergytotal'] | float / 10 }}" 
  device_class: energy
  state_class: total_increasing
  unit_of_measurement: "kWh"
  icon: mdi:solar-power

- name: Growatt - Inverter temperatuur
  unique_id: growatt_inverer_temperature
  state_topic: energy/growatt
  value_template: "{{ value_json['values']['pvtemperature'] | float / 10 }}" 
  device_class: temperature
  unit_of_measurement: "°C" 

`

image
muppet3000 commented 1 year ago

@bartpaeleman Please could you try pulling the 'main' version of this integration via HACS and then letting me know if the missing battery values now appear?

bartpaeleman commented 1 year ago

@muppet3000 will do and will check in the morning to let you know. Do I keep the type=min in my grott.ini that I had to put there for the beta version?

muppet3000 commented 1 year ago

Yes, don't change anything with your Grott configuration, simply just pull the 'main' version of this integration through hacs and it should pull in the battery values (you can confirm this by looking in the 'devices' section of HA). The names of the values should appear from this list: https://github.com/muppet3000/homeassistant-grott/commit/c7f0a06d1dcdec21a45b3e02a4fde7545183e088 (I've tried to keep them consistent with other sensor names from other types)

bartpaeleman commented 1 year ago

Done, now restarting and will check tomorrow morning once my MQTT values come in if I see a change.

muppet3000 commented 1 year ago

Do your MQTT values not get pushed every few minutes from the Shine Wifi stick? The new sensors should appear as soon as there is a push to MQTT.

bartpaeleman commented 1 year ago

@muppet3000 I have a ShineLink-X RF stick, not WiFi and it seems to be pretty unstable.The values aren’t really sent within minutes, it can take up to 20 minutes or more before I see something. I had replaced my docker container with the latest version yesterday (thinking that was what you expected) initially and didn’t see much. This morning I have rebuilt the container with the image that I had before 2.8.2) but am still waiting after 19 minutes to see values appear,

bartpaeleman commented 1 year ago

They just passed through my GROTT log but nothing visible in the integration yet. My MQTTlistener caught these values in growatt/energy:

{ "device": "ADJ0B1302U", "time": "2023-06-21T07:40:03", "buffered": "no", "values": { "pvserial": "ADJ0B1302U", "pvstatus": 1, "pvpowerin": 4048, "pv1voltage": 2561, "pv1current": 7, "pv1watt": 1954, "pv2voltage": 2574, "pv2current": 8, "pv2watt": 2094, "pv3voltage": 0, "pv3current": 0, "pv3watt": 0, "pv4voltage": 0, "pv4current": 0, "pv4watt": 0, "pvpowerout": 4620, "pvfrequentie": 4998, "pvgridvoltage": 2337, "pvgridcurrent": 20, "pvgridpower": 4623, "pvgridvoltage2": 0, "pvgridcurrent2": 0, "pvgridpower2": 0, "pvgridvoltage3": 0, "pvgridcurrent3": 0, "pvgridpower3": 0, "vacrs": 2337, "vacst": 0, "vactr": 0, "ptousertotal": 4092, "ptogridtotal": 0, "ptoloadtotal": 10020, "totworktime": 74390734, "pvenergytoday": 19, "pvenergytotal": 71314, "epvtotal ": 75426, "epv1today ": 2, "epv1total": 37299, "epv2today": 1, "epv2total": 38127, "epv3today": 0, "epv3total": 0, "etousertoday": 23, "etousertotal": 35853, "etogridtoday": 1, "etogridtotal": 24295, "eloadtoday": 50, "eloadtotal": 89378, "deratingmode": 0, "iso": 65530, "dcir": 0, "dcis": 0, "dcit": 0, "gfci": 0, "pvtemperature": 348, "pvipmtemperature": 348, "temp3": 0, "temp4": 0, "temp5": 432, "pbusvoltage": 3740, "nbusvoltage": 0, "ipf": 20000, "realoppercent": 12, "opfullwatt": 0, "standbyflag": 0, "faultcode": 0, "warningcode": 0, "systemfaultword0": 0, "systemfaultword1": 0, "systemfaultword2": 592, "systemfaultword3": 592, "systemfaultword4": 27, "systemfaultword5": 0, "systemfaultword6": 0, "systemfaultword7": 0, "invstartdelaytime": 60, "bdconoffstate": 1, "drycontactstate": 0, "edischrtoday": 25, "edischrtotal": 18642, "echrtoday": 0, "echrtotal": 16248, "eacchrtoday": 0, "eacchrtotal": 1835, "priority": 0, "epsfac": 0, "epsvac1": 0, "epsiac1": 0, "epspac1": 0, "epsvac2": 0, "epsiac2": 0, "epspac2": 0, "epsvac3": 0, "epsiac3": 0, "epspac3": 0, "epspac": 0, "loadpercent": 0, "pf": 10000, "dcv": 0, "bdc1_sysstatemode": 513, "bdc1_faultcode": 0, "bdc1_warncode": 701, "bdc1_vbat": 20445, "bdc1_ibat": 9, "bdc1_soc": 14, "bdc1_vbus1": 3731, "bdc1_vbus2": 1894, "bdc1_ibb": 2, "bdc1_illc": 2, "bdc1_tempa": 315, "bdc1_tempb": 0, "bdc1_pdischr": 1880, "bdc1_pchr": 0, "bdc1_edischrtotal": 18642, "bdc1_echrtotal": 16248, "bdc1_flag": 1, "bdc2_sysstatemode": 42, "bdc2_faultcode": 11, "bdc2_warncode": 0, "bdc2_vbat": 306, "bdc2_ibat": 286, "bdc2_soc": 2, "bdc2_vbus1": 14, "bdc2_vbus2": 0, "bdc2_ibb": 0, "bdc2_illc": 1, "bdc2_tempa": 0, "bdc2_tempb": 50, "bdc2_pdischr": 3276800, "bdc2_pchr": 0, "bdc2_edischrtotal": 0, "bdc2_echrtotal": 0, "bdc2_flag": 0, "bms_status": 4, "bms_error": 0, "bms_warninfo": 0, "bms_soc": 14, "bms_batteryvolt": 20480, "bms_batterycurr": 65496, "bms_batterytemp": 434, "bms_maxcurr": 2500, "bms_deltavolt": 2500, "bms_cyclecnt": 0, "bms_soh": 100, "bms_constantvolt": 22720, "bms_bms_info": 18880, "bms_packinfo": 0, "bms_usingcap": 0, "bms_fw": 10275, "bms_mcuversion": 0, "bms_commtype": 0 } }

muppet3000 commented 1 year ago

Just to be clear, you're getting some values in the Grott integration in HA, just not the new battery ones I added?

Can you please confirm that you're definitely using the 'main' branch of the Integration, not the latest release? Go to the HACS integration and look in the top left corner when you're on the Grott page: image

bartpaeleman commented 1 year ago

I am going to remove my current one (says v1.01) and will disable my custom MQTT values, then pull the main again and reboot. image

Update will follow.

muppet3000 commented 1 year ago

Ok, that's the issue then, you need to re-download and then choose "main" from the dropdown:

  1. image

  2. image

Don't forget to restart HA afterwards

bartpaeleman commented 1 year ago

Something weird going on then. I did as you wrote, grabbed the MAIN but after reboot: image

Going to remove both integrations ()including the other Growatt one), reboot and then do it all over again.

bartpaeleman commented 1 year ago

Got it Chris, now I will wait and see what appears: image

bartpaeleman commented 1 year ago

Looking good Chris!! image image image

muppet3000 commented 1 year ago

Woop woop! I'm just working through some stuff over on #15 but hopefully we're mostly fixed then!

bartpaeleman commented 1 year ago

Enjoy the Paypal beers Chris ;)

muppet3000 commented 1 year ago

Thanks @bartpaeleman 🍺

I'll close this ticket off when I do the next release.

muppet3000 commented 12 months ago

Released in v1.1.0