So I got a Rituals Perfume Genie (https://www.rituals.com/en-nl/collection-story-perfumegenie.html) which I can control using an API.
Now I want to integrate it into HASS and have been struggling to use a RESTful switch for this purpose.
Is a RESTful switch the way to go?
Some info:
I can get the status of the Genie with the following GET:
https://rituals.sense-company.com/api/account/hubs/<HUB HASH HIDDEN>
This returns the following JSON:
[
{
"hub": {
"hublot": "LOT119-12-A4980-02273",
"hash": "bcc1f4941651c887b27531ad7b72a4f9d3b979ef8aa706c650608d",
"status": 1,
"title": null,
"current_time": "2020-01-28T09:41",
"ping_update": "25",
"attributes": {
"roomc": "2",
"speedc": "2",
"fanc": "0",
"roomnamec": "Genie",
"resetc": ""
},
"sensors": {
"wific": {
"id": 4,
"sensor_id": 1,
"title": "Low",
"description": "This signal is weak",
"icon": "icon-signal-low.png",
"image": "",
"discover_image": "",
"min_value": "-100.00",
"max_value": "-70.00",
"interval": "1",
"created_at": "2017-03-10 14:31:39",
"updated_at": "2017-06-21 13:29:05",
"default": 0
},
"battc": {
"id": 21,
"sensor_id": 2,
"title": "Charging",
"description": "When the device has a power cord connected to it. ",
"icon": "battery-charge.png",
"image": "",
"discover_image": "",
"min_value": "701",
"max_value": "1500",
"interval": "1",
"created_at": "2017-04-10 15:02:59",
"updated_at": "2018-10-15 14:29:06",
"default": 0
},
"fillc": {
"id": 38,
"sensor_id": 3,
"title": "90-100%",
"description": "",
"icon": "icon-fill.png",
"image": "",
"discover_image": "",
"min_value": "0",
"max_value": "1000",
"interval": "",
"created_at": "2017-10-16 07:50:23",
"updated_at": "2017-10-16 07:57:37",
"default": 0
},
"rfidc": {
"id": 54,
"sensor_id": 4,
"title": "Private Collection Sweet Jasmine",
"description": "",
"icon": "icon-jasmine.png",
"image": "background-jasmine.png",
"discover_image": "discover-jasmine.png",
"min_value": "05377650",
"max_value": "05377650",
"interval": "",
"created_at": "2019-04-04 07:53:32",
"updated_at": "2019-05-02 14:10:59",
"default": 0
},
"versionc": "1.2.9",
"ipc": "1578154445",
"rpsc": {
"id": 48,
"sensor_id": 12,
"title": "Fan on",
"description": "",
"icon": "",
"image": "",
"discover_image": "",
"min_value": "5",
"max_value": "10000",
"interval": "",
"created_at": "2018-01-23 12:05:45",
"updated_at": "2019-08-01 14:54:53",
"default": 0
},
"resetc": "Software/System restart",
"chipidc": "5377254",
"errorc": "",
"onlinec": {
"id": 31,
"sensor_id": 16,
"title": "Online",
"description": "",
"icon": "",
"image": "",
"discover_image": "",
"min_value": "1",
"max_value": "1",
"interval": "",
"created_at": "2017-09-07 08:23:30",
"updated_at": "2017-09-07 08:23:30",
"default": 0
}
},
"settings": []
}
}
]
The status is retrieved from the attribute "fanc": "0",
I can turn on the Genie using the following POST:
https://rituals.sense-company.com/api/hub/update/attr?hub=<HUB HASH HIDDEN>&json={"attr":{"fanc":"1"}}
And off using:
https://rituals.sense-company.com/api/hub/update/attr?hub=<HUB HASH HIDDEN>&json={"attr":{"fanc":"0"}}
Does someone have an idea how to integrate the Genie into HASS? Is a RESTful switch the way to go?