I managed to connect my everHome CloudBox for controlling shutters using proprietary protocols and thought I’d share the steps in case they are helpful for anyone else. I had found GitHub - DrHouseIT/everHome2MQTT but it seemed fairly complex to set up given that I only want to integrate a handful of devices and no changes are planned.
-
Go to https://everhome.cloud/en/developer/applications and create an application. Use some meaningful name and http://localhost:12345 for the application website. Take note of the client id {client_id} and secret {client_secret}
-
In a browser, open the URL https://everhome.cloud/oauth2/authorize?client_id={client_id}&response_type=code&redirect_uri=http://localhost:12345&state=state, log in and authorize the request.
-
Wait for the request to time out and take note of the code in the address bar. E.g., for http://localhost:12345/?code=12345_67_abcdefgh&state=state the code is 12345_67_abcdefgh for which I’ll use the placeholder {code}
-
Submit a POST request to the URL https://everhome.cloud/oauth2/token with data
client_id={client_id}&client_secret={client_secret}&grant_type=authorization_code&code={code}&redirect_uri=http://localhost:12345
. E.g., using curl:curl https://everhome.cloud/oauth2/token -d "client_id={client_id}&client_secret={client_secret}&grant_type=authorization_code&code={code}&redirect_uri=http://localhost:12345"
. -
From the response get the access token value. E.g., in
{"access_token":"12345_67_ijklmno","expires_in":86400,"refresh_token":"12345_67_pqrstuvw","token_type":"Bearer","userid":12345}
the access token is 12345_67_ijklmno ({access_token}). Note: According to the response the token is only valid for 24 hours. However, I am using the same token for several months and it is still working fine. -
Access the URL https://everhome.cloud/device?include=properties providing the HTTP header
Authorization: Bearer {access_token}
. E.g., using curl:curl https://everhome.cloud/device?include=properties -H "Authorization: Bearer {access_token}"
. -
In the JSON response find the ID values for the devices that you need to control. E.g., in the following example 3 is the ID that we need. You can also see a block
"actions"
with"key"
values for the actions to execute. For a shutter these arestate-set
,up
,down
,stop
.
{
"actions": [{
"key": "state-set",
"style": "",
"type": "state",
"subtype": "",
"reactable": true,
"statetransforms": null,
"visibility": {
"single": false,
"singleextra": false,
"list": false,
"learn": false
}
}, {
"key": "up",
"style": "positive",
"type": "button",
"subtype": "",
"plannable": true,
"reactable": true,
"statetransforms": [{
"type": 0,
"key": "general",
"value": "up"
}],
"visibility": {
"single": true,
"singleextra": false,
"list": true,
"learn": false
}
}, {
"key": "down",
"style": "negative",
"type": "button",
"subtype": "",
"plannable": true,
"reactable": true,
"toggleaction": true,
"statetransforms": [{
"type": 0,
"key": "general",
"value": "down"
}],
"visibility": {
"single": true,
"singleextra": false,
"list": true,
"learn": false
}
}, {
"key": "stop",
"style": "secondary",
"type": "button",
"subtype": "",
"reactable": true,
"statetransforms": null,
"visibility": {
"single": true,
"singleextra": false,
"list": true,
"learn": true
}
}],
"address": 123456789,
"confirmonmobile": false,
"disabled": false,
"features": null,
"gatewayid": 2,
"homeid": 1,
"iconkey": "shutter",
"id": 3,
"isnow": false,
"manufacturerid": 123,
"name": "Shutter kitchen",
...
}
-
Add the access token to secrets.yaml as
everhome_authorization: Bearer {access_token}
-
Define rest actions in configuration.yaml. I’m doing this via an include
rest_command: !include rest_command.yaml
. In the include file put the commands where 3 in https://everhome.cloud/device/3/execute is the ID obtained above and also the actions likeup
in'{"action":"up"}'
.
shutter_kitchen_up:
url: "https://everhome.cloud/device/3/execute"
method: post
headers:
authorization: !secret everhome_authorization
content_type: "application/json"
payload: '{"action":"up"}'
shutter_kitchen_down:
url: "https://everhome.cloud/device/3/execute"
method: post
headers:
authorization: !secret everhome_authorization
content_type: "application/json"
payload: '{"action":"down"}'
shutter_kitchen_stop:
url: "https://everhome.cloud/device/3/execute"
method: post
headers:
authorization: !secret everhome_authorization
content_type: "application/json"
payload: '{"action":"stop"}'
This part can get long if you have many devices. There’s probably a nicer way of listing multiple devices that have the same actions. Any feedback how to improve is welcome.