xion2000
(Graham)
October 29, 2019, 8:00pm
1
I have setup PVOutput via a sensor to upload to my HA which is now setup and working nicelly thanks to help from members of this forum. I’m now trying to add another upload from my second PV array but I cannot get it to work like the first, it appears to overwrite my first sensor, I have tied changing several variables but still no success. this is my latest configuration that is still not working, can anyone see my mistake?
sensor 1:
- platform: pvoutput
system_id: 12345
name: Garage
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
scan_interval: 155
- platform: template
sensors:
power_consumption:
value_template: '{% if is_state_attr("sensor.garage.pvoutput", "household_power_consumption", "NaN") %}0{% else %}{{ state_attr(''sensor.garage.pvoutput'', ''household_power_consumption'') }}{% endif %}'
friendly_name: 'Household Using'
unit_of_measurement: 'Watt'
energy_consumption:
value_template: '{{ "%0.1f"|format(state_attr(''sensor.garage.pvoutput'', ''household_energy_consumption'')|float/1000) }}'
friendly_name: 'Household Used'
unit_of_measurement: 'kWh'
power_generation:
value_template: '{% if is_state_attr("sensor.garage.pvoutput", "garage_power_generation", "NaN") %}0{% else %}{{ state_attr(''sensor.garage.pvoutput'', ''garage_power_generation'') }}{% endif %}'
friendly_name: 'Garage Solar Generating'
unit_of_measurement: 'Watt'
energy_generation:
value_template: '{% if is_state_attr("sensor.garage.pvoutput", "garage_energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(state_attr(''sensor.garage.pvoutput'', ''garage_energy_generation'')|float/1000) }}{% endif %}'
friendly_name: 'Garage Solar Generated'
unit_of_measurement: 'kWh'
sensor 2:
- platform: pvoutput
system_id: 56789
name: Shed
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
scan_interval: 155
- platform: template
sensors:
power_generation:
value_template: '{% if is_state_attr("sensor.shed.pvoutput", "shed_power_generation", "NaN") %}0{% else %}{{ state_attr(''sensor.shed.pvoutput'', ''shed_power_generation'') }}{% endif %}'
friendly_name: 'Shed Solar Generating'
unit_of_measurement: 'Watt'
energy_generation:
value_template: '{% if is_state_attr("sensor.shed.pvoutput", "shed_energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(state_attr(''sensor.shed.pvoutput'', ''shed_energy_generation'')|float/1000) }}{% endif %}'
friendly_name: 'Shed Solar Generated'
unit_of_measurement: 'kWh'
My initial configurations only mentioned “garage” & “shed” in the “name” & “friendly names” but I’ve added then into the formatting more in an attend to separate the 2 sensors (both PVOutput ID’s share the same api code)
You need different names for your template sensors.
power_generation1
power_generation2
energy_generation1
energy_generation2
…
xion2000
(Graham)
October 29, 2019, 9:07pm
3
Thanks but I’m still a bit of a novice, where do I put that info in my configuration
- platform: template
sensors:
power_consumption:
value_template: '{% if is_state_attr("sensor.garage.pvoutput", "household_power_consumption", "NaN") %}0{% else %}{{ state_attr(''sensor.garage.pvoutput'', ''household_power_consumption'') }}{% endif %}'
friendly_name: 'Household Using'
unit_of_measurement: 'Watt'
energy_consumption:
value_template: '{{ "%0.1f"|format(state_attr(''sensor.garage.pvoutput'', ''household_energy_consumption'')|float/1000) }}'
friendly_name: 'Household Used'
unit_of_measurement: 'kWh'
power_generation1: # <---
value_template: '{% if is_state_attr("sensor.garage.pvoutput", "garage_power_generation", "NaN") %}0{% else %}{{ state_attr(''sensor.garage.pvoutput'', ''garage_power_generation'') }}{% endif %}'
friendly_name: 'Garage Solar Generating'
unit_of_measurement: 'Watt'
energy_generation1: # <---
value_template: '{% if is_state_attr("sensor.garage.pvoutput", "garage_energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(state_attr(''sensor.garage.pvoutput'', ''garage_energy_generation'')|float/1000) }}{% endif %}'
friendly_name: 'Garage Solar Generated'
unit_of_measurement: 'kWh'
sensor 2:
- platform: pvoutput
system_id: 56789
name: Shed
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
scan_interval: 155
- platform: template
sensors:
power_generation2: # <---
value_template: '{% if is_state_attr("sensor.shed.pvoutput", "shed_power_generation", "NaN") %}0{% else %}{{ state_attr(''sensor.shed.pvoutput'', ''shed_power_generation'') }}{% endif %}'
friendly_name: 'Shed Solar Generating'
unit_of_measurement: 'Watt'
energy_generation2: # <---
value_template: '{% if is_state_attr("sensor.shed.pvoutput", "shed_energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(state_attr(''sensor.shed.pvoutput'', ''shed_energy_generation'')|float/1000) }}{% endif %}'
friendly_name: 'Shed Solar Generated'
unit_of_measurement: 'kWh'
No matter if you do the ‘sensor 2’ syntax, it results in a ‘sensor.xxxx’ so if you use the same identifier, it sesults (or should raise an error, wondering why not) in the same sensor.
VDRainer
(🍻)
October 29, 2019, 10:00pm
5
Ooops, sorry, seperate from the same template sensor identifiers, i realized now that the problem is the second pvoutput sensor.
Do you get two sensors with the same values, or only one pvoutput sensor?
xion2000
(Graham)
October 31, 2019, 11:24pm
6
Whatever settings I choose for the second account they always seem to affect the first account, either by a giving an error when selected in the GUI or displaying no error but also no data. I’ve tried adding a number to the "sensor.pvoutput_2" or "power_generation_2" or "sensor_2.pvoutput" or "power_2_generation".
daklein
(Dale)
July 31, 2020, 9:04pm
7
Hello Graham @xion2000 Figure it out? I have a similar question with having multiple enphase envoy solar monitors. Thanks
xion2000
(Graham)
August 1, 2020, 5:10am
8
sensor 1:
- platform: pvoutput
system_id: 11144
name: pvoutput_garage_solar
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
scan_interval: 150
- platform: template
sensors:
pvoutput_garage_solar_power_generation:
value_template: '{% if is_state_attr("sensor.pvoutput_garage_solar", "power_generation", "NaN") %}0{% else %}{{ state_attr(''sensor.pvoutput_garage_solar'', ''power_generation'') }}{% endif %}'
friendly_name: 'PVOutput Garage Solar Generating'
unit_of_measurement: 'w'
pvoutput_garage_solar_energy_generation:
value_template: '{% if is_state_attr("sensor.pvoutput_garage_solar", "energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(state_attr(''sensor.pvoutput_garage_solar'', ''energy_generation'')|float/1000) }}{% endif %}'
friendly_name: 'PVOutput Garage Solar Generated'
unit_of_measurement: 'kWh'
sensor 2:
- platform: pvoutput
system_id: 26277
name: pvoutput_shed_solar
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
scan_interval: 180
- platform: template
sensors:
pvoutput_shed_solar_power_generation:
value_template: '{% if is_state_attr("sensor.pvoutput_shed", "power_generation", "NaN") %}0{% else %}{{ state_attr(''sensor.pvoutput_shed'', ''power_generation'') }}{% endif %}'
friendly_name: 'PVOutput Shed Solar Generating'
unit_of_measurement: 'w'
pvoutput_shed_solar_energy_generation:
value_template: '{% if is_state_attr("sensor.pvoutput_shed", "energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(state_attr(''sensor.pvoutput_shed'', ''energy_generation'')|float/1000) }}{% endif %}'
friendly_name: 'PVOutput Shed Solar Generated'
unit_of_measurement: 'kWh'
sensor 3:
- platform: pvoutput
system_id: 18155
name: pvoutput_gas
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
scan_interval: 150
- platform: template
sensors:
pvoutput_gas_power_consumption:
value_template: '{% if is_state_attr("sensor.pvoutput_gas", "power_consumption", "NaN") %}0{% else %}{{ state_attr(''sensor.pvoutput_gas'', ''power_consumption'') }}{% endif %}'
friendly_name: 'PVOutput Gas Using'
unit_of_measurement: 'w'
pvoutput_gas_energy_consumption:
value_template: '{{ "%0.1f"|format(state_attr(''sensor.pvoutput_gas'', ''energy_consumption'')|float/1000) }}'
friendly_name: 'PVOutput Gas Used'
unit_of_measurement: 'kWh'
sensor 4:
- platform: pvoutput
system_id: 13551
name: pvoutput_solar_total
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
scan_interval: 150
- platform: template
sensors:
pvoutput_solar_total_power_generation:
value_template: '{% if is_state_attr("sensor.pvoutput_solar_total", "power_generation", "NaN") %}0{% else %}{{ state_attr(''sensor.pvoutput_solar_total'', ''power_generation'') }}{% endif %}'
friendly_name: 'PVOutput Total Solar Generating'
unit_of_measurement: 'w'
pvoutput_solar_total_energy_generation:
value_template: '{% if is_state_attr("sensor.pvoutput_solar_total", "energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(state_attr(''sensor.pvoutput_solar_total'', ''energy_generation'')|float/1000) }}{% endif %}'
friendly_name: 'PVOutput Total Solar Generated'
unit_of_measurement: 'kWh'
sensor 5:
- platform: pvoutput
system_id: 24468
name: pvoutput_wood_burner_fan
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
scan_interval: 150
- platform: template
sensors:
pvoutput_wood_burner_fan_power_consumption:
value_template: '{% if is_state_attr("sensor.pvoutput_wood_burner_fan", "power_consumption", "NaN") %}0{% else %}{{ state_attr(''sensor.pvoutput_wood_burner_fan'', ''power_consumption'') }}{% endif %}'
friendly_name: 'PVOutput Wood Burner Fan Electricity Using'
unit_of_measurement: 'w'
pvoutput_wood_burner_fan_energy_consumption:
value_template: '{{ "%0.1f"|format(state_attr(''sensor.pvoutput_wood_burner_fan'', ''energy_consumption'')|float/1000) }}'
friendly_name: 'PVOutput Wood Burner Fan Electricity Used'
unit_of_measurement: 'kWh'
sensor 6:
- platform: pvoutput
system_id: 12057
name: pvoutput_electricity
api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
scan_interval: 150
- platform: template
sensors:
pvoutput_electricity_power_consumption:
value_template: '{% if is_state_attr("sensor.pvoutput_electricity", "power_consumption", "NaN") %}0{% else %}{{ state_attr(''sensor.pvoutput_electricity'', ''power_consumption'') }}{% endif %}'
friendly_name: 'PVOutput Electricity Importing'
unit_of_measurement: 'w'
pvoutput_electricity_energy_consumption:
value_template: '{{ "%0.1f"|format(state_attr(''sensor.pvoutput_electricity'', ''energy_consumption'')|float/1000) }}'
friendly_name: 'PVOutput Electricity Imported'
unit_of_measurement: 'kWh'
This works for me.
1 Like
wifi75
(wifi)
August 24, 2021, 12:43pm
9
what is line for insert exported and inported power and energy?