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