daikin-controller-cloud
daikin-controller-cloud copied to clipboard
getData() based on managementPointType
Current getData() works based on embeddedId. Until now I assumed the embeddedId was always one of "climateControl" or "climateControlMainZone". Issue https://github.com/JeroenVdb/homebridge-daikin-cloud/issues/78 points out that the embeddedId can also have other values.
This is also confirmed by the Daikin API documentation: https://b6181f2edaca.eu.portal.konghq.com/docs/b0dffcaa-7b51-428a-bdff-a7c8a64195c0/general_concepts#doc-heading-management-point-overview
A management point bundles a part of the functionality of a Daikin unit. For example, a Daikin unit can have both domestic hot water and climate control functionality. Network gateway functionality is also exposed as a management point. Examples:1st floor climate control, domestic hot water tank, living room heat pump indoor unit. In the ONECTA Cloud, a limited number of different management point types, based on the different high-level functionalities, are supported. An overview is given here.
The examples given by Daikin all have different embeddedIds.
I would need to be able to get a management point id by it's type. Either by having a separate method that gets all managementPoints for a managementPointType.
getManagementPointByType(managementPointType: string) { ... }
// OR
getEmbeddedIdsByManagementPointType(managementPointType: string) { ... }
Or have a second getDataByManagementType() method that chains getData() like
getDataByManagementType(managementPointType: string, dataPoint: any, dataPointPath: any) {
const embeddedId = ...
return this.getData(embeddedId, dataPoint, dataPointPath);
}
One unknown: is it possible that we have multiple management points of the same type? I haven't seen it, nor is it stated in the docs. But I assume that a type can have multiple occurrences. If you would go that way, the first approach would be better I think. In that case applications would first find the embeddedIds they need and then do the getData calls for them.
Let me know what you think, if you want I can do a PR for this.