Skip to content

Home Assistant configuration examples

Johan Meijer edited this page Nov 7, 2022 · 5 revisions

Below 2 examples on how Grott can be integrated with Home Assistent

Be aware at this moment HA integration seems to change a lot. Read issue/discussions about the latest status and updates.

See also the examples/Home Assistent directory for actual examples and grott/extensions.

More generic information on home-assistent add-ons can be found at: https://developers.home-assistant.io/docs/add-ons/tutorial

Example 1

(Contributed by @jeltel)

-Sensors:
    platform: mqtt
    state_topic: energy/growatt
    value_template: "{{ value_json['values']['pvenergytoday'] | int / 10 }}" 
    name: Elektra Opgewekt Vandaag
    unit_of_measurement: "kWh"
    icon: mdi:solar-power

This is the general format.

  • The state_topic is your MQTT topic on which the json is published by Grott
  • Value_template converts the specific attribute to the right number.
    • value_json['values']['pvenergytoday']will take the pvenergytoday. Replace it with every other attribute in the values attribute to get that one. If you want time for example, you can just dovalue_json.time`
    • | int converts it into an integer so we can do calculations on it
    • /10 divides by 10 to get the correct value
  • Name: Speaks for itself
  • Unit_of_measurement kan be anything you like, as long as its a string
  • Icon: taken from https://materialdesignicons.com/ Any icon prefixed with mdi: will work

IMPORTANT! get the right string characters around the value_template. Its a double quote " " around the whole template. And a single quote ' ' around the attribute name (I was messing around with that before I got it right).

Example 2

(contribute by Jeroen Bos, @jerommeke-bos)

In the grott examples/Home Assistent directory (https://github.com/johanmeijer/grott/tree/master/examples/Home%20Assistent) you can find the examples for the sensors yaml

These files will expose all the entities from Grott to HA, including some dummy sensors for the type of the inverter and the type and serial number of the datalogger (These should be set by hand):

sensors_grott_eng.yaml (english version)
sensors_grott_eng.yaml (dutch version)

The only thing that has to be done in HA is:

  • Create a folder in the homeassitant folder named "sensors"
  • Copy, when exists, the sensors.yaml file into the newly created directory or move your senors to a file named "sensors.yaml" into the the newly created directory.
  • Add the "sensors_growatt_eng.yaml" or "sensors_growatt_nl.yaml" file to the the newly created directory.
  • Add or replace the "sensor:" to "sensor: !include_dir_merge_list sensors/"
  • Restart HA and the new sensors will be available, you'll find them on within the entities list (search for growatt).

For more information, see: https://www.home-assistant.io/docs/configuration/splitting_configuration/

All has been tested with the latest docker version of Grott , a MIN 4200TL-XE inverter and ShineLink X datalogger.

Additional remark:

If you want to use the data in the energy dashboard they need a "last reset" attribute. So I added this to my configuration file so the total and day value get a last reset date:

homeassistant:
  customize_glob:
    sensor.growatt_*_energy*:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: measurement