Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
f93282d6
Commit
f93282d6
authored
9 years ago
by
Fabian Affolter
Browse files
Options
Downloads
Patches
Plain Diff
Add link to docs
parent
78ad2686
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homeassistant/components/http.py
+4
-69
4 additions, 69 deletions
homeassistant/components/http.py
with
4 additions
and
69 deletions
homeassistant/components/http.py
+
4
−
69
View file @
f93282d6
"""
homeassistant.components.httpinterface
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
homeassistant.components.http
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module provides an API and a HTTP interface for debug purposes.
By default it will run on port 8123.
All API calls have to be accompanied by an
'
api_password
'
parameter and will
return JSON. If successful calls will return status code 200 or 201.
Other status codes that can occur are:
- 400 (Bad Request)
- 401 (Unauthorized)
- 404 (Not Found)
- 405 (Method not allowed)
The api supports the following actions:
/api - GET
Returns message if API is up and running.
Example result:
{
"
message
"
:
"
API running.
"
}
/api/states - GET
Returns a list of entities for which a state is available
Example result:
[
{ .. state object .. },
{ .. state object .. }
]
/api/states/<entity_id> - GET
Returns the current state from an entity
Example result:
{
"
attributes
"
: {
"
next_rising
"
:
"
07:04:15 29-10-2013
"
,
"
next_setting
"
:
"
18:00:31 29-10-2013
"
},
"
entity_id
"
:
"
weather.sun
"
,
"
last_changed
"
:
"
23:24:33 28-10-2013
"
,
"
state
"
:
"
below_horizon
"
}
/api/states/<entity_id> - POST
Updates the current state of an entity. Returns status code 201 if successful
with location header of updated resource and as body the new state.
parameter: new_state - string
optional parameter: attributes - JSON encoded object
Example result:
{
"
attributes
"
: {
"
next_rising
"
:
"
07:04:15 29-10-2013
"
,
"
next_setting
"
:
"
18:00:31 29-10-2013
"
},
"
entity_id
"
:
"
weather.sun
"
,
"
last_changed
"
:
"
23:24:33 28-10-2013
"
,
"
state
"
:
"
below_horizon
"
}
/api/events/<event_type> - POST
Fires an event with event_type
optional parameter: event_data - JSON encoded object
Example result:
{
"
message
"
:
"
Event download_file fired.
"
}
For more details about the RESTful API, please refer to the documentation at
https://home-assistant.io/developers/api.html
"""
import
json
import
threading
import
logging
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment