azogue / aiopvpc

Simple aio library to download Spanish electricity hourly prices (PVPC) from esios.ree.es
MIT License
41 stars 9 forks source link

Sensor unit of measurement should use ISO 4217 monetary format #37

Open 3v1n0 opened 2 years ago

3v1n0 commented 2 years ago

As per documentation the sensor should set the native_unit_of_measurement as EUR/kWh and not as €/kWh.

In theory this would be required to get the sensor working as price source in the Energy panel, but still this doesn't seem to work in my case.

azogue commented 2 years ago

Hi @3v1n0,

I'm not sure about that 🧐. Docs point to ISO 4217 for type 'monetary', but the sensor has a composed unit: 'monetary / energy'.

I suppose that kind of unit arithmetic will be implemented sometime, but I think right now is not working as expected, and, in addition, the PVPC sensor is not defining a device_class attribute, as the current implementation is old and doesn't use 'devices', just a plain SensorEntity, so it wouldn't apply here, but thanks for pointing it out 👍

About the Energy panel integration:

In theory this would be required to get the sensor working as price source in the Energy panel, but still this doesn't seem to work in my case.

I didn't make any changes because it works for me as it is, by selecting the sensor as price source when configuring entities for the Energy panel, and I think for other users too.

ha-energy-select-price-entity ha-energy-panel-with-cost

Could you elaborate your problem? Don't you see the sensor.pvpc listed in the configuration panel?

Anyway, I'll try to pay attention for those evolving device classes so the sensor works optimally with HA 🤟