StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
620 stars 111 forks source link

[BUG] total_consumption is wrong for shelly 2.5 on rolling mode with CoAP/mDns #575

Open GoNzCiD opened 3 years ago

GoNzCiD commented 3 years ago

Environment

Describe the bug

Working devices with CoAP/mDns in the same LAN, with a Shelly 2.5 in roller mode, the total_consumption attribute is swapping the value constantly (with 2/3 seconds frequency).

For instance, it swaps constantly between 0.006 kWh and 0.015 kWh meanwhile the cover is stopped.

Steps to Reproduce

Just add a Shelly 2.5 device in roller mode and add the total_consumption sensor, just watch the sensor value. A copy of the YAML shelly config:

discovery: false
version: false 
username: !secret shelly_username
password: !secret shelly_userpassword
id_prefix: ''
igmp_fix: true
additional_information: true
power_decimals: 2
scan_interval: 5
upgrade_switch: false
settings:
  total_consumption: { decimals: 3 , div: 1000, unit: 'kWh' }
attributes:
  - has_firmware_update
devices:
  - id: 66A512 
    entity_id: living_cover
    sensors:
      - current_consumption
      - total_consumption

Expected behavior

The value should be the same (or grow slowly when the cover works and consume more energy).

Screenshots

Traceback/Error logs

No errors in logs

Additional context

I also try to make a clean installation in develop environment (running into a ubuntu VM) running the HA solution (stable version) and just add the minimal config to setup the cover. Since it is in a sepparate VLAN and force the discovery by the IP (discover_by_ip) the value doesn't change and seems OK, so I suppose it only happens with the CoAP/mDns use mode.

Arman-GeDon commented 2 years ago

+1 for this request

d3m3trius commented 2 years ago

In roller mode shelly API return a two meter values that present the consumption of each relay separately, as shown in the following json that represent the status: immagine

As you can see the two values are different between the two channels. The component should take the sum of the two "total" field to calculate the total consumption of the roller, but it probably it just get the value alternatively from one or the other channel, returning this kind of data that is totally wrong and useless.

immagine

Arman-GeDon commented 2 years ago

The bug is still in 1.0.0 beta 2

t-solak commented 2 years ago

same here unfortunately, in 1.0.0 as well as 1.0.0 b2.

d3m3trius commented 1 year ago

the bug is marked as fixed but it is not!

germanotero commented 5 months ago

2024, still same issue.