Skip to content

BUG: yaml configuration is not working #2

@robinostlund

Description

@robinostlund

HI,
First off thanks for creating this integration i will try to use this to track the energy peak cost from our grid company.
But i noticed that configuring this through yaml isn't working but the ui does. It says that it expects a dictionary and not a list which is provided in the documentation. However when i tried to change to a dictionary structure it failed. Am i doing something wrong? :)

This is what i tried:

---
template:
  - sensor:
    - name: "Power Tracking Grid Sensor"
      icon: mdi:transmission-tower-import
      device_class: power
      state_class: measurement
      unit_of_measurement: W
      state: >
        {# COMMENT: get power #}
        {% set power = int(states('sensor.esp_energy_meter_main_p1_momentary_active_import'), 0) %}

        {# COMMENT: half price during these hours #}
        {% set hour_now = now().hour %}
        {% if hour_now >= 22 or hour_now < 6 %}
          {% set power = power / 2 %}
        {% endif %}

        {# COMMENT: return power #}
        {{ power | round(0) }}

power_max_tracker:
   - source_sensor: sensor.power_tracking_grid_sensor
     num_max_values: 3
     monthly_reset: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions