Skip to content

Client to client communication

It is possible to call RPC methods from one client on another client. By default this is blocked, so we must give the client's the permission to do this.

Edge client group

First, both clients need an edge client group with an edge client ACL allowing general access to each other. If there is no such group, it can be created using REST, e. g. for full access:

curl --location 'https://core.sensaru.net/api/v1/edge_client_groups' \
--header 'PRIVATE-TOKEN: <your API key>' \
--header 'C1-BUSINESS-PARTNER: <the business partner to create the ACL in>' \
--data '{
    "name": "My edge client group",
    "acl": {"moduleAccess": {"*": {"global": {"event": true, "isAdmin": true, "read": true, "write": true}}}, "version": 1}
}'

This group now must be assigned to the edge client. Currently there is no REST method for this and it must be done manually in database.

cloudconnect.conf on edge client

Add c1-proxy to moduleMethodModuleWhitelist and the opposite client to moduleMethodModuleClientWhitelist. The format of the other client is the following: c1-proxy-<business partner ID>_<edge client ID>_<sub ID>. The sub ID typically is 1 and the edge client ID typically is the device's serial number. So for example, to allow access to edge client DW000000000216 of business partner deb6fa98-3e2d-428b-bf21-9a94c5b6e001, enter the following.

# Comma seperated list of module IDs that are allowed to call RPC functions in Homegear Cloudconnect.
moduleMethodModuleWhitelist = c1-device-management, c1-proxy

# Comma seperated list of module client IDs that are allowed to call RPC functions in Homegear Cloudconnect.
# moduleMethodModuleClientWhitelist = moduleId-moduleClientId1, moduleId-moduleClientId2, moduleId-moduleClientId3
moduleMethodModuleClientWhitelist = c1-proxy-deb6fa98-3e2d-428b-bf21-9a94c5b6e001_DW000000000216_1

After the changes, restart the homegear-cloudconnect service.

Test

To test, execute this example call on the other client:

homegear -e rc 'print_v($hg->cloudconnectModuleMethod("c1-proxy", "deb6fa98-3e2d-428b-bf21-9a94c5b6e001_DW000000000216_1", "getVersion", [], true /* wait for response */, 0));'