Okay, so HomeAssistant is growing with the addition of solar panels and its integration. Problem I run into is that the integration tosses consumption and production together so it requires adding sensors to the configuration file -and- I already have a template. The template I have is great from help on this forum in re holiday lights
Current yaml template with sensors:
template:
- trigger:
- platform: time
at: '00:00:00'
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
sensor:
- name: livingroom_tree_off
unique_id: livingroom_tree_off
state: "{{ (today_at('22:10') + timedelta(minutes = range(2,36) | random)).isoformat() }}"
device_class: timestamp
- name: familyroom_tree_off
unique_id: familyroom_tree_off
state: "{{ (today_at('21:00') + timedelta(minutes = range(2,36) | random)).isoformat() }}"
device_class: timestamp
- name: xmas_front_door_off
unique_id: xmas_front_door_off
state: "{{ (today_at('22:20') + timedelta(minutes = range(2,36) | random)).isoformat() }}"
device_class: timestamp
- name: upstairs_wrap_lights
unique_id: upstairs_wrap_lights
state: "{{ (today_at('20:00') + timedelta(minutes = range(2,36) | random)).isoformat() }}"
device_class: timestamp
I added the Envoy sensors to workaround this problem with the consumption/production miscount:
template:
- sensor:
# Generation to grid
- name: "Current Power Exporting"
unique_id: envoy_current_power_exporting
unit_of_measurement: 'W'
state: "{{ [0, (states('sensor.envoy_current_power_production') | int(0) - states('sensor.envoy_current_power_consumption') | int(0))] | max }}"
state_class: "measurement"
device_class: "power"
availability: "{{ not is_state('sensor.envoy_current_power_production', 'unavailable') and not is_state('sensor.envoy_current_power_consumption', 'unavailable') }}"
# Grid to house
- name: "Current Power Importing"
unique_id: envoy_current_power_importing
unit_of_measurement: 'W'
state: "{{ [0, (states('sensor.envoy_current_power_consumption') | int(0) - states('sensor.envoy_current_power_production') | int(0))] | max }}"
state_class: "measurement"
device_class: "power"
availability: "{{ not is_state('sensor.envoy_current_power_production', 'unavailable') and not is_state('sensor.envoy_current_power_consumption', 'unavailable') }}"
I get the following error:
duplicated mapping key (87:1)
84 | state: "{{ (today_at('2 …
85 | device_class: timestamp
86 |
87 | template:
------^
88 | - sensor:
This corresponds to the start of the new template. So I thought well maybe I have to combine them together to be one template. But doing that would mean adding sensors that run on this trigger for holiday lights.
I’m newb-challenged here and just lost on what I should do. All I know is that it seems I need to reproduce this Envoy integration- reversed sign of grid power - #5 by exxamalte into my setup in order to get the proper sensors for the energy dashboard.
Help to resolve greatly appreciated.