Shellies Discovery Script

Ok! thank you

Let me know if I can assist and thanks so much for your Shelly script.

@Bieniu So how do you use this if you are running Hassbian and not Hassio ?

There is no difference how you install HA, the script is always used the same way. Read OP.

Ok…

Curious are you a part of the Shelly QA group on FB ?

Thanks for your script - it helps me a lot.

But, alas, in version 0.10.2 I found several errors in indicating the units of measurement for the sensors.

  • Everywhere for the power sensor, you indicated “kWh”, but the documentation (https://shelly-api-docs.shelly.cloud/#shelly-plug-mqtt) says “power consumption rate in Watts”. And the value shows that the documentation has an error. Correctly will be “kilowatts”. So I fixed it to “kW”.
  • Everywhere for the energy sensor, you indicated “W”, but the documentation says “amount of energy consumed in Watt-minute”. So I fixed it to “Wmin”.
  • And finally, you had confusion about the units for ShellyEM sensors. I also fixed it.

Here is the version of the script with my edits: https://github.com/Limych/HomeAssistantConfiguration/blob/40ba71f00ff4c233e9571ae88a1f7c56b35cfc8a/python_scripts/shellies_discovery.py

UPD Here is some confusion.
Correctly so: power is measured in watts per minute (Wmin; in moment), energy - in kilowatts (kW; cumulative total).
Sorry for inconvinience…

You are wrong. Power sensor should be in Watt, energy sensor in kWh (Shellies send energy in Watt-minute, script converts unit to kWh).

Maybe I’m wrong.
But how then can I explain that for my computer now the power sensor from your script shows a value of 238.9 units? You want to say that the computer consumes 238.9 kWh?! …

Excuse me for some confusion.

Correctly so: power is measured in watts per minute (Wmin; in moment), energy - in kilowatts (kW; cumulative total).

This is how your script gives values after my modifications.

I noticed that many people read the value on the utility meter as kilowatt hours (kWh). But this is not a correct reading. The counter counts watts (W) or kilowatts (kW), not watt hours (Wh) or kilowatts hours (kWh).

And the energy sensor is in fact a local utility meter.

If power sensor shows 238.9 it is in Watts and it is power consumption at the moment. If energy sensor shows 238.9 it is cumulative energy usage in time in kWh.

Power is measured in watts, not in watts-min. Energy is measured in J (joules) or Wmin or Wh or kWh.

No. You’re wrong. Cumulative (!) energy usage cannot be measured in kilowatt hours. But may in kilowatts.

About watts and watts-seconds I agree. I’m sorry.

Sorry, I will not argue with you. In physics that I know energy is measured in Wh or in joules. EOT.

1 Like

I has read in detail about watts and kilowatt hours …

I apologize - you were right from the beginning.

However, this does not cancel my edits for ShellyEM - there was still an error…

What error with ShellyEM? There isn’t official API documentation for ShellyEM. Maybe I made a mistake.

Nothing serious. It’s just that you made a mistake in setting the units of measurement for the sensors.

Yes, there is a mistake with units.

New version: 0.10.3

Changelog:

  • fix ShellyEM sensors units