I am trying to make a new sensor which is the sum of two other sensors.
I tried making the change using the template option in design tools and I can see that it seems to work, it calculated the correct value.
I also tried using the studio code server, frankly I am a clueless noobie
when I try to restart HA I get an error
attached is a picture of the code in config.yaml and also the error on restart
I think lines 15-18 need to have 2 spaces removed from each line, they are indented too much. Im not sn expert in yaml, but I think that is not correct.
Please don’t post images of text. Copy and paste the text and use three backticks (```) above and below if it’s YAML.
Lines 13 and on should look like this:
sensor:
- platform: template
sensors:
...
Naturally, don’t actually put the ellipsis. I just included that to avoid typing everything out.
Technically, you should also move the lines starting from gridtie_totalsolar: back two spaces as well as Mark mentioned.
Replace float with float(0)
sensor.Grid_tie_input_2_1min isn’t a valid entity ID because of the capital G. Double-check what that entity actually is in your system by looking at developer tools > states.
Thanks for the help
I changed the file, hopefully like you requested.
Loads default set of integrations. Do not remove.
default_config:
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
ffmpeg:
- platform: template
sensors:
gridtie_totalsolar:
friendly_name: "Grid Tie Solar Generation - Total"
value_template: "{{ states('sensor.sb6_0_1sp_us_41_511_grid_power') | float(0)+ states('sensor.grid_tie_input_2_1min') | float(0)}}"
unit_of_measurement: 'watts'
here is the new error I am getting now
Failed to restart Home Assistant
The system cannot restart because the configuration is not valid: Error loading /config/configuration.yaml: mapping values are not allowed here in “/config/configuration.yaml”, line 2, column 15
IT WORKED
thanks very much
I have a few others to add, so I will copy exactly what you provided , cant check the math yet on the sensor til the sun shines tomorrow
thanks again