bramstroker / homeassistant-powercalc

Custom component to calculate estimated power consumption of lights and other appliances
MIT License
1.04k stars 266 forks source link

Add new sensors from AVM, Bosch and Shelly #1703

Closed daloki83 closed 1 year ago

daloki83 commented 1 year ago

Checklist

Is your feature request related to a problem? Please describe.

No problem just a feature request

Describe the solution you'd like

Manufacturer: AVM Device: FRITZ!DECT 200 Power usage when on: 1,1 Watt (1W confirmed with PlugS) Power usage when off: 0,5 Watt (<1W confirmed with PlugS) Source: https://avm.de/produkte/smart-home/fritzdect-200/technische-daten/

Manufacturer: PLUG_COMPACT Device: BOSCH Power usage when on: 1,000 W --> Meassured with Shelly PlugS/Tasmota calibrated Power usage when off: <1,000 W Cant be meassured by PlugS Source: https://www.bosch-smarthome.com/de/de/produkte/geraete/zwischenstecker-kompakt/

Manufacturer: Shelly Device: 3EM Power usage when on: < 1 W Power usage when off: N/A its always on Source: https://www.shelly.cloud/de/products/shop/shelly-3em-1

Describe alternatives you've considered

no idea

Additional context

would be nice if you could all these devices. This plugin is so great and usefull!!!

bramstroker commented 1 year ago

For the standby power of the smart plugs it's very important to have a good power reading. The Shelly plug S is not good at accurately measuring power values < 0.5W When we put in 1W for the bosch plug compact and in reality it's like 0.55W then this difference will add up over time, and amount of kWh used will be double the actual amount.

I have very good results with the Zhurui PR10 meter, which is awesome and very accurate, can measure up to 2 decimal digits.

Only device which seems sensible to add is the FRITZ!DECT 200, as you found the actual specs as provided by the manufacturer and you were able to verify them kind of with the Shelly.

Would be awesome if you are able to actual measure the devices. But I can see ~$50 investment is very hefty when you only purchase it for this use case.

daloki83 commented 1 year ago

Well, i like this project and i ordered the ZHURUI PR10-C EU16A...will arrive on monday. I have some other plugs - which i dont use anymore - but then i could also provide you with these data. It could be also usefull for other things (i think). Will be very busy during the week, but i think next weekend i can provide you with (hopefully) correct data from that device.

bramstroker commented 1 year ago

That's awesome.

daloki83 commented 1 year ago

I have a question about the meassurement....could you help me with this before i start with all devices. The Shelly Plug S are running on Tasmota with MQTT on, messaging every 10 seconds and leds off. So in Standby its consuming between 0,24-0,52W. So would you then just use the avarage (0,38W) as standby power usage? Or would you do the meassurement over a fixed time? or anything else? ...Just to get propper results ;-)

bramstroker commented 1 year ago

I don't understand your question exactly. Which device are you trying to measure? I thought you were going to measure with Zhurui PR10 as the Shelly Plug S is unable to measure very low currents accurately.

daloki83 commented 1 year ago

What i mean is, that the consumption (in this case in standby) is not constant. See video...So what value would you need for that device? The middle consumption over 10secs? or time x or how are you doing this? https://github.com/bramstroker/homeassistant-powercalc/assets/29686097/c4475920-f56e-43b8-81b1-315f1274f4a1

while playing this video on github its mirrored (no idea why). Please Download it to watch it correct and see the values bouncing

bramstroker commented 1 year ago

I see what you mean. It will always fluctuate a littlebit, but in your case it fluctuates quite a bit. In this case it makes sense to pick the average. 0.38 seems quite reasonable looking at the values. Could also be a good idea to measure the Wh for example for half an hour (you can reset the Zhurui kWh meter). Then we can easily determine the correct amount of watt.

However not sure how we going to add this shelly Plug S profile to the library. As we only allow a single profile per unique device (manufacturer / model). I measured the Shelly Plug S running the official firmware https://github.com/bramstroker/homeassistant-powercalc/blob/master/custom_components/powercalc/data/shelly/shelly%20plug%20s/model.json I measured 0.52. Can do another measurement tomorrow to verify.

Could be that your firmware is behaving differently and also has another power characteristic because of that.

daloki83 commented 1 year ago

manufacturer / model Maybe as new manufacture...in this way: Tasmota / ShellyPlugS

Will start later or tomorrow with the measurements of the devices. I think I have about 20 Shelly's, some Bosch, AVM, Gosund and so on. Will put it in an excel sheet and then we will see.

daloki83 commented 1 year ago

Hey, 1st batch of measured devices is ready. Please let me know if this is sufficient and you can work with this. Then i would continue with next devices (probably next weekend)

Screenshot 2023-06-17 141905

measurements.xlsx

bramstroker commented 1 year ago

Looking good! You may go forward and make a Pull Request for AVM, Bosch and Nous. Please make a separate Pull request per model. I think most people use the Nous A1T with the Tasmota firmware as I google it, so it makes sense to add it to the library.

For the Shelly I will do some new measurements with the official firmware soon. Also using the same strategy measuring the kWh for 30 min. When I get similar readings, you can just use the build-in Shelly Plug S profile. Not sure if many people use the Shelly with other firmware than the official. I doesn't feel right to me to make a manufacturer directory Tasmota. Also this won't make auto discovery work correctly, because the auto discovery routine looks at the device manufacturer and tries to find similar directory. The only "right" solution is to also take the integration in consideration which provides the entity. i.e. Shelly vs Tasmota. But that will need a thorough overhaul of the library system. So that's not something which is on the roadmap. Anyway you always have the option to add the models to your local powercalc installation. see: https://homeassistant-powercalc.readthedocs.io/en/latest/library/protocol.html#light-model-library

bramstroker commented 1 year ago

Thinking about this some more, we may implement separate profiles for different firmware using sub profile mechanism. Which is also used for some other models.

For example https://github.com/bramstroker/homeassistant-powercalc/blob/master/custom_components/powercalc/data/lifx/LIFX%20A19%20Night%20Vision/model.json

I can write a new matcher which checks if the entity is provided by a certain integration. If so we can automatically load a separate profile, which is in another subdirectory.

Could look something like this.

"sub_profile_select": {
        "matchers": [
            {
                "type": "integration",
                "integration": "tasmota",
                "profile": "firmware_tasmota"
            }
        ],
        "default": "firmware_official"
    }

And directory structure:

- shelly
  - plugS
    - model.json
    - firmware_official
      - model.json
    - firmware_tasmota
      - model.json
daloki83 commented 1 year ago

Okay, PR for AVM, Bosch and Nous done (hopefully its correct?! 1st time for me)

Not sure if many people use the Shelly with other firmware than the official.

For me that was the reason to buy them...i also have two Tasmota lights now. So i would be very happy if you could add something which could cover those devices :-) ...For my understanding your matcher looks nice for this

daloki83 commented 1 year ago

I think we can close here?! Once i have datas from other sensors i will do it with a PR. Thanks @bramstroker