All Projects → harperreed → pyawair

harperreed / pyawair

Licence: MIT License
a very simple python class to access the (private) awair api

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pyawair

Homeassistant Config
Stars: ✭ 211 (+779.17%)
Mutual labels:  home-automation, internet-of-things
home-assistant-config
My configuration for Home Assistant
Stars: ✭ 63 (+162.5%)
Mutual labels:  home-automation, internet-of-things
Netdisco
🔎 Python library to scan local network for services and devices.
Stars: ✭ 240 (+900%)
Mutual labels:  home-automation, internet-of-things
Broadlink Mqtt
MQTT client to control BroadLink devices
Stars: ✭ 169 (+604.17%)
Mutual labels:  home-automation, internet-of-things
netdisco
🔎 Python library to scan local network for services and devices.
Stars: ✭ 252 (+950%)
Mutual labels:  home-automation, internet-of-things
Home Assistant
Home-Assistant-Config
Stars: ✭ 182 (+658.33%)
Mutual labels:  home-automation, internet-of-things
tion python
Python module for Tion
Stars: ✭ 51 (+112.5%)
Mutual labels:  home-automation, internet-of-things
Openhab Ios
The repository of the iOS client
Stars: ✭ 141 (+487.5%)
Mutual labels:  home-automation, internet-of-things
hifiberry
This is a custom component to allow control of HifiberryOS devices in Home Assistant using the audiocontrol2 REST API.
Stars: ✭ 26 (+8.33%)
Mutual labels:  home-automation, internet-of-things
sky-remote
NodeJS module to send remote control commands to a Sky TV box
Stars: ✭ 53 (+120.83%)
Mutual labels:  home-automation, internet-of-things
Homeassistant
Example Home Assistant Configs
Stars: ✭ 168 (+600%)
Mutual labels:  home-automation, internet-of-things
server
MyController 2.x server
Stars: ✭ 14 (-41.67%)
Mutual labels:  home-automation, internet-of-things
Home assistant files
Here are my Home Assistant configuration files
Stars: ✭ 159 (+562.5%)
Mutual labels:  home-automation, internet-of-things
Blynk Server
Blynk is an Internet of Things Platform aimed to simplify building mobile and web applications for the Internet of Things. Easily connect 400+ hardware models like Arduino, ESP8266, ESP32, Raspberry Pi and similar MCUs and drag-n-drop IOT mobile apps for iOS and Android in 5 minutes
Stars: ✭ 8 (-66.67%)
Mutual labels:  home-automation, internet-of-things
Entity Controller
Entity and lighting controller for managing devices via timers, scripts, and sun-based time restrictions.
Stars: ✭ 156 (+550%)
Mutual labels:  home-automation, internet-of-things
iot-workshop
A complete IoT Workshop
Stars: ✭ 42 (+75%)
Mutual labels:  internet-of-things, iot-device
Ha Floorplan
Floorplan for Home Assistant
Stars: ✭ 1,626 (+6675%)
Mutual labels:  home-automation, internet-of-things
Ha Tts Bluetooth Speaker
TTS Bluetooth Speaker for Home Assistant
Stars: ✭ 140 (+483.33%)
Mutual labels:  home-automation, internet-of-things
Home-Assistant
Home-Assistant-Config
Stars: ✭ 186 (+675%)
Mutual labels:  home-automation, internet-of-things
libzwaveip
libzwaveip - Control Z-Wave devices from your IP network
Stars: ✭ 76 (+216.67%)
Mutual labels:  home-automation, internet-of-things

pyawair

A very simple python class to access the (private) awair api

Why

I have a few Awair devices around my house and they are great. I like how they look, and the service that they provide. The only issue I have with teh device and service is that Awair doesn't offer a public API at the consumer level. I cannot incorporate the data that Awair is collecting into my dashboards and home automation.

I spent a bit of time looking into how to get access to their enterprise API. APparently you have to pay for it and have five or more devices. Both of those seemed untenable currently. The enterprise product looks really neat so I hope that one day I have an office that can use it!

This API is what powers their iOS app and is robust and well designed.

Example

The API is super straightforward.

Import the class

from awair import awair

You can isntantiate the class by logging in using your username and password

username = "[email protected]" 
password = "very long and secure password" 

api =  awair(username, password) 

If you already have an access token, you can use that instead of username and password. This will skip the login process

access_token = "XXXXX"
api =  awair(username, password, access_token)

Once you are logged in, you can grab all the devices

devices = api.devices()

for device in devices:  #Let's iterate through devices
  print(device) #Print the device 

  print("Let's grab the weather")
  weather = api.weather(latitude=device['latitude'],longitude=device['longitude'])
  print(weather)

  print("Timeline from yesterday to today")
  timeline = api.timeline(device['id'], yesterday_isoformat_string, today_isoformat_string)
  
  print("Event score") #I have no idea what the event score is - but it is full of data!
  print api.events_score(device['id'])

You can also access your in app "inbox" and get sleep reports

device_id = "00000" #your device id from the device in the device list
inbox = api.inbox() #Grab inbox
for message in inbox: #iterate through messages in inbox
  print message #Print the message
  
  if message['title']=='Sleep Report':
    print("Printing sleep report for " + message['timestamp'])
    print(api.sleep_report(device_id, message['timestamp']))

Warning

Obviously this is not a supported API. You should not use this. You should work with Awair and use their enterprise offering.

If that offering doesn't work for you (much like it doesn't yet work for me) - then YMMV with this. I expect that they will change their api frequently (notice the versions in the URL).

Yay!

I hope this is helpful. It would be pretty easy to use this to create a v nice custom component for home assistant. They API has enough resolution that you could really react to changes when they happen.

If you have questions or comments - hit me up on twitter or email.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].