Collecting data from the Rituals "perfume genie"

Python and python framework

Moderator: leecollings

Post Reply
Lebo2d9
Posts: 139
Joined: Tuesday 06 September 2016 20:39
Target OS: Raspberry Pi / ODroid
Domoticz version: L stab
Location: Belgium
Contact:

Collecting data from the Rituals "perfume genie"

Post by Lebo2d9 »

Hi in my post https://www.domoticz.com/forum/viewtopi ... 56&t=26527 I posted some code that I had found
I reworked the python code and now I'm able to readout the status

. This is the code I have so for

Code: Select all

#! /usr/bin/python
import requests
import json
#from urllib.parse import urlencode

name = "rituals-api"
BASE_URL = 'https://rituals.sense-company.com'

# __init__
email = "email"
password = "password"
userData = None
hubs = {}

# login
url = '{}/ocapi/login'.format(BASE_URL)
data = {'email': email, 'password': password}
headers = {'Content-Type': 'application/json'}
r = requests.post(url, json=data, headers=headers)        
if r.status_code == 200:
  userData = r.json()
  print '######Login data###### :' + '\n', userData
else:
  print('Something went wrong with logging in: {}'.format(r.text()))

#hub info
url = '{}/api/account/hubs/{}'.format(BASE_URL, userData['account_hash'])
print "######hub info URL###### :" + '\n' , url
r = requests.get(url)
print "######hub info###### :" +'\n' , r.json()
if r.status_code == 200:
  for hub in r.json():
    hubName = str(hub['hub']['attributes']['roomnamec']).replace(' ','_').lower()
    hubs[hubName] = hub['hub']
else:
  print('Something went wrong with retrieving hub info: {}'.format(r.text()))
This is the output of the script
Spoiler: show
######Login data###### :
{u'first_name': u'first', u'last_name': u'Last', u'account_id': account_id, u'birthday': u'date', u'logged_id': 1, u'message': u'Successfully logged in', u'account_hash': u'removed', u'email': u'[email protected]'}
######hub info URL###### :
https://rituals.sense-company.com/api/a ... count_hash
######hub info###### :
[{u'hub': {u'hublot': u'LOT118-10-D243F-10316', u'status': 1, u'hash': u'3829a268494d6f287d05624b177cee2c4b4742bbd0b684de72fadfcc2dcaa57d', u'current_time': u'2019-01-17T07:20', u'ping_update': u'25', u'attributes': {u'roomnamec': u'Geurrie', u'fanc': u'0', u'resetc': u'', u'roomc': u'1', u'speedc': u'1'}, u'title': None, u'sensors': {u'ipc': u'1547321280', u'battc': {u'created_at': u'2017-03-10 16:14:37', u'sensor_id': 2, u'description': u'', u'title': u'Full', u'default': 0, u'max_value': u'700', u'image': u'', u'min_value': u'641', u'updated_at': u'2018-10-11 07:10:43', u'interval': u'1', u'discover_image': u'', u'id': 8, u'icon': u'battery-full.png'}, u'rpsc': {u'created_at': u'2018-01-23 12:05:45', u'sensor_id': 12, u'description': u'', u'title': u'Fan on', u'default': 0, u'max_value': u'10000', u'image': u'', u'min_value': u'11', u'updated_at': u'2018-01-23 12:05:45', u'interval': u'', u'discover_image': u'', u'id': 48, u'icon': u''}, u'errorc': u'', u'fillc': {u'created_at': u'2017-10-16 07:50:23', u'sensor_id': 3, u'description': u'', u'title': u'90-100%', u'default': 0, u'max_value': u'1000', u'image': u'', u'min_value': u'0', u'updated_at': u'2017-10-16 07:57:37', u'interval': u'', u'discover_image': u'', u'id': 38, u'icon': u'icon-fill.png'}, u'resetc': u'Software/System restart', u'rfidc': {u'created_at': u'2017-03-13 15:55:52', u'sensor_id': 4, u'description': u'For centuries, the Japanese have celebrated the annual flowering of the Cherry Blossom, or Sakura. This marks an awakening of nature and symbolises that beauty is momentary and life must be enjoyed. Inspired by this tradition, The Ritual of Sakura collection blends the sweetness of Cherry Blossom with nourishing Organic Rice Milk, to make each day feel like a new beginning.', u'title': u'Ritual of Sakura', u'default': 0, u'max_value': u'053616b0', u'image': u'background-sakura.png', u'min_value': u'053616b0', u'updated_at': u'2017-09-25 08:02:36', u'interval': u'1', u'discover_image': u'discover-sakura.jpg', u'id': 15, u'icon': u'icon-sakura.png'}, u'chipidc': u'3388355', u'versionc': u'1.2.8', u'onlinec': {u'created_at': u'2017-09-07 08:23:42', u'sensor_id': 16, u'description': u'', u'title': u'Offline', u'default': 1, u'max_value': u'0', u'image': u'', u'min_value': u'0', u'updated_at': u'2017-09-07 08:23:42', u'interval': u'', u'discover_image': u'', u'id': 32, u'icon': u''}, u'wific': {u'created_at': u'2017-03-10 16:17:30', u'sensor_id': 1, u'description': u'', u'title': u'High', u'default': 0, u'max_value': u'-0.00', u'image': u'', u'min_value': u'-54.99', u'updated_at': u'2017-06-21 13:30:27', u'interval': u'1', u'discover_image': u'', u'id': 10, u'icon': u'icon-signal.png'}}, u'settings': []}}]
Now i need to create the dummy devices an update the info.
And i need to find out how i can control the genie also;
If there are programers who can or will help me, feel free ;)

Kind regard Koen deschepper
Domoicz on RPI3 (wifi) directly connected 3x ds18b20 for CV temp, Evohome (9 zone), 1 remote 220V switch based on ESP-12. RFXtrx433E, 16x AMST-606, 5 Somfy RTS motors
Domoticz on RPI3(wifi) as slave for terraruim control
More to come
fabstar81
Posts: 5
Joined: Saturday 27 April 2019 21:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Collecting data from the Rituals "perfume genie"

Post by fabstar81 »

did you come any further?

i hoped the genie would be a little smarter and use IFTTT or something at least. there are some alternatives available on the internet and ali...
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Collecting data from the Rituals "perfume genie"

Post by Brutus »

Someone integrated this into Domoticz?

Would like to accomplish this.

Greetings
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Collecting data from the Rituals "perfume genie"

Post by Xavier82 »

Any one got an update about this?
I would really like to get this working.

In the default Rituals Genie app I miss the possibility to create more on-off schedules (max is 14 days).
I would like to have a schedule which sets the Genie to "on" multiple times a day (example: 1 hour on and 1 hour of, 1 hour on, 1 hour off, etc). I can setup this in Domoticz.

I hope somebody can help?
smitec
Posts: 6
Joined: Tuesday 01 September 2020 14:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.2
Location: NL
Contact:

Re: Collecting data from the Rituals "perfume genie"

Post by smitec »

This one is a great starting point to make a plugin or create a script

https://github.com/milanmeu/pyrituals

see the example at the bottom of the page, which is working fine.
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Collecting data from the Rituals "perfume genie"

Post by Xavier82 »

Thanks for the starting point.
I had found this also, but I miss program skills to translate this to a Domoticz python application.

I hope somebody can help with this.
smitec
Posts: 6
Joined: Tuesday 01 September 2020 14:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.2
Location: NL
Contact:

Re: Collecting data from the Rituals "perfume genie"

Post by smitec »

Far from perfect, but here's my attempt :-)

https://github.com/smitec11/Domoticz-Genie-Plugin
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 1 guest