apetrycki / daikinskyport

API for accessing a DaikinOne+ Thermostat
60 stars 27 forks source link

Feat Request: Add energy sensors #31

Closed tlykken closed 3 months ago

tlykken commented 2 years ago

Hey guys - great project! I am actively using this integration to report to HA my Daikin One info. It has been awesome.

I see there are sensors for reporting the power device class for indoor and outdoor.

Can we add energy sensors so that power consumed can be displayed in the new(er) energy panel? Knowing how much electricity my furnace and AC using are consuming would be wonderful. To extend on that, knowing how much gas it is consuming would also be great.

I am not sure if the energy rolling KwH number is something reporting out of the skyport API or if it would need to be a rolling tally this integration would need to keep track of.

Love to hear your thoughts. Thanks!

apetrycki commented 2 years ago

I was looking through the JSON values and I'm not sure if what I see are power values. My system isn't reporting them. Maybe @knightjoel has these and can figure out the values:

  "S21PowerConsumption": 0,
  "ctOutdoorPower": 65535,
  "ctCoolingRatedPower": 65535,
  "S21PowerConsumptionValid": false,
  "P1P2CompressorPowerSupplyFrequencyValid": false,
  "P1P2CompressorPowerSupplyFrequency": 0,
  "ctHeatingRatedPower": 65535,
  "ctIndoorPower": 65535,
  "ctCompressorCurrent": 65535,
  "S21ElectricCurrentFlow": 0,
  "S21ElectricCurrentFlowValid": false,
knightjoel commented 2 years ago

Heya,

The API does return values for ctOutdoorPower and ctIndoorPower for me. I'm trending them in HA and can see they fluctuate in accordance with the furnace or AC running.

% grep -i power daikin_api.txt
    "S21PowerConsumption": 0,
    "ctOutdoorPower": 0,
    "ctCoolingRatedPower": 548,
    "S21PowerConsumptionValid": false,
    "P1P2CompressorPowerSupplyFrequencyValid": false,
    "P1P2CompressorPowerSupplyFrequency": 0,
    "ctHeatingRatedPower": 467,
    "ctIndoorPower": 18,

I haven't done this, but from a quick look at the HA docs, it seems the integration platform supports using a sensor that expresses power in Watts (which would be the ctOutdoorPower/ctIndoorPower sensors) to create a kWh sensor which could be displayed on the Energy dashboard.

tlykken commented 2 years ago

I haven't done this, but from a quick look at the HA docs, it seems the integration platform supports using a sensor that expresses power in Watts (which would be the ctOutdoorPower/ctIndoorPower sensors) to create a kWh sensor which could be displayed on the Energy dashboard.

Good to know! I could drop this in my config file and define some custom sensors for this. I may try playing around with this today.

Do you guys think this sensor would be better for this integration to define by default so each user doesn't need to do a custom sensor in their configuration.yaml?

tlykken commented 2 years ago

To follow up on this, the integration platform works. It would still be nice to have this as a sensor that is automatically created when the integration is loaded but this works for now. I just had to drop the following in my configurmation.yaml (in my case snesors.yaml as my config is broken apart) and then add it to the energy devices monitored on HA energy config page.

- platform: integration
  source: sensor.main_floor_thermostat_indoor_power
  name: main_floor_thermostat_indoor_energy_spent
  unit_prefix: k
  round: 2

- platform: integration
  source: sensor.main_floor_thermostat_outdoor_power
  name: main_floor_thermostat_outdoor_energy_spent
  unit_prefix: k
  round: 2

Thanks!

ufodone commented 2 years ago

@tlykken I've done the same thing with my system but I think that the power reported by my system is off by 10 (e.g. a reported value of 300W is actually 3000W). I'm guessing this both based on what my unit is rated at as well as a rough usage comparison between these energy sensors and why my electricity company is reporting for daily usage. I wonder if, like some of the other values reported by the Daikin, the power sensors need to be corrected.

Are the numbers being reported for you system similar?

tlykken commented 2 years ago

@ufodone - Good question. I don't have a whole-home power meter so I don't think I can provide good insight quickly. My furnace fan has been running at 60% and shows it is drawing 40W. When it kicks up to high, it shows it would be drawing about 132W.

Assuming that the theory is that is off by a factor of 10, then at high speed the fan would be pulling 1,320W. The furnace recommends a 15A breaker at 120V, which would be a max of 1,800W on that breaker. Soo... 10x is in the realm of possibility.

When I get some time, I will try to put an amp meter on my furnace circuit to see what it is pulling.

tlykken commented 2 years ago

@ufodone and @knightjoel and @apetrycki -

I did some research and finally got the fuse box opened up to get my ammeter in there. My ammeter is a craftsman and I was measuring on the 200A setting which has precision down to 0.1A.

Here is what I found

Indoor power levels:

The indoor power is on a 15A single pole breaker.

Fan Speed: Low HA Reported Indoor Power (W) - 18 W Ammeter Reading: 1.8A

Fan Speed: Medium HA Reported Indoor Power (W) - 40 W Ammeter Reading: 3.7A

Fan Speed: High HA Reported Indoor Power (W) - 84 W Ammeter Reading: 8.8A

I believe the reported values from the API are 0.1 AMPs., not watts So, when it reports a number 18, it is actually reporting 1.8A used. Since my ammeter is not in line, it could be picking up a little interference from the lines around it, hence the small variance at the higher fan speed settings.

Outdoor Power usage.

Here is what I measured:

HA Reported Indoor Power (W) - 32 W Ammeter Reading - Pole 1 : 0.3 to 0.4A (Bouncing between) Ammeter Reading - Pole 2: 0.3 to 0.4A (Bouncing between)

I believe this is reporting 0.1 Amps per line also, not watts.

Next Steps - I think the returned value for indoor power needs to be calculated using Watts = Amps Volts. So for the internal power, since that is a single line, if X = the reported power of the API, then the formula for the reported value should be 120 ( X 0.1). For the outdoor power, it should be 240 (X * 0.1).

My system is a DM97MC1005CN for the furnace and a DX17VSS481BA for the AC compressor.

Interested to hear your guys thoughts!

Fan

knightjoel commented 2 years ago

Neat data, tlykken. I suppose a power reading of 18, 30, and 84 Watts really doesn't make sense. But 216, 480, and 1008 Watts seems more sensible.

@ufodone, would calculating the power usage the way tlykken described make sense with the power usage you're seeing from the utility company?

ufodone commented 2 years ago

Thanks, @tlykken for the info. Unfortunately I'm not sure if that math works for my system. I've seen peak reported power values (when heating) of 328 in HA (the ctOutdoorPower variable from the API response). That would have my system using 32.8A but it is only running off a 25A 240V breaker. Looking at the API response, I also see:

ctCoolingRatedPower=380
ctHeatingRatedPower=295

which is a little confusing as one might expect the current power usage (328) to always be lower than the rated value (295).

My outdoor unit is a DZ17VSA361B. I looked through the data sheet for in hopes of finding some connection to the reported values but couldn't find anything.

I don't currently have a way to measure actual power usage but am looking for a home energy monitoring solution which can hopefully help me compare. In the meantime, I'll see if I can get similar current readings as you've gotten from your system.

apetrycki commented 2 years ago

@ufodone @knightjoel @tlykken Do you guys get a value for S21ElectricCurrentFlow? Is S21ElectricCurrentFlowValid true? There's also a ctCompressorCurrent that might provide some insight. I don't have anything related to power, so I'm not much help on this one.

ufodone commented 2 years ago

@apetrycki I have S21ElectricCurrentFlow and S21ElectricCurrentFlowValid but they are 0 and False respectively. All the P1/S1 parameters looked to be unset and I recall reading somewhere that they are maybe only used for certain units?

I also have ctCompressorCurrent which was reading 22 when ctOutdoorPower was reading 63 so that value is perhaps max amperage rather than current?

tlykken commented 2 years ago

Interesting. Here is what I have for these stats:

ctCoolingRatedPower: 548 ctHeatingRatedPower: 467

S21ElectricCurrentFlow: 0 S21ElectricCurrentFlowValid: False ctCompressorCurrent: 0 ctOutdoorPower: 27 ctIndoorPower: 18

My ammeter was reading 1.9A (120v) for the furnace and 0.3-0.4 for the outdoor condenser (240v). I still have the cover off of my circuit box for more testing. :)

I don't think the Rated power number is accurate. I know my installer didn't tell the system what size circuit I had installed for the furnace.

Is there any way you can take an ammeter reading @ufodone? Is your outdoor unit a heat pump or just an AC unit? It is strange that it is showing that much power usage while in heat mode.

I have my Daikin installer coming out tomorrow for some maintenance and have an open question to them on why the condenser is pulling any power when we are in heat mode. They are clueless about the API but I will let you know what I find out.

tlykken commented 2 years ago

I just looked up the DZ17VSA361B and it is a heat pump. Looking at the datasheet it will pull up to about 12Amps in normal operating mode... hmmm... maybe I need to run my AC in the winter to see what kind of load it will pull. ha! Not looking forward to that but I will give it a try and let you guys know what I find.

Do your indoor values seem to make sense?

tlykken commented 2 years ago

I just turned on my AC - when my condenser is running I took two readings during ramp up.

5.7A on the ammeter ctOutdoorPower: 132

15.2 on the ammeter ctOutdoorPower: 326

Maybe this number is doubled because there are two poles on the circuit so you can just use 120v x 32.6 to get the power draw?

That could make sense, the developers just wanted to multiply the power factor by 120 every time regardless if the circuit is one pole or two...

@ufodone - that would put your power draw at ~4KW or 16A per pole of the 240 circuit which sounds right in the wheelhouse.

Thoughts?

apetrycki commented 2 years ago

@tlykken that was a thought I had as well. It's too bad this info isn't displayed anywhere in the thermostat to see what their calculations are. My guess is this info was more for the power companies so they can adjust thermostats based on power draw.

tlykken commented 2 years ago

I think you are right. How about we go with adjusting the power draw reported in HA for both indoor and out to 120 ( X 0.1). That should get us in the ballpark for home assistant power reporting.

apetrycki commented 2 years ago

@tlykken X*12. Less math ;-)

ufodone commented 2 years ago

@tlykken Yes, ~4KW/16A seems about right for my system.

Any idea what the "HI PR" and "LO PR" values refer to in heating more tables in the data sheet ? The "HI PR" values for my unit looks suspiciously in the same range as I'm seeing reported in ctOutdoorPower when the system is running at full power.

tlykken commented 2 years ago

X*12. Less math ;-)

Haha! You got it!

Any idea what the "HI PR" and "LO PR" values refer to in heating more tables in the data sheet ?

I don't. The only ones I know for sure are amps and KW. No idea what delta T is but it sounds cool. :)

knightjoel commented 2 years ago

Perhaps a comment near the math expression so it's clear to others who read the code where 12 comes from.

On Wed, Nov 17, 2021 at 3:17 PM tlykken @.***> wrote:

X*12. Less math ;-)

Haha! You got it!

Any idea what the "HI PR" and "LO PR" values refer to in heating more tables in the data sheet ?

I don't. The only ones I know for sure are amps and KW. No idea what delta T is but it sounds cool. :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apetrycki/daikinskyport/issues/31#issuecomment-972141694, or unsubscribe https://github.com/notifications/unsubscribe-auth/AED7IYMFCPK3SYNWD4D3GKTUMQSWLANCNFSM5F3J5H2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

apetrycki commented 2 years ago

Looks like we don't have to guess so much anymore: https://daikinone.com/openapi/

tlykken commented 2 years ago

AWESOME!

tlykken commented 2 years ago

Just read over it - looks like it's pretty limited in the v1 release of the openAPI.

cowwoc commented 2 years ago

My favorite part:

#### API USAGE LIMITS

* Do Not poll at an interval quicker than once every 3 minutes

Once per 3 minutes?! If they had some common sense, they would instead add support for ETAG headers so we could poll them more frequently without incurring a huge performance/bandwidth hit.

cowwoc commented 2 years ago

Reading over the above comments, I don't understand how some of you are getting power values while @apetrycki and I both get a value of 65535 for ctOutdoorPower and related properties. Does anyone know how to enable this functionality?

knightjoel commented 2 years ago

In a separate discussion we compared model numbers for our equipment. If I remember correctly, tlykken and I have the same furnace and AC unit. My furnace is DM97MC1205DNAA and AC DX17VSS481AA.

cowwoc commented 2 years ago

@knightjoel Interesting. So only a subset of equipment combinations report power usage. I find it sad that even high-end models don't report these values. I have a DZ20VC heat pump that is ~2 years old and it does not report power usage.

clintiepoo commented 8 months ago

I just wanted to jump in this thread and say I’m willing to contribute as needed. I’ve got a Daikin furnace and heat pump that report power usage. My furnace fan has been reporting the wrong power value when off. Some details here: https://github.com/apetrycki/daikinskyport/issues/84

My heat pump is on a submeter, so I can get accurate KwH usage by day for it to compare with.

As I get time, I may just correct the values in my own config.

clintiepoo commented 7 months ago

I got some time to work on this, so here’s what I did.

I integrated the heat_pump_energy into my energy dashboard. I added a calculated cost value per kWh based on my utility bill.

Results: I basically only have results for yesterday. Heat_pump_energy: 36.96 kWh Actual meter reading: 36.90 kWh

This method seems to work. Hope this helps somebody.

Edit: I have not been able to replicate my initial success with this. It’s still working, but the accuracy isn’t like my first attempt. I still have some more to learn.

wirecuttr commented 5 months ago

The daikinone integration has the power usage sensors in it. It did some comparisons to my Emporia Vue data here: https://github.com/zlangbert/ha-daikinone/issues/31

You can see in https://github.com/zlangbert/ha-daikinone/blob/main/custom_components/daikinone/daikinone.py he has: power_usage=payload.data["ctOutdoorPower"] * 10 and power_usage=payload.data["ctIndoorPower"] / 10 The indoor power usage sensor isn't right. The outdoor one is likely right. I had s big offset against my Emporia on one of my units, but not the other, so not sure what to make of that.

paulcarlucci commented 3 months ago

Since #84 was closed as a duplicate of this one I'll comment here. My indoor power is reporting as 920w whenever it is idle. Since there are other parameters that can be cross-matched to determine is the system is idle is it reasonable to disregard the value reported just artificially set indoor power to zero when idle?

wirecuttr commented 3 months ago

Since #84 was closed as a duplicate of this one I'll comment here. My indoor power is reporting as 920w whenever it is idle. Since there are other parameters that can be cross-matched to determine is the system is idle is it reasonable to disregard the value reported just artificially set indoor power to zero when idle?

What device is your indoor unit?

I have issues with the furnace (DM97MC) power in this integration still as well. image

In the image above, the left graph is from the daikinsport integration and the right side is from my Emporia Vue CT clamp.

Its the same with the zlangbert/ha-daikinone integration so the issue may be on Daikin's end. ...

paulcarlucci commented 3 months ago

I have DMVE60DP1400. Unfortunately I don't own a CT setup to correlate readings.