From b043f25a3b28d3d503b8782d7ebc051a8714c1fd Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sat, 13 Aug 2016 15:59:52 +0000 Subject: [PATCH] Site updated at 2016-08-13 15:59:52 UTC --- atom.xml | 2 +- blog/categories/community/atom.xml | 2 +- blog/categories/device-tracking/atom.xml | 2 +- blog/categories/esp8266/atom.xml | 2 +- blog/categories/how-to/atom.xml | 2 +- blog/categories/ibeacons/atom.xml | 2 +- blog/categories/internet-of-things/atom.xml | 2 +- blog/categories/iot-data/atom.xml | 2 +- blog/categories/mqtt/atom.xml | 2 +- blog/categories/organisation/atom.xml | 2 +- blog/categories/owntracks/atom.xml | 2 +- blog/categories/presence-detection/atom.xml | 2 +- .../public-service-announcement/atom.xml | 2 +- blog/categories/release-notes/atom.xml | 2 +- blog/categories/survey/atom.xml | 2 +- blog/categories/talks/atom.xml | 2 +- blog/categories/technology/atom.xml | 2 +- blog/categories/user-stories/atom.xml | 2 +- blog/categories/video/atom.xml | 2 +- blog/categories/website/atom.xml | 2 +- developers/development_validation/index.html | 268 ++++++++++++++++++ sitemap.xml | 33 ++- 22 files changed, 306 insertions(+), 35 deletions(-) create mode 100644 developers/development_validation/index.html diff --git a/atom.xml b/atom.xml index ea14a939bc..c538f5477c 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/community/atom.xml b/blog/categories/community/atom.xml index b9cc4886ad..84978cea39 100644 --- a/blog/categories/community/atom.xml +++ b/blog/categories/community/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Community | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/device-tracking/atom.xml b/blog/categories/device-tracking/atom.xml index 2f15996002..f694d81d14 100644 --- a/blog/categories/device-tracking/atom.xml +++ b/blog/categories/device-tracking/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Device-Tracking | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/esp8266/atom.xml b/blog/categories/esp8266/atom.xml index d8e1346192..9be5feadae 100644 --- a/blog/categories/esp8266/atom.xml +++ b/blog/categories/esp8266/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: ESP8266 | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/how-to/atom.xml b/blog/categories/how-to/atom.xml index 9321994a31..818648b370 100644 --- a/blog/categories/how-to/atom.xml +++ b/blog/categories/how-to/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: How-To | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/ibeacons/atom.xml b/blog/categories/ibeacons/atom.xml index 453658d1c1..abca337822 100644 --- a/blog/categories/ibeacons/atom.xml +++ b/blog/categories/ibeacons/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: iBeacons | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/internet-of-things/atom.xml b/blog/categories/internet-of-things/atom.xml index ae67022e6b..91f6983b13 100644 --- a/blog/categories/internet-of-things/atom.xml +++ b/blog/categories/internet-of-things/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Internet-of-Things | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/iot-data/atom.xml b/blog/categories/iot-data/atom.xml index 3b397b20e5..1b21345888 100644 --- a/blog/categories/iot-data/atom.xml +++ b/blog/categories/iot-data/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: IoT-Data | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/mqtt/atom.xml b/blog/categories/mqtt/atom.xml index 9a545f3767..63478cb5ea 100644 --- a/blog/categories/mqtt/atom.xml +++ b/blog/categories/mqtt/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: MQTT | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/organisation/atom.xml b/blog/categories/organisation/atom.xml index a83e19438a..253d06cad6 100644 --- a/blog/categories/organisation/atom.xml +++ b/blog/categories/organisation/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Organisation | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/owntracks/atom.xml b/blog/categories/owntracks/atom.xml index 8617645c9c..a95bc52ffb 100644 --- a/blog/categories/owntracks/atom.xml +++ b/blog/categories/owntracks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: OwnTracks | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/presence-detection/atom.xml b/blog/categories/presence-detection/atom.xml index b69e0adcd6..5a51ef2fcf 100644 --- a/blog/categories/presence-detection/atom.xml +++ b/blog/categories/presence-detection/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Presence-Detection | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/public-service-announcement/atom.xml b/blog/categories/public-service-announcement/atom.xml index 5019fce3a8..aebf2e2ba8 100644 --- a/blog/categories/public-service-announcement/atom.xml +++ b/blog/categories/public-service-announcement/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Public-Service-Announcement | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/release-notes/atom.xml b/blog/categories/release-notes/atom.xml index ab3b30c8aa..efc6518b83 100644 --- a/blog/categories/release-notes/atom.xml +++ b/blog/categories/release-notes/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Release-Notes | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/survey/atom.xml b/blog/categories/survey/atom.xml index 5efea53771..655b0c35b8 100644 --- a/blog/categories/survey/atom.xml +++ b/blog/categories/survey/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Survey | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/talks/atom.xml b/blog/categories/talks/atom.xml index 9915dda223..fcc1355271 100644 --- a/blog/categories/talks/atom.xml +++ b/blog/categories/talks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Talks | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/technology/atom.xml b/blog/categories/technology/atom.xml index b7fb1a3f6a..f04383e3bd 100644 --- a/blog/categories/technology/atom.xml +++ b/blog/categories/technology/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Technology | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/user-stories/atom.xml b/blog/categories/user-stories/atom.xml index fbcb8d94aa..5ed9454933 100644 --- a/blog/categories/user-stories/atom.xml +++ b/blog/categories/user-stories/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: User-Stories | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/video/atom.xml b/blog/categories/video/atom.xml index df6d8cc072..f45f5fb600 100644 --- a/blog/categories/video/atom.xml +++ b/blog/categories/video/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Video | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/blog/categories/website/atom.xml b/blog/categories/website/atom.xml index 78477b1b35..6a8207ce00 100644 --- a/blog/categories/website/atom.xml +++ b/blog/categories/website/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Website | Home Assistant]]> - 2016-08-13T15:05:54+00:00 + 2016-08-13T15:59:07+00:00 https://home-assistant.io/ diff --git a/developers/development_validation/index.html b/developers/development_validation/index.html new file mode 100644 index 0000000000..60040a11ec --- /dev/null +++ b/developers/development_validation/index.html @@ -0,0 +1,268 @@ + + + + + + + + + + Validate the input - Home Assistant + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + +
+
+ +
+ + +
+ + + + +
+

+ Validate the Input +

+
+
+ + +

The configuration.yaml file contains the configuration options for components and platforms. To ensure that the given configuration provided by the user is valid we use voluptuous to check it. Certain entries are optional or could be required for the setup of a platform or a component. Others must be of a certain type or out of an already defined list. This will ensure that the users are notified if something is wrong with a platform or component setup before Home Assistant is running.

+ +

Beside the voluptuous default types are a bunch of custom types available. To get a full overview take a look at the config_validation.py helper.

+ +
    +
  • Types: string, byte, and boolean
  • +
  • Entity ID: entity_id and entity_ids
  • +
  • Numbers: small_float and positive_int
  • +
  • Time: time, time_zone
  • +
  • Misc: template, slug, temperature_unit, latitude, longitude, isfile, sun_event, ensure_list, and icon
  • +
+ +

To validate plaforms using MQTT there are valid_subscribe_topic and valid_publish_topic present.

+ +

Snippets

+ +

This section contains a couple of snippets for the validation we use.

+ +

Default name

+ +
+
DEFAULT_NAME = 'Sensor name'
+
+PLATFORM_SCHEMA = vol.Schema({
+    ...
+    vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
+
+
+
+ +

Port

+ +

As all port numbers are coming out of the range 1 till 65535 a range check should be performed.

+ +
+
DEFAULT_PORT = 993
+
+PLATFORM_SCHEMA = vol.Schema({
+    [...]
+    vol.Optional(CONF_PORT, default=DEFAULT_PORT):
+        vol.All(vol.Coerce(int), vol.Range(min=1, max=65535)),
+
+
+
+ +

Sensor types

+ +

If a sensor has a pre-defined list of available options it should be tested if the configuration entry matches it.

+ +
+
SENSOR_TYPES = {
+    'article_cache': ('Article Cache', 'MB'),
+    'average_download_rate': ('Average Speed', 'MB/s'),
+}
+
+PLATFORM_SCHEMA = vol.Schema({
+    ....
+    vol.Optional(CONF_MONITORED_VARIABLES, default=[]):
+        [vol.In(SENSOR_TYPES)],
+
+
+
+ + + +
+ + +
+ + + + +
+
+ + + + + + \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index e341980bbb..34ad5fa05e 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -419,6 +419,9 @@ https://home-assistant.io/developers/development_testing/ + + https://home-assistant.io/developers/development_validation/ + https://home-assistant.io/getting-started/devices/ @@ -2041,62 +2044,62 @@ https://home-assistant.io/demo/frontend.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/index.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-event.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-info.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-service.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-state.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-template.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/panels/ha-panel-history.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/panels/ha-panel-iframe.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/panels/ha-panel-logbook.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/demo/panels/ha-panel-map.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/googlef4f3693c209fe788.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/static/fonts/roboto/DESCRIPTION.en_us.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/static/fonts/robotomono/DESCRIPTION.en_us.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00 https://home-assistant.io/static/mdi-demo.html - 2016-08-13T15:05:09+00:00 + 2016-08-13T15:58:28+00:00