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

the S21 Protocol has Power Meter ? #101

Closed
metarutaiga opened this issue Sep 4, 2023 · 73 comments
Closed

the S21 Protocol has Power Meter ? #101

metarutaiga opened this issue Sep 4, 2023 · 73 comments

Comments

@metarutaiga
Copy link

metarutaiga commented Sep 4, 2023

Is the FM Meter?
Is the FP Pulse?
The values are Hex values.

I checked it on my FTXM-V.
The value is likely my Power Meter closely.

kWh = FM * FP / 1000.

@revk
Copy link
Owner

revk commented Sep 4, 2023

Do you have examples of the exact messages. If we can work out what they are, I am happy to add that.

@metarutaiga
Copy link
Author

FM : 02.47.4D.37.33.31.32.61.03
FP : 02.47.50.45.32.30.30.6E.03

FM : hex(2137) = 8503
FP : hex(2E) = 46
391 kWh = 8503(Meter) * 46(Pulse) / 1000(kilo)

@revk
Copy link
Owner

revk commented Sep 4, 2023

I am not sure what you mean by "meter" and "pulse" to be honest - what are their units?
Also seems very inconsistent to be using ASCII HEX, but possible.

@MassiPi
Copy link

MassiPi commented Sep 15, 2023

what request are you using to get these values?
and what is this measuring? seems total energy used, since when?

@metarutaiga
Copy link
Author

image
This is my Daikin of Home Assistant.
I don't know what is FP / FM, I just guess what it means.
I compared it with my power wires Amp.
So I guess kWh = FP * FM / 1000.

@revk
Copy link
Owner

revk commented Sep 16, 2023

I am not sure how useful a cumulative kWh is? It would help to know what FP and FM are. How/when are they ever reset I wonder.

@metarutaiga
Copy link
Author

https://github.com/home-assistant/core/blob/57337b5cee5a5ab076ab89ded23219b40497e6b8/homeassistant/components/daikin/sensor.py#L132

I know it in the Home Assistant first time.
But now the WiFi module was updated by MobileApp and disabled local HTTP API, So the Home Assistant can't read it anymore.
So I check what the meter command is.

@JeanOlivier
Copy link

But now the WiFi module was updated by MobileApp and disabled local HTTP API

This is why we need a project like ES3P32-Faikin, oh my.

@44616E
Copy link

44616E commented Feb 4, 2024

This would be very useful for my use case, I was thinking of adding Current transformers on the AC feed, but if the air con can tell me that would be very useful. I'm trying to prioritize solar consumption

@revk
Copy link
Owner

revk commented Feb 6, 2024

OK do we know the units of the component parts yet?

@sjaakie09
Copy link

hello revk i mad some nice images you can also use for others
faikin_layout
and I like the tool a question did you also did things on using esp32 for metering like connecting it to puls gas or modbus rs485 kwh meters?

@revk
Copy link
Owner

revk commented Mar 12, 2024

That pin numbering is backwards, but nice pictures.

@sjaakie09
Copy link

sjaakie09 commented Mar 12, 2024 via email

@revk
Copy link
Owner

revk commented Mar 13, 2024

Just the numbering, pin 1 is the 5V.

I am also not sure how this image relates to the topic of this issue.

@sm-Fifteen
Copy link

I am not sure how useful a cumulative kWh is? It would help to know what FP and FM are. How/when are they ever reset I wonder.

It's pretty standard actually to have some kind of lifetime summation as the metric for energy usage, instead of having the accuracy of that metric depend on how often the server polls the device. Most ZigBee devices that measure electricity will report lifetime energy use over the smart power metering cluster as CurrentSummationDelivered, sent as a uint48 with a device-supplied multiplier, divider and unit of measure. 48 bits unsigned is big enough that (even in Wh) it wouldn't wrap around before 248 billion kWh, which seems to be roughly the amount of electricity that a country like Norway consumes over a year.

Likewise, Home Assistant doesn't use power sensors directly for its energy monitoring feature, and you need a virtual sensor that calculates the integration of that power reading if cumulative energy isn't reported.

@revk
Copy link
Owner

revk commented Mar 17, 2024

OK so are they cumulative somehow, what are they and what units?

@sm-Fifteen
Copy link

OK so are they cumulative somehow, what are they and what units?

OP said they matched the readings on their power meter (in watt-hours) pretty closely when multiplied together, though I guess further testing would be needed to know what either factor represents and what that power consumption covers and excludes (like whether the values always match on multi-zone systems).

I have yet to recieve and install my own Faikin dongles, though, so I can't help with that right now.

@revk
Copy link
Owner

revk commented Mar 17, 2024

Ok "when multiplied together". So what are the two values exactly?

@44616E
Copy link

44616E commented Mar 18, 2024 via email

@revk
Copy link
Owner

revk commented Mar 18, 2024

There are debug messages to allow you to send any S21 command and see replies. The manual should cover it all.

@sm-Fifteen
Copy link

FM : 02.47.4D.37.33.31.32.61.03
FP : 02.47.50.45.32.30.30.6E.03

FM : hex(2137) = 8503
FP : hex(2E) = 46
391 kWh = 8503(Meter) * 46(Pulse) / 1000(kilo)

Do these look like valid custom commands/payloads? GM7312a and GPE200n? OP called them FM amd FP, but they seem to be GM and GP from the hex codes, which would correspond with most other polling messages being G.

@revk
Copy link
Owner

revk commented Mar 18, 2024

Ok back to what is asked before.

What are "meter" and "pulse" and what units are they?

@sm-Fifteen
Copy link

sm-Fifteen commented Mar 18, 2024

Ok back to what is asked before.

What are "meter" and "pulse" and what units are they?

@revk : I believe that was OP trying to figure out what the values mean based on the ASCII letters, but I don't think they mean anything.

EDIT: As for the units, that's not going to be easy to describe without some additionnal datapoints, which I'm not able to collect yet. I was hoping someone, maybe 44616E, would capture some of those so that we have more data to work with and figure out what they both mean.

@sm-Fifteen
Copy link

FM : 02.47.4D.37.33.31.32.61.03
FP : 02.47.50.45.32.30.30.6E.03
FM : hex(2137) = 8503
FP : hex(2E) = 46
391 kWh = 8503(Meter) * 46(Pulse) / 1000(kilo)

Do these look like valid custom commands/payloads? GM7312a and GPE200n? OP called them FM amd FP, but they seem to be GM and GP from the hex codes, which would correspond with most other polling messages being G.

Oh, I only just found this page, I now understand that G is for reply payloads and that the ASCII transcriptions I wrote down are not valid requests, but actually responses. Assuming OP is right (would need more testing to find out whether or not he is) and these are integer values transmitted as hexadecimal ASCII strings (which I guess could make sense for unbounded multi-byte values?), the return value GPE200n is to be interpreted as F/G field "P": 0 0 2 E and decoded ax 0x002E = 46.

Should I understand that all one needs to run to get these values is mosquitto_pub -h 'my.mqtt.server.local' -t 'command/MyDaikinHostname/send' -m 'FM'?

@revk
Copy link
Owner

revk commented Mar 19, 2024

Maybe, maybe FP too.

@sm-Fifteen
Copy link

Can I query these values through MQTT as a custom command? I should be able to compare the values to a smart meter in the board to confirm if it holds true for my units as well.

@44616E: If you have a chance to test this on your end, you can use these commands and see if the readings match with your own measurements.

mosquitto_pub -h 'my.mqtt.server.local' -t 'command/MyDaikinHostname/send' -m 'FM'
mosquitto_pub -h 'my.mqtt.server.local' -t 'command/MyDaikinHostname/send' -m 'FP'

@serimi89
Copy link

serimi89 commented Mar 21, 2024

Played around with this today, the FP message (GP result) did not change. It was: {"protocol":"S21","dump":"024750443730307203","GP":"D700"}

Regarding the FM (GM result) messages I could see the below values:
14:18 / AC OFF {"protocol":"S21","dump":"02474D323233335E03","GM":"2233"}
14:50 / AC OFF {"protocol":"S21","dump":"02474D323233335E03","GM":"2233"}
14:51 / AC TURNED ON
14:54 / AC ON {"protocol":"S21","dump":"02474D333233335F03","GM":"3233"}
14:57 / AC ON {"protocol":"S21","dump":"02474D343233336003","GM":"4233"}
15:05 / AC ON {"protocol":"S21","dump":"02474D353233336103","GM":"5233"}
15:11 / AC ON {"protocol":"S21","dump":"02474D363233336203","GM":"6233"}
15:18 / AC ON {"protocol":"S21","dump":"02474D373233336303","GM":"7233"}

So obviously, something is counting. If we compare this to the the kWh on my power meter, it seems like it is incrementing by 0.1kwh every time the GM value increases.

Screenshot 2024-03-21 at 15 22

Ok just like me you were wondering what comes after 9233, so here we go:
{"protocol":"S21","dump":"02474D413233336D03","GM":"A233"}
{"protocol":"S21","dump":"02474D423233336E03","GM":"B233"}

Hope this helps, If you need anything else, please let me know!

Seb

@revk
Copy link
Owner

revk commented Mar 21, 2024

OK, now makes more sense.

I suspect GP is telling you that it meters pulses every 125Wh and is a fixed value.

I suspect GM is a meter telling you how many GP sized pulses.

OK, now to work out how best to report it, and handle meter wrap around.

Anyone know the HA config that would make sense for a "meter" like this?

@revk
Copy link
Owner

revk commented Mar 21, 2024

I have made a beta with a Wh report, see if that makes sense.

No HA config yet, let me know what HA config it would need?

@serimi89
Copy link

Great - just installed it and getting values.
How do you know its 125Wh per pulse?

I have had some sensors that report Wh and imported it through the Utility Meter integration: https://www.home-assistant.io/integrations/utility_meter/ This can then be added to the energy dashboard to see time based stats.

@44616E
Copy link

44616E commented Mar 22, 2024 via email

@sm-Fifteen
Copy link

Just tried the beta firmware and the Wh is about 2.8 times higher than it should be. Which seems to correlate with my GP value of 280 (at least that the increment in Wh). Perhaps GM is actually at a fixed multiplier and doesn't need to be multiplied by GP.Will collect some more data over the weekend.I'm also interested if we can get the realtime power value in Watts it exists in that home automation configuration linked to earlier. Not sure how you go from there to the commands.

@44616E: There are also other unknown fields under the F command that could be involved in power readings:

The basic polling loop seems to consist of F/G commands: 2, 1, 3, 4, 5, 8, 9, 6, 7, B, G, K, M, N, P, Q, S, T, U, U (again), X, and less frequently R/S commands: H, N, I, a, X, d, L

There might be other values involved in the energy calculations among these, and possibly a real time estimation of power consumption. I'm also guessing state indicators like "Stand by for defrost/hot start" and "Changeover controlled by the master indoor unit" like we see on the more advanced wired thermostats might show up.

@serimi89
Copy link

I am happy to help testing various commands, can someone explain to me how to read / convert the results? as far as I understood they are hex, but also reversed?

@serimi89
Copy link

I am happy to help testing various commands, can someone explain to me how to read / convert the results? as far as I understood they are hex, but also reversed?

Well, correct me if I am wrong, but some values need to be converted to decimal, others are fine as hex, but its always inverted.

I wonder if FM / GM is not simply counting up the kWh, in my case the value is 13123 (hex: 3343), which could be 1312,3 kWh and which is incrementing by 0.1 kWh as seen here. This would match the ONECTA App, where 0.1 kWh is the smallest unit.
I dont have consumption data before last year (2023: ~500kWh), but if its a lifetime value, It could make sense since I have my AC almost 3 years.

@44616E
Copy link

44616E commented Mar 22, 2024

I am happy to help testing various commands, can someone explain to me how to read / convert the results? as far as I understood they are hex, but also reversed?

Well, correct me if I am wrong, but some values need to be converted to decimal, others are fine as hex, but its always inverted.

I wonder if FM / GM is not simply counting up the kWh, in my case the value is 13123 (hex: 3343), which could be 1312,3 kWh and which is incrementing by 0.1 kWh as seen here. This would match the ONECTA App, where 0.1 kWh is the smallest unit. I dont have consumption data before last year (2023: ~500kWh), but if its a lifetime value, It could make sense since I have my AC almost 3 years.

I am thinking the same, my values look very close if we use a 0.1 multiplier. Will test some more tonight.

@44616E
Copy link

44616E commented Mar 23, 2024

"The ‘Outdoor compressor Energy consumption’ and ‘Outdoor compressor Estimated power consumption’ sensors are updated every time 100 Wh are consumed by all different operating modes summed together."

https://www.home-assistant.io/integrations/daikin#sensor

So seems the multiplier is fixed. Do I think GP is not required.

The estimated power consumption would be handy.

@metarutaiga
Copy link
Author

metarutaiga commented Mar 23, 2024

The Daikin integration in HA has wrong power consumption value with my aircon.
It seems that official wifi module is read wrong data.

@revk
Copy link
Owner

revk commented Mar 23, 2024

OK so what is GP?

This is why is asked the units in the first place!

I can change to 100Wh multiplier, no problem.

But is GP useful? Or shall we ignore it?

@serimi89
Copy link

serimi89 commented Mar 23, 2024

OK so what is GP?

This is why is asked the units in the first place!

I can change to 100Wh multiplier, no problem.

But is GP useful? Or shall we ignore it?

I think the original assumption was just letter based, P = pulse, M = Meter - doesn't seem to be necessary a proof that both are necessary?

Anyway, I have been reading the new Daikin Cloud API I came across this re power consumption, which is exactly the way data is displayed on the ONECTA App, too and I think it it was displayed in the local api, too.

I just disconnected my Daikin WiFi Adapter last week and replaced it with the Faikin, but might connect it again in the next days to look for consumption data clues.

Characteristic name: consumptionData

Description: You can consult the energy consumption of your devices. Please note that not all Daikin devices support consumption data through the API, as such it's possible that the consumptionData object is not always present.
"consumptionData": {
"settable": false,
"value": {
"electrical": {
"unit": "kWh",
"heating": {
"d": [ 0, 0, 0, 1, 2, 0, 2, 3, 0, 1, 1, 1, 1, 2, 1, 1, 2, 3, 1, 5, 7, null, null, null ],
"w": [ 0, 0, 0, 0, 100, 30, 130, 0, 0, 0, 0, 100, null, null ],
"m": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 264 ]
},
"cooling": {
"d": [ 0, 0, 0, 1, 2, 0, 2, 3, 0, 1, 1, 1, 1, 2, 1, 1, 2, 3, 1, 5, 7, null, null, null ],
"w": [ 0, 0, 0, 0, 100, 30, 130, 0, 0, 0, 0, 100, null, null],
"m": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 264 ]
}
}
}
}

There can be electrical and gas data. The data is split up between heating and cooling (if available). There are three arrays of data available. "d" contains 24 fields spread over the current day and the day before.
d[0] => 00:00-02:00 yesterday
d[1] => 02:00-04:00 yesterday
...
d[22] => 20:00-22:00 today
d[23] => 22:00-24:00 today

"w" contains 14 fields spread over this week and last week.
w[0] => Monday last week
w[1] => Tuesday last week
...
w[12] => Saturday this week
w[13] => Sunday this week

"m" contains 24 fields spread over this year and last year.
m[0] => January last year
m[1] => February last year
...
m[22] => November this year
m[23] => December this year

Due to the structure of the data, some fields can be empty (null), which means data is not (yet) available for this timeslot.

Consumption data is expected to be updated every 2 hours, randomized from the startup time of the Daikin device. This means that, for example, data d[0] will be available between 02:00 & 04:00.

@revk
Copy link
Owner

revk commented Mar 23, 2024

OK changing to 100wH units - beta issue shortly.

@sm-Fifteen
Copy link

sm-Fifteen commented Mar 23, 2024

I am happy to help testing various commands, can someone explain to me how to read / convert the results? as far as I understood they are hex, but also reversed?

Well, correct me if I am wrong, but some values need to be converted to decimal, others are fine as hex, but its always inverted.

I wonder if FM / GM is not simply counting up the kWh, in my case the value is 13123 (hex: 3343), which could be 1312,3 kWh and which is incrementing by 0.1 kWh as seen here. This would match the ONECTA App, where 0.1 kWh is the smallest unit. I dont have consumption data before last year (2023: ~500kWh), but if its a lifetime value, It could make sense since I have my AC almost 3 years.

Ah! It did seem weird to me that the energy reading value would depend on a device-dependent and possibly dynamic multiplier. FM/GM being hectowatt-hours makes a lot more sense.

I'll be sure to run tests of my own once the Faikin controllers for my multi-zone units get delivered, probably around monday.

@44616E
Copy link

44616E commented Mar 24, 2024

OK changing to 100wH units - beta issue shortly.

Downloaded latest Beta on to my units, but now don't seem to have Wh in the State or Faikin MQTT messages. So can't compare the new values (I can only do this at night when the other loads are off as the power meter in for the whole building).

@revk
Copy link
Owner

revk commented Mar 24, 2024

Grr, I set to poll P not M, sorry. Try again in moment - making beta now.

@44616E
Copy link

44616E commented Mar 24, 2024

Thanks, now getting WH. Looks good so far, will check it over night to see how it compares.

@44616E
Copy link

44616E commented Mar 24, 2024

image
Seems pretty good if averaged over a reasonable period of time. Over 20 minutes I got 3.3kw (converting from Wh to W) from Wh compared to around 3.28kW according to the meter.

@sm-Fifteen
Copy link

sm-Fifteen commented Mar 30, 2024

Ok, so I finally plugged in my Faikin boards, I've been trying out a few things.

So far, I can't get either of my units (two FTXS12LVJU connected to a single 2MXS18NMVJUA outdoor unit) to reply to an FM command. I have in fact rested the others listed here, and I'm getting this:

  • My unit replies to F1, F2, F3, F4, F5, F8
  • It does not reply to F6, F7, F9, FB, FG, FK, FM, FN, FP, FQ, FS, FT, FU, FX
  • It also replies to RH, RN, RI, Ra, RX, Rd, RL

So energy monitoring could be something that's not supported on all models, possibly?

EDIT: I'll also note that, even though F6 is the command that reports whether powerful mode is turned on or off, and even though neither F6 (read) nor D6 (set) work, that unit very much has a powerful mode, and Faikin is unable to enable it, or recognize that it's on when turned on manually.

EDIT2: Enabling debug mode and fiddling with the controller, it seems like neither Powerful mode, neither Comfort mode (louvers go up while heating and down while cooling) or "intelligent eye mode" (target temp goes dow by 2C if there's been no movement in the room for 20+ minutes) in reflected by the output of the list of commands that Faikin knows at this time.

@44616E
Copy link

44616E commented Mar 30, 2024

The link I posted earlier does say that its not supported on all models. It also appears that it may be an estimate. So far I have only tried it on my new premium units. I will try on my Daikin lites and a cassette latter.

I find at least for cooling the compressor frequency is pretty consistant with power consumption so if you don't have metering you could use that with a lookup table. But this would be model specific so not something that would make sense for the faikin to do it self.

@44616E
Copy link

44616E commented Mar 30, 2024

When I get time to play around with the commands I would like to try and find humidity. It is reported on the inbuilt wifi (not connected by s21).

@MassiPi
Copy link

MassiPi commented Mar 30, 2024

So energy monitoring could be something that's not supported on all models, possibly?

it's likely.
I've still not tested, but i expect also my FTXSxxG2V1B units not to be able to report power consumption, like they cant report or set powerful and eco mode (even if the units HAVE these modes and they can be set with the remote controller)
old units :)

@Swalabrr
Copy link

I have 2 daikins which were connected to onecta app from day one. I've just installed the faikins in them and I can confirm that the Wh value closely resembles what onecta app is reporting.

One daikin has a lifetime consumption of
423.1 kWh as reported in onecta
422100 Wh as reported in faikin

the other one
229.7 kWh as reported in onecta
230100 Wh as reported in faikin.

So, I'm here to confirm that what faikin is reporting is correct. Hopefully you will soon add the HA sensor for energy :D

@revk
Copy link
Owner

revk commented Mar 30, 2024

What's the HA JSON config for that?

@44616E
Copy link

44616E commented Mar 30, 2024

EDIT2: Enabling debug mode and fiddling with the controller, it seems like neither Powerful mode, neither Comfort mode (louvers go up while heating and down while cooling) or "intelligent eye mode" (target temp goes dow by 2C if there's been no movement in the room for 20+ minutes) in reflected by the output of the list of commands that Faikin knows at this time.

Powerful mode also doesnt work properly for me. It can report powerful mode from the remote, but if set by faikin it toggles on and off repeatedly and doesnt seem to do anything. I guess we should start a seperate issue for it.

@sm-Fifteen
Copy link

sm-Fifteen commented Mar 30, 2024

So energy monitoring could be something that's not supported on all models, possibly?

it's likely.
I've still not tested, but i expect also my FTXSxxG2V1B units not to be able to report power consumption, like they cant report or set powerful and eco mode (even if the units HAVE these modes and they can be set with the remote controller)
old units :)

My units are only 2 years old, though, even though the LV series heads are older (but still the most efficient) and the MXS multizone series not the highest end of their multizone range (which would be MXL/Aurora). Regarding the missing signals, I wonder how the official wired controllers do. Do tgey have extra commands we haven't found yet?

EDIT2: Enabling debug mode and fiddling with the controller, it seems like neither Powerful mode, neither Comfort mode (louvers go up while heating and down while cooling) or "intelligent eye mode" (target temp goes dow by 2C if there's been no movement in the room for 20+ minutes) in reflected by the output of the list of commands that Faikin knows at this time.

Powerful mode also doesnt work properly for me. It can report powerful mode from the remote, but if set by faikin it toggles on and off repeatedly and doesnt seem to do anything. I guess we should start a seperate issue for it.

Probably, yeah.

EDIT: Actually that looks like a different issue. My unit simply does not respond to F6/F7 messages, and looking at the publically available service manuals, it appears like it could be related to how neither the wired Nav controller (BRC1E73), nor the brand new Daikin One+ smart thermostats (which have a "boost mode", but only for "unitary" ducted models, not S21 or P1P2), nor the older DKN Cloud/DKN Plus (rebranded Airzone Aidoo adapters, either AZAI6WSCDKB or AZAI6WSPDKC, respectively) have any kind of support or understanding of the powerful (and apparently Comfort airflow) modes that are specific to some wall-mounted or "floor-mounted" units.

@Swalabrr
Copy link

Swalabrr commented Apr 3, 2024

What's the HA JSON config for that?

i've managed to add lifetime energy as a sensor in HA with the following configuration.yaml changes:

mqtt:
sensor:
- name: "AC-Studio - Lifetime Energy"
state_topic: "A412FA97EC1C"
unit_of_measurement: "kWh"
value_template: "{{ (value_json.Wh | float) / 1000 }}"
device:
identifiers:
- A412FA97EC1C
name: AC-Studio

it does add the entity in HA, but the entity has no parent device.

@revk
Copy link
Owner

revk commented Apr 4, 2024

OK, added to latest beta, let me know if that works.

@revk revk closed this as completed Apr 4, 2024
@Swalabrr
Copy link

Swalabrr commented Apr 4, 2024

image

yup, it works!

Thank you!

@MassiPi
Copy link

MassiPi commented Apr 8, 2024

So energy monitoring could be something that's not supported on all models, possibly?

yes i can confirm, also on my (old) FTXSxxG units no F6, F7, FM and FP replies, so no powerful, silent, power consumption etc.
would be nice to have a table of available info/functions for split model.. today's table is just, more or less, S21 working or not

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

9 participants