#can we create a regular entity from a statistic?

1 messages · Page 1 of 1 (latest)

lapis ferry
#

for the SolarEdge integration, we have an option to use their statistics as described in the documentation

It is made clear there that entities are not created for those, on purpose.

Ive used the CC Solaredgeoptimizers for some time now, but since that is broken because of API endpoint changes I need a new solution..

I am not particularly after the SQL suggestions in the docs, but would like to create single entities for the stats we have. So I can add those to entities cards, or other UI elements displaying the current value per Panel.

Would anyone be able to tell me if this can be done, and preferably how 😉

GitHub

Intergration to get optimizers information from the SolarEdge portal - ProudElm/solaredgeoptimizers

Home Assistant

Instructions on how to integrate SolarEdge sensor within Home Assistant.

rose kestrel
lapis ferry
#

thanks. I can indeed use that action but it requires careful setting all of the options... it's not very obvious to simply get the state for these statistics each hour.
Would you know if we can write an SQL query t do that and query the state only for that now() ? Turning that into a sensor

rose kestrel
lapis ferry
#

Sure… what I meant to ask is: what would that query look like 😉

rose kestrel
lapis ferry
#

working with this for now:

template:
  - triggers:
      - trigger: time_pattern
        minutes: 0
      - trigger: homeassistant
        event: start
      - trigger: event
        event_type: event_template_reloaded

    actions:
      - action: recorder.get_statistics
        response_variable: optimizer_stats
        data:
          start_time: '{{ now()- timedelta(hours=1)  }}'
          end_time: '{{ now() }}'
          statistic_ids:
            - solaredge:<site-id>_<panel_id>
            - solaredge:<site-id>_<panel_id>2
            - etc
          period: hour
          types:
            - state
            - sum

    sensor:
      - name: SolarEdge optimizer 1.0.8
        unique_id: solaredge_optimizer_1.0.8_statistics
        unit_of_measurement: 'W'
        device_class: power
        state_class: measurement
        state: >
          {{ optimizer_stats.statistics['solaredge:<site-id>_<panel_id>'][0].state | round(0) }}
        attributes:
          sum: >
            {{ optimizer_stats.statistics['solaredge:<site-id>_<panel_id>'][0].sum | round(0) }}
          last_updated: '{{ now() }}'```