Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Communication over Rest API like legacy Daikin Wifi module #579

Open
cmonty14 opened this issue Dec 14, 2024 · 19 comments
Open

Comments

@cmonty14
Copy link

Hi,
I'm aware that this Faikin-module can communicate over MQTT.
However I would like to address this question:
Is communication over Rest API like legacy Daikin Wifi module working, too?

THX

@revk
Copy link
Owner

revk commented Dec 15, 2024

Pretty much all of the simple legacy http Daikin functions work, so generally legacy integrations still work.

@Raspdomo
Copy link

Raspdomo commented Dec 27, 2024

First of all: many many thanks for this Faikin module. I have 8 indoor units (on 2 multisplit outdoor units) - one of them had no LAN API. After installing a Faikin module the integration with Domoticz (based on the HTTP LAN interface - not via MQTT) was dead easy and works like a charm. Now my whole system is fully automated at any time of the year.

There's one thing that I really miss: the Domoticz devices created to collect heating and cooling power consumption remain at zero. That is probably due to the /aircon/get_day_power_ex not being implemented in Faikin.
This API returns the consumption per hour in multiples of 100W:
ret=OK,curr_day_heat=0/0/0/0/0/1/0/3/3/2/5/0/6/4/0/0/0/0/0/0/0/0/0/0,prev_1day_heat=0/0/0/0/0/0/1/1/1/2/0/0/2/3/0/1/3/0/3/1/5/4/0/0,curr_day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0

      Would it be possible to add this to the development backlog ?

@revk
Copy link
Owner

revk commented Dec 27, 2024

That sounds like something we would have to collect and store rather that something we can simply extract from the aircon. Not out of the question but very much not the way the Faikin works at present. So I'll have to ponder this one.

@Raspdomo
Copy link

It didn't occur to me before but indeed the Faikin unit only manages "current" settings.
There are two other functionalities /get_week_power and /get_year_power that also contain historical information but I think Domoticz only uses the /get_day_power_ex and then from there keeps history inside the Domoticz db.

I wonder how this is managed in the Daikin LAN module - it must store some history about power consumption, roughly about 130 values:

  • daily: 24 heating values per hour, 24 cooling values, keeping also the values of yesterday (see above)

  • weekly: 7 values, heating and cooling combined:
    ret=OK,today_runtime=0,datas=10500/10100/11100/10100/7900/9500/10400

  • yearly: 12 values heating and cooling combined, keeping also the values of last year
    ret=OK,previous_year=490/287/240/107/0/28/0/0/0/76/229/322,this_year=461/182/196/129/13/31/79/98/24/72/240/243

@revk
Copy link
Owner

revk commented Dec 28, 2024

Indeed, it would not be impossible to store such values. I try and avoid using the flash unnecessarily, and storing in RAM would lose data on a restart - but that may be reasonably OK as these do not normally get reset often (occasional s/w updates).

It would probably be simpler to collect using HA as that will happily store and graph the values over time I believe.

@Raspdomo
Copy link

Keep only 96 values in RAM ?

My guess is that Domoticz only uses /get_day_power_ex.
If you only implement /get_day_power_ex you could keep the values in RAM instead of flash. that would be 24 x 4 = 96 values Too bad if these data are lost on a (rare) restart.

... or only 48 ??

I'm not even sure if Domoticz uses the values of yesterday, so an option would be to include those in the HTTP response but hardcoded at zero. That way there would only be 48 values (24 heat and 24 cool) to keep.

A real HTTP response captured today at 15:30 is (though I overwrote prev_1day_heat values with zero):
ret=OK,curr_day_heat=0/1/0/0/0/0/0/3/2/3/3/4/1/0/1/0/0/0/0/0/0/0/0/0,prev_1day_heat=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,curr_day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0
The first 15 curr_day_heat values are real consumption data, the remaining 9 are still at zero as yet to come.

And this is the response at 16:10. Now the consumption of the 16th hour of the day is also filled in (value 6 = 600kWh).
ret=OK,curr_day_heat=0/1/0/0/0/0/0/3/2/3/3/4/1/0/1/6/0/0/0/0/0/0/0/0,prev_1day_heat=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,curr_day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0
So each hour a value is added - the remaining values for the day still at zero, the previous values stay the same.

... or maybe even only one ???

Maybe Domoticz only picks the value of the "current minus one" hour and adds it to the domoticz.db to keep history. That way there would only be one value to be stored in RAM (or 2: one for heat and one for cool). The HTTP response for the 16th hour today in heating mode could then be
ret=OK,curr_day_heat=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/6/0/0/0/0/0/0/0/0,prev_1day_heat=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,curr_day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0

I'm always willing to beta-test a few bits and ends if you decide to give it a go :-) With a bit of luck the "only one" option is enough !

@revk
Copy link
Owner

revk commented Dec 28, 2024

That is probably lot too hard.

@Raspdomo
Copy link

Raspdomo commented Dec 28, 2024

I did some more reading in the discussion topics and found one on "Domoticz Daikin backwards compatibility integration": #236.
I read there that you've implemented a fake (= with all zero values in the HTTP response) get_year_power_ex which Domoticz seems to call. So my assumption that Domoticz uses get_day_power_ex seems to be wrong after all.

Then maybe let's start from the beginning: is there any way at all to get any power usage information over the S21 interface ?
Actual Wattage, not kWh so no notion of time = no need for the Faikin to store anything in RAM or flash.
HA or Domoticz could then poll for instance every 10 seconds to keep track of power consumption over time.

BTW thanks again for your responsiveness and all your Good Work to keep us automation enthousiasts out of the Dark Daikin Cloud...

@revk
Copy link
Owner

revk commented Dec 29, 2024

Yes it reports it. We already do that. I think it's a cumulative counter so could easily be partitioned on the hour.

Ah, sorry, kWh only. But for hourly stats that is all you need.

Accumulating stats over a day is unlikely to be any issue really, and I think I currently target s/w updates for the morning so not much lost when you do.

@Raspdomo
Copy link

Academic precision isn't required, so losing the stats for a couple of hours isn't a showstopper at all.

In the github documentation I only found something about energy in the S21.md manual: GM | Hex, Wh total energy usage.
Couldn't find any other info (sorry if I overlooked anything).

  • Is this value available via MQTT only ? (which I haven't installed on my system - I use the standard Domoticz Daikin integration via HTTP)
  • What does this value represent ? E.g. the Grand Total of the energy usage since the Daikin unit was first started, or today's usage, or ... ?

@revk
Copy link
Owner

revk commented Dec 30, 2024

At present MQTT (which reports using MQTT to HA) as far as I am aware.

And yes, a grand total energy!

So if we logged this every hour to a table we could provide per hour usage total.

@MuzzaMcD
Copy link

Just to add a little value to this topic of the Daikin Energy Counter from my observation only...
It is my experience that the Energy Counter is only changed when it accumulates 100Wh or 0.1kWh. So when running idle or indeed mode=Off/Standby (ie low power consumption) you will only see a change to the value over an extended period of time. It can be confusing when you see a jump in the graph and wonder if the unit was turned on randomly ? ! !
ALSO, the counter value is 'hard written' (to survive power down) even less often than 100Wh. Not sure but maybe every 1000Wh? So sometimes if the unit powers off for some reason, you will see the next reported value DECREASE a notch, which can be a pain in the bottom for HA statistics and graphs etc.

@Raspdomo
Copy link

@MuzzaMcD : at first the 0.1kWh increments confused me a bit too, For units that are turned off I typically see one increment per day. It's the power usage of the WiFi module + other circuit board. I never witnessed a decrease (yet).

The Daikin HTTP /aircon/get_day|week|year_power_ex responses differentiate between heating and cooling. I wonder how that is done if the S21 port only provides a single grand total value...

@revk How does it currently work ? Do you publish one MQTT message per hour with total power usage ?
If so, even with one single grand total coming in it should be possible to keep track of per hour usage in HA/Domoticz. Differentiation between heating and cooling should also be possible as it is known in which mode the system was during the last hour (apart from the rare/weird occasion where there would have been both heating and cooling over the last hour).

@revk
Copy link
Owner

revk commented Dec 30, 2024

We include the kWh value from S21 in the data reported on status, simple as that. It is more often than hourly and I don't think we do any heat/cool counting.

@Raspdomo
Copy link

Raspdomo commented Dec 30, 2024

I set up an MQTT broker and connected the Faikin. Didn't connect to Domoticz yet, I first want to observe a bit.

Under the Faikin header I found the actual data - being updated every 60 seconds. There's effectively an energy value, labeled Wh.
Looking at the message history (see below) there are some things to observe:

  1. Mostly the message contains one Wh value, but sometimes there are three values. The middle value isn't a multiple of 100.

As you multiply by 100 in your code (Faikin.c: report_int (Wh, s21_decode_hex_sensor (payload) * 100);), how can there be 2 non-zero digits at the end of the middle value ?
And why report 3 values - one should be enough ?

  1. The values are around 4535000. I know from historical data that this can't be the lifetime energy usage of this indoor unit (the multisplit has 5 indoor units, only one of which has a Faikin module, the others still have Daikin LAN HTTP working).
    In one hour the value increases by 700-800 - turning the indoor unit with the Faikin module on for 15 minutes didn't make a noticeable difference.
    However, at midnight all indoor units connected to the multisplit outdoor are switched off for the night. The compressor frequency falls down to zero... and the Wh value doesn't increase anymore.

This leads me to believe that the reported energy usage represents the combined Lifetime energy of all units connected to the multisplit.
The multisplit has been running very steadily the whole day at a compressor frequency of around 20Hz which explains the energy values climbing up at a steady hourly rate of about 750Wh (roughly 37W per Hz - I value I had already figured out before in a completely different manner).

Does somebody have a multisplit with several indoor units with a Faikin module ?
Do they all report the same Wh value ?

That would imply that the Faikin module cannot supply the power usage of an individual indoor unit - unless it is a single split system.
And it leaves me without a clue how the Daikin HTTP interface reports the energy usage of the polled indoor unit.

==================================================
Some MQTT Faikin messages:

  • 16:15: "Wh": 4535400
  • 16:27: "Wh": [ 4535500, 4535598, 4535600 ]
  • 16:43: "Wh": 4535800
  • 17:00: "Wh": [ 4535900, 4535995, 4536000 ]
  • 17:15: "Wh": 4536100 = 700 higher than an hour ago
  • 18:15: "Wh": [ 4536800, 4536885, 4536900 ] = 800 higher than an hour ago
  • 18:45: "Wh": 4537200 => 300 higher than half an hour ago. UNIT TURNED ON TO START HEATING
  • 19:01: "Wh": 4537400 => 200 higher than 15 minutes ago. UNIT TURNED OFF
    Heating for 15 minutes didn't noticeably influence the speed with which the Wh move up !
  • 23:15: "Wh": 4540600: 7 hours are past since 16:15 - average increase per hour is 743Wh
  • 00:00: "Wh": 4541300. At this time all indoor units are switched off for the night.
  • 00:55: "Wh": 4541300. UNCHANGED

@revk
Copy link
Owner

revk commented Dec 31, 2024

These are my regular stats reports - you can change the format - but normally its is one value if only that value for period, or three (min, ave,max) if it changed during the period. It may be better to set live status updates to see more clearly.

@Raspdomo
Copy link

After further observation today I'm convinced that the reported Wh accounts for the whole multisplit system - i.e. all indoor units combined.

Anybody with a multisplit and more than one unit with a Faikin ? Do they all report the same Wh value ?

There's a difference with what Daikin reports (through HTTP into Domoticz). The Faikin total is roughly 10% lower (observed today as well as for the whole lifetime). I'm not looking for academic precision so either will do for me. Though I have more trust in the Faikin value :-)

@MuzzaMcD
Copy link

MuzzaMcD commented Jan 1, 2025

@Raspdomo I am not running any multi splits so I can't help with that. However, I do have a Shelly Power Meter attached to one of my Faikin controlled units.
The Faikin does report a raw energy value from the Daikin that is a little lower than the measured Energy from the Shelly 1PM. I have always put this down to the 100Wh 'precision' that the Daikin delivers.
My experience with various power/energy integrations before I moved to Faikin was that some attempt to improve the accuracy of the Raw Energy data by 'estimating the slope' and applying a compensating factor. (You might like to google and cast your eyes over the pydaikin/power.py code to see an example. I also believe that the Raw Data is used when 'logically' dividing/attributing energy usage to heat/cool and even days/weeks etc.
I am currently using Shelly Power meters where appropriate to measure Power and store Energy data and more accurately apply Electricity tariff costs to work out true cost .... but that's a whole other story :)
I think history data like Power and Energy is best stored centrally like in Home Assistant.
I suspect that the Daikin Raw Energy counter is simply implemented by Daikin to primarily record how hard a compressor unit has worked over its lifetime. ... and not necessarily to give us users any accurate energy data :)

@Raspdomo
Copy link

Raspdomo commented Jan 2, 2025

I come to the same conclusions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants