OlivierZal / com.melcloud

MELCloud integration with Homey
GNU General Public License v3.0
5 stars 2 forks source link

Power consumption feature #20

Closed OlivierZal closed 1 year ago

OlivierZal commented 1 year ago

@Zeeker86, @Norjolo, @dozepih, @osauser, @henrikjonhed, @janhjordie

I'm currently working on adding the power consumption feature in the app.

Thanks @henrikjonhed, sure https://github.com/XattSPT/com.melcloud/pull/43/commits/f3d96e79e9d6b1b306755de343f1109c5e1d2161 will help.

I just need a MELCloud guest access (olivier.zalmanski@me.com) to one air-to-water heat pump in order to make some tests. For this feature a restricted (read-only) access should be sufficient.

Follow-up in this issue, I'll tell you when a test version is available.

Kind regards

janhjordie commented 1 year ago

@OlivierZal I have extended your guest access So you are welcome to test πŸ‘ŒπŸ¦„

henrikjonhed commented 1 year ago

Great! Do you have a branch pushed? If so then I could test it locally as well.

Glad to hear that my PR is of help, but I'm not really happy about the solution to name the capability as yesterday's x, it feels a bit hacky. I was wondering if a less ugly solution would be to display the total consumption, production and cop instead?

OlivierZal commented 1 year ago

Hi @henrikjonhed, not yet.

Indeed your PR is not part of the new app code because it conflicted with SDK 3 and homeycompose reshape.

And you're right: your code is good but there are possibilities to plug to standard capabilities so we can benefit of Homey built-in features. Exploring this and I'll share my branch as soon as I have one.

henrikjonhed commented 1 year ago

If lifetime power consumption where to be used instead (FromDate = 1970-01-01 and ToDate = $today), then meter_power.produced and meter_power.consumed could be used as capabilities. They would still lag one day behind (at least for ATW, maybe ATA updates more often?) but would behave more like a normal Homey app.

For inspiration/reference, I saw that the Easee EV-charger uses the following capabilities for energy consumption: meter_power for lifetime consumption and meter_power.lastCharge for the last charging session.

OlivierZal commented 1 year ago

Hi @Zeeker86, @Norjolo, @dozepih, @osauser, @henrikjonhed, @janhjordie

I've just published a new test version: https://homey.app/fr-fr/app/com.mecloud/MELCloud/test/

Note: to avoid breaking anything in your current flows or devices, this time I created a new device category ("air-to-water" vs "air-to-water"): you need to add your device as a new device with this category, so you can peacefully test (@janhjordie ;-)).

janhjordie commented 1 year ago

Fantastic @OlivierZal πŸ‘ŒπŸ‘ŒπŸ€˜πŸ™

image

henrikjonhed commented 1 year ago

Nice solved by naming yesterday's consumption as last daily consumption! ⭐

What do you think about using two decimals for consumption and production instead of integers? Adding decimals: 2 to the capability option in driver.compose.json and not using toFixed(0)

OlivierZal commented 1 year ago

I can @henrikjonhed, but maybe not for the total ones since they can be very high.

henrikjonhed commented 1 year ago

Tested the version linked above now, works great!

Do you know if it's possible to make Zone 1 the default thermostat in the UI? Now it displays Water tank, which I guess is due to the order being alphabetic?

OlivierZal commented 1 year ago

I can try again but it's not that simple

henrikjonhed commented 1 year ago

One way of solving it is to not use a sub-capability and let zone 1 be the main capability instead ( [measure|target]_temperature.zone1 -> [measure|target]_temperature). Another bonus with doing that is that zone 1 temperature will then be displayed as the device indicator: image

OlivierZal commented 1 year ago

I'm going towards this solution, but I guess that if someone if prefers to see zone 1 before water tank, he will also prefer to see zone 2 before it. Exploring some solutions.

smurfb commented 1 year ago

Great work! I have been using HA and homey-HA integration but now I can scrap it. Would love to have one decimal on todays use of power though on an air2air device.

OlivierZal commented 1 year ago

Hi @Zeeker86, @Norjolo, @dozepih, @osauser, @henrikjonhed, @janhjordie,

Please find a new test version including your comments but also with an app core completely redesigned to avoid some sync issues.

Note that after many tests, there is a big delay on MELCloud app's end to take into account any change you make from the app, but the redesign I made makes sure that when sending an info to MELCloud's API, it has been taken into account.

Don't hesitate to reach me in case of any issue or remark! This time capability and flow names won't change anymore.

janhjordie commented 1 year ago

Damn, there are so many properties on it now πŸ˜‚πŸ˜‚ But it looks great πŸ₯°πŸ₯° Only wish I have is Last daily heating CoP and last daily hot water CoP. It gives an easy way to see the HP efficiency

Thanks Olivier πŸ‘Œ

OlivierZal commented 1 year ago

Oh ok, I didn't get your point. Unfortunately Hot Water CoP is not available via MELCloud API.

janhjordie commented 1 year ago

It's actually very easy. No api is needed. Just divide hot water production with hot water consumption = hot water CoP And the same for heating

OlivierZal commented 1 year ago

@janhjordie, you asked for it... you have it in the 5.0.1

Note that when the app adds new capabilities, they are added after the existing ones and not according to the order at first pairing.

That's why new CoPs will be displayed at the end of your existing capabilities, and not just after the existing CoP / energy metrics.

OlivierZal commented 1 year ago

If no more comment on the newest test version, from what I've tested control and flows are ok for both air-to-air and air-to-water devices, so I'll go into production in the next days.

Feel free to raise any issue you could encounter in the meanwhile.

Thanks!

OlivierZal commented 1 year ago

@janhjordie, I agreed with you: too much measurements displayed in the dashboard.

In the newest version: go to the dashboard and then to the settings, you will have a surprise :-)

MTRKhn commented 1 year ago

cop are displayed regardless of the settings ;)

can you also incorporate a global settings to disable everything related to water (EcoWater, Immersion Heather, …) ? Most air to water HPs don’t have it.

henrikjonhed commented 1 year ago

Really like that I’m able to select which consumption capabilities to be displayed!

OlivierZal commented 1 year ago

Hi @MTRKhn, it on purpose: I made the "daily CoPs" mandatory, only "total CoPs" can be retrieved from settings.

But you're right: what I can do for energy measurements can be extended for any dashboard info.

Working on it

OlivierZal commented 1 year ago

Hi @henrikjonhed,

janhjordie commented 1 year ago

Thanks for the new version. It's brilliant

OlivierZal commented 1 year ago

@henrikjonhed, updated in newest version.

Zeeker86 commented 1 year ago

Thanks a lot for the new version :)
I've been busy with a new born :D Sat down now and it look great. Maybe it is only at mye place, but a "new day" starts at 05pm. (17:00 i Norway) In insigths I see it change.

Should not that be at 00:00 ?

image_2022-10-26_214459011

OlivierZal commented 1 year ago

Hi @Zeeker86, you raise a good point!

The energy report is processed every 24 hours... since the app is initialized (so I guess MELCloud was updated at 17:00).

I'll check how I can force report process at 00:00 in the user time zone.

I'll let you know!

OlivierZal commented 1 year ago

@Zeeker86, it has been fixed with today's release, now the report will be launched every day at 00:00 AM UTC.