Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add elevation to dict #5448

Merged
merged 1 commit into from Jan 20, 2017
Merged

Add elevation to dict #5448

merged 1 commit into from Jan 20, 2017

Conversation

fabaff
Copy link
Member

@fabaff fabaff commented Jan 19, 2017

Description:
Add elevation to the output of the /api/config endpoint.

$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" -H "Content-Type: application/json" http://localhost:8123/api/config
{
    "components": [
        "recorder",
        "http",
        "weather.openweathermap",
        "api",
        "websocket_api",
        "frontend",
        "sensor.time_date",
        "sun",
        "device_tracker",
        "group",
        "automation"
    ],
    "config_dir": "/home/ha/.homeassistant",
    "elevation": 590,
    "latitude": 45.92,
    "location_name": "Home",
    "longitude": 6.52,
    "time_zone": "Europe/Zurich",
    "unit_system": {
        "length": "km",
        "mass": "g",
        "temperature": "\\u00b0C",
        "volume": "L"
    },
    "version": "0.37.0.dev0"
}

Related issue (if applicable): fixes #5441

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#1830

Example entry for configuration.yaml (if applicable):

homeassistant:
  latitude: 45.92
  longitude: 6.52
  elevation: 590
  unit_system: metric
  # Time zone is CET/CEST+1
  time_zone: Europe/Zurich
  name: Home

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@@ -432,7 +432,7 @@ def async_fire(self, event_type: str, event_data=None,
"""
if event_type != EVENT_HOMEASSISTANT_STOP and \
self._hass.state == CoreState.stopping:
raise ShuttingDown('Home Assistant is shutting down.')
raise ShuttingDown("Home Assistant is shutting down")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're sometimes switching quotes from single to double, and sometimes from double to single. What's going on ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Logger messages and some other natural language messages in a lot of cases we are using double quotes and no periods at the end. Constants are usually just wrapped with single quotes. As far as I remember doesn't PEP say something about this but when ever I came across a file I will update it to match the majority of your files to keep the style synced.

Here I was a bit too eager to align the usage of the quotes that I touched the exceptions.

@balloob
Copy link
Member

balloob commented Jan 20, 2017

The change to the dict itself is fine. I'm not sure about the quote changing as it's not migrating to a consistent quote.

@balloob balloob merged commit 2ed0e76 into home-assistant:dev Jan 20, 2017
@fabaff fabaff deleted the api-config-elevation branch January 20, 2017 07:59
@home-assistant home-assistant locked and limited conversation to collaborators Apr 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Endpoint /api/config does not return the configured elevation
3 participants