diff --git a/atom.xml b/atom.xml index b58f5abd98..c090565292 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/community/atom.xml b/blog/categories/community/atom.xml index 9011a7a968..98714f7137 100644 --- a/blog/categories/community/atom.xml +++ b/blog/categories/community/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Community | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/device-tracking/atom.xml b/blog/categories/device-tracking/atom.xml index 9ab10ed88a..17556aef8a 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-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/esp8266/atom.xml b/blog/categories/esp8266/atom.xml index d48d7182b0..78bc9fc318 100644 --- a/blog/categories/esp8266/atom.xml +++ b/blog/categories/esp8266/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: ESP8266 | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/how-to/atom.xml b/blog/categories/how-to/atom.xml index 67b8040a4e..1973930a8b 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-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/ibeacons/atom.xml b/blog/categories/ibeacons/atom.xml index 74b24f3d67..77db38a75e 100644 --- a/blog/categories/ibeacons/atom.xml +++ b/blog/categories/ibeacons/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: iBeacons | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+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 5ab6c877bc..b58c391096 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-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/iot-data/atom.xml b/blog/categories/iot-data/atom.xml index f1d750ace8..290ad03eee 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-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/micropython/atom.xml b/blog/categories/micropython/atom.xml index 22a42950a7..2034099eb4 100644 --- a/blog/categories/micropython/atom.xml +++ b/blog/categories/micropython/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Micropython | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/mqtt/atom.xml b/blog/categories/mqtt/atom.xml index ba10d5df56..b34a9e3a12 100644 --- a/blog/categories/mqtt/atom.xml +++ b/blog/categories/mqtt/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: MQTT | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/organisation/atom.xml b/blog/categories/organisation/atom.xml index f8d333d73a..423dbcf1ce 100644 --- a/blog/categories/organisation/atom.xml +++ b/blog/categories/organisation/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Organisation | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/owntracks/atom.xml b/blog/categories/owntracks/atom.xml index 7d934d3abe..033e1675e0 100644 --- a/blog/categories/owntracks/atom.xml +++ b/blog/categories/owntracks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: OwnTracks | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/presence-detection/atom.xml b/blog/categories/presence-detection/atom.xml index 7cc7545a77..1ae31c0a62 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-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+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 27730ff5d9..fe6f7d5517 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-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/release-notes/atom.xml b/blog/categories/release-notes/atom.xml index ed09f7fb80..906a790e13 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-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/survey/atom.xml b/blog/categories/survey/atom.xml index 84717a0deb..1e36524f68 100644 --- a/blog/categories/survey/atom.xml +++ b/blog/categories/survey/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Survey | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/talks/atom.xml b/blog/categories/talks/atom.xml index 868fbb8a46..ce3e1952af 100644 --- a/blog/categories/talks/atom.xml +++ b/blog/categories/talks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Talks | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/technology/atom.xml b/blog/categories/technology/atom.xml index 71279d9cb9..b89c632a7d 100644 --- a/blog/categories/technology/atom.xml +++ b/blog/categories/technology/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Technology | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/user-stories/atom.xml b/blog/categories/user-stories/atom.xml index d0362ec39a..307231acf7 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-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/video/atom.xml b/blog/categories/video/atom.xml index eeaf5d5c65..96c8a643e3 100644 --- a/blog/categories/video/atom.xml +++ b/blog/categories/video/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Video | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/blog/categories/website/atom.xml b/blog/categories/website/atom.xml index f0d556decb..b5ca32b4d8 100644 --- a/blog/categories/website/atom.xml +++ b/blog/categories/website/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Website | Home Assistant]]> - 2016-10-31T02:01:34+00:00 + 2016-10-31T20:31:33+00:00 https://home-assistant.io/ diff --git a/ecosystem/index.html b/ecosystem/index.html index 2f7f81dcf3..08538dece6 100644 --- a/ecosystem/index.html +++ b/ecosystem/index.html @@ -109,6 +109,7 @@

Ecosystem

diff --git a/ecosystem/scenegen/index.html b/ecosystem/scenegen/index.html new file mode 100644 index 0000000000..b4cdea1643 --- /dev/null +++ b/ecosystem/scenegen/index.html @@ -0,0 +1,326 @@ + + + + + + + + + + SceneGen - Home Assistant + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+ +
+ + +
+ + + + + + +
+

+ SceneGen +

+
+
+ + +

Scenegen is a scene generation tool for Home Assistant home automation software. It creates scenes by example, by reading the current states of devices and outputting a corresponding scene. Scenegen is written in python using Home Assistant’s RESTFul API so can be run from anywhere. It currently supports lights and switches only.

+ +

Installation

+ +

Clone the Repository

+

Clone the scenegen repository to the current local directory on your machine.

+ +
$ git clone https://github.com/home-assistant/scenegen.git
+
+
+ +

Change your working directory to the repository root. Moving forward, we will be working from this directory.

+ +
$ cd scenegen
+
+
+ +

Install Prereqs

+ +

Before running SceneGen you will need to add some python prerequisites:

+ +
$ sudo pip3 install configparser
+
+
+ +

You should now be ready to run scenegen

+ +

Basic Operation

+ +
usage: scenegen [-h] [-k KEY] [-s SCENENAME] [-m MAPFILE] [-f FILTER]
+                [-c {xy_color,rgb_color,color_temp,color_name}] [-t TYPES]
+                url
+
+positional arguments:
+  url                   url for Home Assistant instance
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -k KEY, --key KEY     API Key of Home Assistant instance
+  -s SCENENAME, --scenename SCENENAME
+                        Name of scene to generate
+  -m MAPFILE, --mapfile MAPFILE
+                        Name of mapfile to enable device filtering
+  -f FILTER, --filter FILTER
+                        Comma separated list of device collections as defined
+                        in mapfile
+  -c {xy_color,rgb_color,color_temp,color_name}, --colortype {xy_color,rgb_color,color_temp,color_name}
+                        color type to use
+  -t TYPES, --types TYPES
+                        list of device types to include
+
+
+
+ +

For basic operation just supply the url and optionally the api key (using the –key option) on the command line and scenegen will output a list of all lights and switches with their attributes. Optionally use the --scenename flag to explicitly set the scenename.

+ +
$ ./scenegen.py https://<some url> -k <some api key>
+name: My New Scene
+entities:
+  light.bedroom:
+    state: on
+    brightness: 28
+  light.kitchen:
+    state: off
+  light.living_room:
+    state: off
+  light.bedside:
+    state: on
+    brightness: 125
+    color_temp: 412
+  light.office_level_29:
+    state: on
+    brightness: 28
+
+
+ +

This output can be cut and pasted into your configuration.yaml file as required (ensuring correct indentatation of course).

+ +

Scenegen supports all documented effects for lights including transitions and flash effects, however generally it is easier to run scenegen to get the basic setup and add any effects manually later.

+ +

Note that depending on the type of light there may be a delay in actually setting up its parameters and Home Assistant actually recieving that state. For instance, if you set a scene up with the Hue App, Home Assistant won’t see those changes for up to 10 seconds. Turning on a ZWave light might not be seen for an entire poll interval. For this reason, its good practice to wait for a while after the scene is setup before running scenegen. Alternatively, perform all setup using the Home Assistant frontend and it will instantly have the required state for capture.

+ +

Advanced Usage

+ +

For a more advanced way to use the output try the following. In configuration.yaml add the following line:

+ +
scene: !include_dir_list scenes
+
+
+ +

This will tell home assistant to look in the subdirectory scenes for yaml files containing scene information. Each file will be named for the scene it will create and should contain information formatted as above. Then simply run Scenegen and redirect its output to the scenes subdirectory:

+ +
$ ./scenegen.py https://<some url> -k <some api key> > scenes/my_new_scene.yaml
+
+
+ +

This will create a new scene called my_new_scene which will automatically be picked up by Home Assistant on the next restart.

+ +

Colors

+ +

Scenegen allows colors to be captured, and in fact Home Assistant light entities store up to 4 different ways of specifying the colors. This is redundant for creating scenes so Scenegen picks 1 and goes with it. The default is color_temp but you can change this with the --colortype flag, supported options are xy_color, rgb_color, color_temp and color_name.

+ +

Types

+ +

By default, Scenegen will list all lights and switches. To restrict the device type use the --types option and supply a comma separated list (no spaces) of types to output. e.g.:

+ +
./scenegen.py https://<some url> -k <some api key> --types light,switch
+
+
+ +

or:

+ +
./scenegen.py https://<some url> -k <some api key> --types light
+
+
+ +

This will make more sense as and when more types are added.

+ +

Maps and Filters

+ +

Maps allow you to specify and label various subsets of devices that you want to work on together. A mapfile is specified using the --mapfile option and is a .ini style file consisting of section headers and entries. The section headers specify a region or zone or otherwise organized selection of entities you want to filter on, and it is mandatory to have at least one. If you create a map file like this:

+ +
[entities]
+light.living_room:
+light.dining_room:
+
+
+ +

The trailing colons are necessary to prevent parsing errors for including just keys, as opposed to key=value so just go with it - it reminds us of YAML ;)

+ +

If you run scenegen with the --mapfile argument pointing to that file you will only get output for the listed entities (the name of the section is irrelevant if not using the --filter option). A more complex mapfile might look like this:

+ +
[Outside]
+light.porch:
+switch.path_lights:
+[Living Room]
+light.living_room_front:
+light.living_room_back:
+[Bedroom]
+light.bedside:
+
+
+ +

Again, if you run with that map file it will output all of the entities listed, however you now have the possibility of restricting output devices based on the sections they are in, using the --filter option and supplying a comma separated list of sections you want to include, for instance:

+ +
./scenegen.py https://<some url> -k <some api key> --mapfile map.cfg --filter "Outside,Living Room"
+
+
+ +

The intended use of the mapfile and filter is that you create a map of all your devices and organize them into zones that you are interested in creating scenes for and use the filter to limit output to that zone. For instance you might want to create 3 or 4 scenes for your living room, and once the map is set up you can easily do so without the addition of unwanted devices.

+ +

Updating SceneGen

+

To update SceneGen after a new version is released, just run the following command to update your copy:

+ +
$ git pull
+
+
+ +

Release Notes

+ +

Version 1.2

+ +
    +
  • Add installation instructions
  • +
+ +

Version 1.1

+ +
    +
  • Add better error checking for Home Assistant errors
  • +
+ +

Version 1.0

+ +

Initial Release

+ + +
+ + +
+ + + + +
+
+ + + + + + \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index 834d4a57e1..9636025352 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2289,6 +2289,9 @@ https://home-assistant.io/ecosystem/ios/ +https://home-assistant.io/ecosystem/scenegen/ + + https://home-assistant.io/topics/templating/ @@ -2308,62 +2311,62 @@ https://home-assistant.io/demo/frontend.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/index.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-event.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-info.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-service.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-state.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-template.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/panels/ha-panel-history.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/panels/ha-panel-iframe.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/panels/ha-panel-logbook.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/demo/panels/ha-panel-map.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/googlef4f3693c209fe788.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:39+00:00 https://home-assistant.io/static/fonts/roboto/DESCRIPTION.en_us.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:40+00:00 https://home-assistant.io/static/fonts/robotomono/DESCRIPTION.en_us.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:40+00:00 https://home-assistant.io/static/mdi-demo.html -2016-10-31T02:00:52+00:00 +2016-10-31T20:30:40+00:00