RESTful or not? Rituals Perfume Genie

V2 has a battery as well doesn’t it? You can add a sensor like this:

sensor:
- platform: rest
  resource: 'https://rituals.sense-company.com/api/account/hubs/HUB KEY HERE'
  method: GET
  name: Genie Battery
  value_template: '{{ value_json.0.hub.sensors.battc.title }}'

This way you can extract all the other sensor data as well such as “fillc” for the fill amount of the cartridge and “rfidc” for the perfume name.

I happened to try that already.
I only get an on / off sensor (see screenshot)battery

i have this now:

butt i want the state of de battery (Charging, Full etc).

This is what is looks like for me:

No, V2 only works powered with cable.
Yes, the way you mention is how all that info can be retrieved. I would like to translate that refill info (now is a id and a string) to percentage.

Did you declared it in the binary_sensor or sensor section?

Here’s my full config for the Genie:

binary_sensor:
- platform: rest
  resource: 'https://rituals.sense-company.com/api/account/hubs/HUB KEY HERE'
  method: GET
  name: Genie Status
  value_template: '{{ value_json.0.hub.attributes.fanc == "1" }}'
  
sensor:
- platform: rest
  resource: 'https://rituals.sense-company.com/api/account/hubs/HUB KEY HERE'
  method: GET
  name: Genie Battery Status
  value_template: '{{ value_json.0.hub.sensors.battc.title }}'

- platform: rest
  resource: 'https://rituals.sense-company.com/api/account/hubs/HUB KEY HERE'
  method: GET
  name: Genie Perfume Level
  value_template: '{{ value_json.0.hub.sensors.fillc.title }}'
  
- platform: rest
  resource: 'https://rituals.sense-company.com/api/account/hubs/HUB KEY HERE'
  method: GET
  name: Genie Perfume Name
  value_template: '{{ value_json.0.hub.sensors.rfidc.title }}'
  
- platform: rest
  resource: 'https://rituals.sense-company.com/api/account/hubs/HUB KEY HERE'
  method: GET
  name: Genie Wifi Status
  value_template: '{{ value_json.0.hub.sensors.wific.title }}'

rest_command:
  genie_on:
    method: POST
    url: 'https://rituals.sense-company.com/api/hub/update/attr?hub=HUB HASH HERE&json=%7B%22attr%22%3A%7B%22fanc%22%3A%221%22%7D%7D'
    content_type: application/json
    
  genie_off:
    method: POST
    url: 'https://rituals.sense-company.com/api/hub/update/attr?hub=HUB HASH HERE&json=%7B%22attr%22%3A%7B%22fanc%22%3A%220%22%7D%7D'
    content_type: application/json
            
switch:
  - platform: template
    switches:
      genie:
        value_template: "{{ is_state('binary_sensor.genie_status', 'on') }}"
        turn_on:
          service: rest_command.genie_on
        turn_off:
          service: rest_command.genie_off

it works now! i had binary_sensor. there was the problem.
thanks for your help

Great! Glad you found the problem.

Hi
I have some issues here, i cant get this into Hassio, is there something wrong in the code.?
/Jerry

sensor:

binary_sensor:

rest_command:

genie_on:

method: post

url: 'https://rituals.sense-company.com/api/hub/update/attr?hub=SHORT CODE&json=={"attr":{"fanc":"1"}}'

content_type: application/json

genie_off:

method: post

url: 'https://rituals.sense-company.com/api/hub/update/attr?hub=SHORT CODE&json=={"attr":{"fanc":"0"}}'

content_type: application/json

Hello
I have your code in my config.yaml, but how do i get into Hassio. I cant see it in there.
/Jerry

Hello
In your code, the HUB KEY is this the long one, and HASH is the short one?
/Jerry

that’s right!
The HASH key is de lone one, and the HUB hash is de short one.

Nice, thank you.

I there not a way to make an integration from this? It looks like it is an easy API.

Really easy! Thanks for exploring this

It wont work in my config.

what is going wrong here?

rest_command:
genie_on:
method: POST
url: ‘https://rituals.sense-company.com/api/hub/update/attr?hub=SHORT KEY&json=={“attr”:{“fanc”:“1”}}’
content_type: application/json
genie_off:
method: POST
url: ‘https://rituals.sense-company.com/api/hub/update/attr?hub=SHORT KEY&json=={“attr”:{“fanc”:“0”}}’
content_type: application/json

binary_sensor:

Hope someone can help me

Maybe there is something wrong with your keys. What will happen if you put the url direct in your browser (include key)? If your key is good there must be a output in plain text.

https://rituals.sense-company.com/api/account/hubs/ SHORT KEY

https://rituals.sense-company.com/api/hub/update/attr?hub= SHORT KEY

with this link in my browser get a server error 500

I think you have not used the right key, or swapped the long and short key. Follow the steps from @niekniek89 again.

this is the right way?
https://rituals.sense-company.com/api/hub/update/attr?hub=ONLYCODE&json=={“attr”:{“fanc”:“1”}}’

example
https://rituals.sense-company.com/api/hub/update/attr?hub=4bdd4058d499704cbadab8e0a32933379258bae7e167csjd72710c30deae172b&json=={“attr”:{“fanc”:“1”}}

getting the hash is no problem