Hi,
Is somebody trying to control the "perfume genie" from Rituals?
I have already found something on github https://github.com/appspark-nl/rituals-api-php but i'm not a real programer and a php noob.
Kind regards Koen
Rituals the perfume genie
Moderator: leecollings
-
Lebo2d9
- Posts: 139
- Joined: Tuesday 06 September 2016 20:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version: L stab
- Location: Belgium
- Contact:
Rituals the perfume genie
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
Domoticz on RPI3(wifi) as slave for terraruim control
More to come
-
Lebo2d9
- Posts: 139
- Joined: Tuesday 06 September 2016 20:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version: L stab
- Location: Belgium
- Contact:
Re: Rituals the perfume genie
Hi,
I found also python wrapper using the rituals-api on https://pypi.org/project/rituals-api/
But I don't know how to implement this
I found also python wrapper using the rituals-api on https://pypi.org/project/rituals-api/
Code: Select all
import requests
import json
from urllib.parse import urlencode
name = "rituals-api"
class RitualsAPI:
BASE_URL = 'https://rituals.sense-company.com'
def __init__(self, email, password):
self.email = email
self.password = password
self.userData = None
self.hubs = {}
self._login()
def _login(self):
url = '{}/ocapi/login'.format(self.BASE_URL)
data = {'email': self.email, 'password': self.password}
headers = {'Content-Type': 'application/json'}
r = requests.post(url, json=data, headers=headers)
if r.status_code == 200:
self.userData = r.json()
self._getHubs()
else:
print('Something went wrong with logging in: {}'.format(r.text()))
def _getHubs(self):
url = '{}/api/account/hubs/{}'.format(self.BASE_URL, self.userData['account_hash'])
r = requests.get(url)
if r.status_code == 200:
for hub in r.json():
hubName = str(hub['hub']['attributes']['roomnamec']).replace(' ','_').lower()
self.hubs[hubName] = hub['hub']
else:
print('Something went wrong with retrieving hub info: {}'.format(r.text()))
def availableHubs(self):
return self.hubs.keys()
def turnOn(self, hubId):
return self._setAttributes(self.hubs[hubId], {'fanc': "1"})
def turnOff(self, hubId):
return self._setAttributes(self.hubs[hubId], {'fanc': "0"})
def setStatus(self, hubId, status):
hub = self.hubs[hubId]
status = self._setAttributes(hub, {'fanc': status})
return status
def _setAttributes(self, hub, attrs):
url = '{}/api/hub/update/attr'.format(self.BASE_URL)
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
json_data = {'attr': {}}
for key in attrs.keys():
json_data['attr'][key] = attrs[key]
data = urlencode({'hub':hub['hash'], 'json': json_data})
r = requests.post(url, data=data, headers=headers)
if r.status_code == 200:
print('Attributes updated.')
return True
else:
print('Something went wrong with setting attributes {}'.format(r.text()))
return False
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
Domoticz on RPI3(wifi) as slave for terraruim control
More to come
-
Lebo2d9
- Posts: 139
- Joined: Tuesday 06 September 2016 20:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version: L stab
- Location: Belgium
- Contact:
Re: Rituals the perfume genie
for the moment I'm able to collect the data.
See posthttps://www.domoticz.com/forum/viewtopi ... 65&t=26566
See posthttps://www.domoticz.com/forum/viewtopi ... 65&t=26566
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
Domoticz on RPI3(wifi) as slave for terraruim control
More to come