skelgaard / homeassistant-apsystems

An APsystems Sensor for Home Assistant
Apache License 2.0
25 stars 9 forks source link

Not able to see sensor in Energy dashboard #7

Closed rik246810 closed 2 years ago

rik246810 commented 2 years ago

Hello, I'm not able to see the sensor.apsystems energy dayin the energy dashboard. How can I fix this?

synack666 commented 2 years ago

Hi, you have to set device_class and state_class in customize.yaml

sensor.apsystems_energy_day:
  device_class: energy
  state_class: total_increasing
Machiel92 commented 2 years ago

That did the trick! Cool cool!

Now i'm going to look if it's possible to inport the total generated power into home assistant.

sjakief commented 2 years ago

Hi, I can see the sensors ( 5 sensors, 1 date sensor,2 kwh and 2 kw sensors from developer menu, and the values are being filled afbeelding

In my separate config file I put this: `sensor.apsystems_energy_day: device_class: energy state_class: total_increasing

sensor.apsystems_energy_latest: device_class: energy

sensor.apsystems_energy_total: device_class: energy

sensor.apsystems_power_max_day: device_class: energy

sensor.apsystems_power_latest: device_class: energy`

I can still see nothing to add in my energy dashboard. can someone explain what I am doing wrong?

maprolim commented 2 years ago

Another way is to create a Template Sensor that use the original sensor as reference:

To do that, put this lines in the configuration.yaml

template:
  - sensor:
      - name: "Energy APS Day MOD"
        unit_of_measurement: 'kWh'
        state: >
          {{ (states("sensor.apsystems_energy_day") | float) | round(2) }}       
        device_class: energy
        state_class: total_increasing
        attributes:         
          last_reset: '1970-01-01T00:00:00+00:00'
sjakief commented 2 years ago

I made a template sensor as you describbed above and I think it works, I had to wait until today to get the right values. I didn't use last_reset: '1970-01-01T00:00:00+00:00' attribute though, seems to work just fine without it.