StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
624 stars 112 forks source link

Energy attribute #61

Closed Limych closed 4 years ago

Limych commented 5 years ago

Please add energy attribute for devices. It will be better in kWh.

catalinbordan commented 5 years ago

Yes it will be nice

papperone commented 5 years ago

Shelly is aleady exposing the Energy value but it seems this component is not pulling it out from the Shelly devices, can you please add this important feature???

thanks!

zsbobbob commented 5 years ago

yes, this features would be appreciated

heldopsokken commented 5 years ago

waiting for this feature as well. would be a great addition as in mqtt you have kwh values, but this disables cloud...

hakana commented 5 years ago

Yes, we will add this soon

chemelli74 commented 4 years ago

@Limych I think you are refering to "consumption" value as there is no attribute "energy". Please check at http://x.x.x.x/status.

Requested attribute is pulled since a while.

Simone

heldopsokken commented 4 years ago

Hi Simone, Something else in meant in this request then what you are referring to I guess:

The request is to add an energy attribute to show the consumtion of a device in KwH. This could be implemented in the shelly component, but also leveraging the consuption attribute and a calculation. In order to do so you would need to know the resolution of the consumption object to allow this to convert to kWh.

chemelli74 commented 4 years ago

Hi,

please check under HA->developer tools->states->sensor.shelly_shsw_25_xxxxxx_1_consumption: you will find "unit_of_measurement: W".

I don't see any other value, so I bet you must to some maths in HA to get what you want. But I may be wrong.

Simone

heldopsokken commented 4 years ago

Hi Simone, As mentioned earlier there is a difference in parameters send by MQTT and available via Shelly4Hass: See below which are available in MQTT: shellies/-/relay/0 to report status: on, off or overpower shellies/-/relay/0/power to report instantaneous power consumption rate in Watts shellies/-/relay/0/energy to report amount of energy consumed in Watt-minute shellies/-/relay/0/command accepts on, off or toggle and applies accordingly Shelly PlugS adds: shellies/shellyplug-s-/temperature reports internal device temperature in °C shellies/shellyplug-s-/overtemperature reports 1 when device has overheated, normally 0

The energy attribute is not available in shelly4hass and as mentioned not very easy to calculate if you do not know the resolution of the power sensor. Is there also a energy attribute provided in the COAP mesesage like in MQTT?

I noticed that the total counter in x.x.x.x/status is displaying the total amount of Wattseconds. If this object is also exposed in the COAP message that could be used as a sensor value in Shelly4Hass. Converting this to Wh or Kwh is then an easy calculation.

hakana commented 4 years ago

No there is no total in CoAP message. I will add total from /status later.

chemelli74 commented 4 years ago

@Limych, @fverschure, attribute "total_consumption" was added to 0.1.6b9. We are still trying to fix the math ( see #168 ) but it's there.

Can you test latest beta and report back ?

Simone

zsbobbob commented 4 years ago

Thanks for updating! Tested with Shelly Plug S, looks good. Is it possible to use kwh for the sensor instead of wh?

chemelli74 commented 4 years ago

As you confirmed attribute is now there, I'll close this issue. Please follow issue #168.

Thank you,

Simone