Skip to content

Commit 982bdbf

Browse files
committed
Changed typos and added missing words
1 parent a2e3bfc commit 982bdbf

6 files changed

Lines changed: 92 additions & 20 deletions

File tree

docs/cookbook.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/faq.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FAQs
2+
*****
3+
4+
We want to add some Frequently Asked Questions but frankly questions haven't been asked frequently enough.
5+
Until then this page will be left empty. :(
6+
7+
If you have questions open a discussion or issue on the :resource:`repository <issues>`! :)

docs/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
Welcome to Homeassistant API!
1111
=============================
1212

13-
Homeassistant API is pythonic way to interact with `Homeassistant's REST API integration <https://developers.home-assistant.io/docs/api/rest>`_
13+
Homeassistant API is a pythonic module that interacts with `Homeassistant's REST API integration <https://developers.home-assistant.io/docs/api/rest>`_
1414

1515
Features
1616
----------
1717

1818
- Full consumption of the Homeassistant REST API endpoints
1919
- Convenient classes that represent data from the API
20-
- Asyncronous support for integration in async applications or libraries [COMING SOON]
20+
- Asynchronous support for integration in async applications or libraries [COMING SOON]
2121
- Modular design for intuitive readability
2222

2323
Getting Started
@@ -31,7 +31,7 @@ Is this your first time using the library? This is the place to get started!
3131
Home <index>
3232
quickstart
3333
usage
34-
cookbook
34+
faq
3535
api
3636

3737

@@ -41,7 +41,7 @@ Example
4141
.. literalinclude:: ../examples/basic.py
4242
:language: python
4343

44-
Many more examples are available in the :resource:`repository <examples>`.
44+
Many more examples are available in the :resource:`repository <examples>`. Feel feel to open a pull request and add your own! See Contributing Guidelines
4545

4646

4747
Code Reference
@@ -52,7 +52,7 @@ View the documentation for each class and function :doc:`here <api>`.
5252
Contributing
5353
-------------
5454

55-
We warmly welcome contributions.
55+
We very warmly welcome contributions.
5656
If you have an idea or some code you want to add to the project please fork :resource:`the repository <repo>`, make your changes, and open a pull request.
5757
Most likely your changes will get merged if your code passes flake8 without any errors, and adds some functionality to the project.
5858
We'd love to incorporate your unique ideas and perspective!

docs/quickstart.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,32 @@ Prerequisites
66

77
Homeassistant
88
-----------
9-
Before using this library, you need to have Homeassistant OS running on a device. Something like a Rasberry Pi or spare laptop.
10-
If you don't want to do that you can Homeassistant container on your laptop or desktop with docker.
9+
Before using this library, you need to have Homeassistant OS running on a device.
10+
Something like a Rasberry Pi or spare laptop.
11+
If you don't want to do that you can setup a Homeassistant container on your laptop or desktop with docker.
1112
See `here <https://www.home-assistant.io/installation/>`_ for how to install the installation right for you.
1213

1314

1415

1516
Configuring the API in Homeassistant
1617
======================================
1718

18-
Enable the :code:`api` integration on Homeassistant
19+
Enable the :code:`api` integration in Homeassistant
1920
------------------------------------------------------
2021
This library requires that you enable the :code:`api` integration on your Homeassistant if you are familiar with setting up integrations.
21-
The :code:`api` integration is also enabled when you enabled the :code:`default_config` integration.
22+
The :code:`api` integration is also enabled when you enable the :code:`default_config` integration.
2223

2324

2425
Access Token
2526
--------------
26-
Then once you have done that you need to head over to your profile and set up a "Long Lived Access Token" for you feed to the script.
27+
Then once you have done that you need to head over to your profile and set up a "Long Lived Access Token" to input to your script later.
2728
A good guide on how to do that is `here <https://www.home-assistant.io/docs/authentication/#your-account-profile>`_
2829

2930
Exposing Homeassistant to the Web
3031
--------------------------------------
31-
You may want to setup remote access through a Dynamic DNS server like DuckDNS (a good youtube tutorial on how to do that `here <https://www.youtube.com/watch?v=AK5E2T5tWyM>`_, keep in mind you will need to portforward to set that up.
32+
You may want to setup remote access through a Dynamic DNS server like DuckDNS (a good youtube tutorial on how to do that `here <https://www.youtube.com/watch?v=AK5E2T5tWyM>`_, keep in mind you will need to port forward to set that up.)
3233
If you do pursue this your api url will be something like :code:`https://yourhomeassistant.duckdns.org:8123/api`.
33-
Which is different than what it might have looked like before.
34+
Which is different than what it could have looked like before.
3435
Which might have been something like :code:`http://homeassistant.local:8123/api` or :code:`http://localhost:8123/api`
3536

3637
Installation
@@ -77,5 +78,5 @@ Example Usages
7778
==============
7879
Some examples applications of this project include integrating it into a console executable, flask application or just a regular python script.
7980
You can start a project that allows you to use this from the command line.
80-
Or add it a discord bot to manage your homeassistant from inside discord (you might want to use AsyncClient if you do)
81+
Or add it to a discord bot to manage your homeassistant from inside discord (you might want to use AsyncClient if you do)
8182
In any event, the possibilities are endless, so go make some cool stuff and share it with us!

docs/usage.rst

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,70 @@
11
Usage
22
*********
33

4-
If you see this we're adding a detailed guide of exactly how to use this library tomorrow.
5-
So just sit tight and be patient. Thanks!
4+
This library is centered around the :code:`Client` class.
5+
Once you have have your api base url and Long Lived Access Token from homeassistant we can start to do stuff.
6+
The rest of this guide assumes you have the :code:`Client` saved to a :code:`client` variable like this.
7+
Most of these examples require some integrations to be setup inside homeassistant for them to actually work.
8+
9+
10+
.. code-block:: python
11+
:linenos:
12+
13+
import os
14+
from homeassistant_api import Client
15+
16+
URL = '<API BASE URL>'
17+
TOKEN = '<LONG LIVED ACCESS TOKEN>'
18+
19+
client = Client(URL, TOKEN)
20+
21+
22+
How To Use...
23+
==============
24+
25+
Services
26+
-----------
27+
28+
.. code-block:: python
29+
30+
domains = client.get_domains()
31+
# {'homeassistant': <Domain homeassistant>, 'notify': <Domain notify>}
32+
33+
service = domains.cover.services.close_cover # Works the same as domains['cover'].services['open_cover']
34+
# <Service open_cover domain="cover">
35+
36+
changed_states = client.trigger_service('cover', 'close_cover', entity_id='cover.garage_door')
37+
# Alternatively (using fetched service from above)
38+
changed_states = service.trigger(entity_id='cover.garage_door')
39+
# [<EntityState "closing" entity_id="cover.garage_door">]
40+
41+
42+
Entities
43+
---------
44+
45+
.. code-block:: python
46+
47+
entity_groups = client.get_entities()
48+
# {'person': <EntityGroup person>, 'zone': <EntityGroup zone>, ...}
49+
50+
door = client.get_entity(entity_id='cover.garage_door')
51+
# <Entity entity_id="cover.garage_door" state="<EntityState "closed">">
52+
53+
states = client.get_states()
54+
# [<EntityState "above_horizon" entity_id="sun.sun">, <EntityState "zoning" entity_id="zone.home">,...]
55+
56+
state = client.get_state('sun.sun')
57+
# <EntityState "above_horizon" entity_id="sun.sun">
58+
59+
new_state = client.set_state(state='my ToaTallY Whatever vAlUe 12t87932', group_id='my_favorite_colors', entity_slug='number_one')
60+
# <EntityState "my ToaTallY Whatever vAlUe 12t87932" entity_id="my_favorite_colors.number_one">
61+
62+
# Alternatively you can set state from the entity class itself
63+
from homeassistant_api import State
64+
65+
# If you are wondering where door came from its about 15 lines up.
66+
door.state.state = 'My new state'
67+
door.state.attributes['open_height'] = '23'
68+
door.set_state(door.state)
69+
# <EntityState "My new state" entity_id="cover.garage_door">
70+

example.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@
3737

3838
# new_state = client.set_state(state='my ToaTallY Whatever vAlUe 12t87932', group_id='my_favorite_colors', entity_slug='number_one')
3939
# <EntityState "my ToaTallY Whatever vAlUe 12t87932" entity_id="my_favorite_colors.number_one">
40+
# Alternatively you can set state from the entity class itself
4041

41-
print(client.get_discovery_info())
42+
# from homeassistant_api import State
43+
# door.state.state = 'My new state'
44+
# door.set_state(door.state)

0 commit comments

Comments
 (0)