Uncategorised

Add Entities

To create a new entity within the code then you need access to the config file.

To do this go to Settings –> Add-on –> Addon Store and find Visual Studio Code

Click on Visual Studio Code and click Install.

Select Start on boot, Watchdog and Show in sidebar, then click start

You will now have Studio Code Server

Locate configuration.yaml on the left and you can edit it on the right.

Now you need to find the 2 Entities you need to add together.
In the sidebar select Development Tools and then the states tab.
For this example we need to add the 2 PV string power together to get the total PV Power

The 2 entities to add together are

sensor.solarsynk_inverter_pv1_power & sensor.solarsynk_inverter_pv2_power

sensor:
  platform: template
  sensors:
    solarsynk_inverter_total_pv_power:
      friendly_name: "Solarsynk Inverter Total PV Power"
      unit_of_measurement: W
      device_class: power
      value_template: >
        "{{ states('sensor.solarsynk_0123456789_pv1_power')| float +  states('sensor.solarsynk_0123456789_pv2_power')| float }}"

Now you have to go to the sidebar and select Development Tools and the YAML Tab

Click on Check Configuration and as long as it says
Configuration will not prevent Home Assistant from starting!
You are good to click the restart button.

Every time you change any code in the configuration.yaml you must restart Home Assistant for it to take effect.

Once Home Assistant has rebooted go back to Development Tools and the states Tab then Set States and type in solarsynk_inverter_total_pv_power

you will now have the entity for total PV Power

Leave a Reply

Your email address will not be published. Required fields are marked *