Add new Sensor with Docker installation

Hi there,
for my solar Dashboard I need to calculate the total production of my solar system (just adding 2 sensor values together). The way most people seem to do this is by accessing the configuration file and just adding the sensor values but because of the docker installation I cant get the File Editor because docker doesnt support the AddOnStore. So I tried adding the value over the “file” integration from settings (as file based sensor) with the following code:

- sensor:
      - name: totalPV
        unique_id: "tpv"
        state: >- {{ ((float(states('sensor.solax_svhfdtcfev_pv1_power'))) + (float(states('sensor.solax_svhfdtcfev_pv2_power'))))}}

Wich gives me this error:
It appears you may be writing YAML into this template field (saw ‘sensor:’), which is likely incorrect. This field is intended for templates only (e.g. {{ states(sensor.test) > 0 }} ).

There also is a field for entering the file path but I have no idea what to enter since this is my first time working with Home Assistant.

Thanks is advance!

Edit:
This helped me:

You are using the UI to create the sensor, and you pasted the entire YAML config into the box where only the template goes.

If you’re going to use the UI you only paste the template, which is the portion with the curly brackets:
{{ ((float(states('sensor.solax_svhfdtcfev_pv1_power'))) + (float(states('sensor.solax_svhfdtcfev_pv2_power'))))}}

If you are going to skip the UI and instead create the sensor by adding it to your configuration.yaml file, then you would paste the entire YAML config there.

1 Like

You can use any file editor that can access the configuration files of HA.

I use WinSCP to gain access to the HA config files and use Notepad++ as my file editor.

you don’t need any add-ons.

I don’t think the “file” integration is what you think it is.

the file integration won’t allow you to set up a typical “sensor” based on the contents of the file. Did you look at the File integration documentation?

The HA Container (docker based) installation method is kind of for users who know a bit about how HA works under the hood so it’s probably best for you to either take the time to really understand HA and how the pieces work together or go the easier route and run a Supervisor based install type - preferably HA OS.

1 Like