You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are there any plans to implement the Linked Services logic?
I'm implementing - or at least trying to - the Television service which comes with two linked services (InputSource and TelevisionSpeaker) but I am having difficulties. I tried to add this functionality but it's not clear for me what is linked to what. Is the "sub" service linked to the "main" service or the linked attribute contains the sub service's ids?
i have implemented it for my irrigation system which has to be linked to valve services. but it was more hack than proper implementation.
in terms what is linked to what i would say, main services has an array with linked services IDs.
@scothi So you have a working Television service?
Would you mind sharing it, esp. the missing characteristics? I tried the same but I just can't get it working.
No exceptions or errors, but the accessory is still shown as "not available" in the home app.
I suspect that something is wrong with the characteristics, but I just can't find it.
I don't see how I can add a linked service when using hap-java.
AbstractServiceImpl isn't accessible. I ran into problems when adding FilterMaintenanceAccessory. The service it's linked to can't be added as a linked service now.
yes, i have proposed the addLinkedAccessory as well but decided against it in order to be consistent with Characterstics which has addCharacteristics only at AbstractServiceImpl but not in the interface.
as of now you can do this
accessory.getServices().add(new Service())
but maybe we should really introduce addLinkedService at Service interface. maybe also the addCharacteristic as well. it is more developer friendly imo.
@gjvanderheiden you are completely right, without adding addLinkedService to Service interface we cannot use it. it was working only with test mock client as i could overwrite getService there.
and it is also correct to add addCharacteristics to Service interface. characteristics are fixed and the developer should not add them manually one-by-one.
let me prepare a PR with changes
this is the approach @gjvanderheiden was also proposing - dedicated methods.
my idea was to keep it more flexible as services can be combined in many different ways and HAP does not restrict it. e.g. you can add battery service to lightbulb or switch and home app shows it correctly.
other examples are fan, slat and sensors which can be added to many other services like AirPurifier, Heating and other.
so, we would need to add many methods for almost all combinations.
Activity
yfre commentedon Mar 30, 2020
i have implemented it for my irrigation system which has to be linked to valve services. but it was more hack than proper implementation.
in terms what is linked to what i would say, main services has an array with linked services IDs.
scothi commentedon Mar 31, 2020
Ok, thanks. Now it’s working. :)
yfre commentedon Mar 31, 2020
cool. will you push your changes to your repository or create PR here? i would love to integrate your changes to my branch.
scothi commentedon Apr 1, 2020
PR sent #105
dfrommi commentedon Sep 30, 2020
@scothi So you have a working Television service?
Would you mind sharing it, esp. the missing characteristics? I tried the same but I just can't get it working.
No exceptions or errors, but the accessory is still shown as "not available" in the home app.
I suspect that something is wrong with the characteristics, but I just can't find it.
gjvanderheiden commentedon Dec 10, 2020
Could
public void addLinkedService(Service service)
be added to the interface Service.
I don't see how I can add a linked service when using hap-java.
AbstractServiceImpl isn't accessible. I ran into problems when adding FilterMaintenanceAccessory. The service it's linked to can't be added as a linked service now.
gjvanderheiden commentedon Dec 10, 2020
I would like to do this:
HomekitAccessory accessory = new MockSwitch(...);
accessory.addLinkedAccessory(new MockBatteryAccessory());
yfre commentedon Dec 10, 2020
yes, i have proposed the addLinkedAccessory as well but decided against it in order to be consistent with Characterstics which has addCharacteristics only at AbstractServiceImpl but not in the interface.
as of now you can do this
accessory.getServices().add(new Service())
but maybe we should really introduce addLinkedService at Service interface. maybe also the addCharacteristic as well. it is more developer friendly imo.
yfre commentedon Dec 10, 2020
@gjvanderheiden you are completely right, without adding addLinkedService to Service interface we cannot use it. it was working only with test mock client as i could overwrite getService there.
and it is also correct to add addCharacteristics to Service interface. characteristics are fixed and the developer should not add them manually one-by-one.
let me prepare a PR with changes
dfrommi commentedon Dec 10, 2020
I actually thought it could used like this:
AbstractServiceImpl, let's sayTelevisionServiceTelevisionServicewould expose a method likeaddInputSource(InputSourceService s)super.addLinkedService(s)Do you see a problem with this approach?
You can't link arbitrary services, so type-safety imho would make sense.
yfre commentedon Dec 10, 2020
this is the approach @gjvanderheiden was also proposing - dedicated methods.
my idea was to keep it more flexible as services can be combined in many different ways and HAP does not restrict it. e.g. you can add battery service to lightbulb or switch and home app shows it correctly.
other examples are fan, slat and sensors which can be added to many other services like AirPurifier, Heating and other.
so, we would need to add many methods for almost all combinations.
dfrommi commentedon Dec 10, 2020
Ah, I see.
Didn't know that you can combine arbitrary services. Thanks.