In [92]:
import requests,json

In [109]:
url = "http://localhost:8888/mip"
datos={"action":"affirmat"}
datos=json.dumps(datos)
print(datos)
data_channels = requests.post(url,datos)
print(data_channels)


{"action": "affirmat"}
<Response [200]>

In [111]:
url = " http://192.168.0.158/api/ISrD4jnQ66SwRNZAhPrLqrOY1G1nHAJ8tA4Iw-rT/lights/1/state"
datos= 	{"on":true, "bri":100}
datos=json.dumps(datos)
print(datos)
data_channels = requests.put(url,datos)
print(data_channels.json())


{"action": "affirmat"}
{'1': {'modelid': 'LWB010', 'name': 'Hue white lamp 1', 'uniqueid': '00:17:88:01:02:49:ab:6b-0b', 'state': {'reachable': True, 'alert': 'select', 'bri': 254, 'on': False}, 'type': 'Dimmable light', 'productid': 'Philips-LWB010-1-A19DLv3', 'manufacturername': 'Philips', 'swversion': '1.15.2_r19181', 'swconfigid': '60083D2F'}}

In [8]:



{'smart_office': {'pc': {'switch': False, 'hours': ''}, 'smartTv': {'switch': False, 'hours': ''}, 'thermostat': 0, 'light': {'switch': False, 'hours': 0}, 'speakers': {'switch': False, 'hours': '', 'volume': ''}}, 'environment': {'weather': '', 'light': '', 'temperature': ''}, 'reminders': {'car': ''}, 'calories': {'breakfast': '', 'lunch': '', 'dinner': '', 'meal': ''}, 'personal_activity': {'coffees': 0, 'working_hours': 0.05, 'leisure_hours': 0, 'sitting_hours': 0, 'car_hours': 0}}
monitor ON
SELECTING ACTIVITIES
monitor ON
SELECTING ACTIVITIES

In [35]:



  File "<ipython-input-35-35290f260191>", line 2
    "time_stop":{"date1":"Sat May 13 10:30:39 2017","date2":"Sun May 14 09:58:39 2017","date3":"Sat May 13 14:09:39 2017","date4":"Mon May 15 21:09:39 2017","date5":"Sat May 13 11:30:39 2017","date6":"Sun May 14 00:58:39 2017","date7":"Sat May 13 11:45:39 2017","date8":"Mon May 15 12:00:39 2017"}
    ^
IndentationError: unexpected indent

In [ ]: