|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "Home Assistant Demo" |
| 4 | +description: "Showing a demo of Home Assistant to an audience." |
| 5 | +date: 2017-10-28 10:00:00 +0200 |
| 6 | +date_formatted: "October 28, 2017" |
| 7 | +author: Fabian Affolter |
| 8 | +author_twitter: fabaff |
| 9 | +comments: true |
| 10 | +categories: How-To |
| 11 | +og_image: /images/blog/2017-10-interactive-demo/demo-random.png |
| 12 | +--- |
| 13 | + |
| 14 | +If you are planning to host a Home Assistant meetup or doing a talk, then you probably want to show Home Assistant to an audience. You could use a Wireless router, bulbs, switches, and a single board computer to do a realistic demo. For a workshop, this is what I usually do because I think that working with physical hardware is more fun for the participants. The issue is that you need time to set up, power and space. For a talk or in a location, where you only have a beamer and a table or a lectern, the physical hardware approach is not very convenient. |
| 15 | + |
| 16 | +The simplest way to show Home Assistant to others is the online demo at [https://home-assistant.io/demo/](https://home-assistant.io/demo/) |
| 17 | + |
| 18 | +<p class='img'> |
| 19 | + <img src='/images/blog/2017-10-interactive-demo/online-demo.png' /> |
| 20 | + Home Assistant's online demo |
| 21 | +</p> |
| 22 | + |
| 23 | +<!--more--> |
| 24 | + |
| 25 | +## {% linkable_title `--demo-mode` and Demo platform %} |
| 26 | +To be safe for your talk, you don't want to depend on an internet connection. The demo mode [`--demo-mode`](/docs/tools/hass/) allows you to run a demo locally including the latest features. Make sure that you have a backup of your configuration. |
| 27 | + |
| 28 | +```bash |
| 29 | +$ hass --demo-mode |
| 30 | +``` |
| 31 | + |
| 32 | +If you already have a `configuration.yaml` file in place then you will get a combination of your setup with all available [`demo`](/components/demo/) platforms. This can be overwhelming for the audience. The suggestion is that you tailor the demo to your needs by only showing a few selected platforms. For example: |
| 33 | + |
| 34 | +```yaml |
| 35 | +sensor: |
| 36 | + - platform: demo |
| 37 | +binary_sensor: |
| 38 | + - platform: demo |
| 39 | +switch: |
| 40 | + - platform: demo |
| 41 | +``` |
| 42 | +
|
| 43 | +<p class='img'> |
| 44 | + <img src='/images/blog/2017-10-interactive-demo/demo-platforms.png' /> |
| 45 | + Home Assistant's demo platforms |
| 46 | +</p> |
| 47 | +
|
| 48 | +## {% linkable_title `random` platforms %} |
| 49 | +Till now the frontend is static. Nothing is changing over time. Starting with 0.57 we ship a [`random` binary sensor](https://github.com/home-assistant/home-assistant.github.io/blob/next/source/_components/binary_sensor.random.markdown) platform in addition to the already available [`random` sensor](/components/sensor.random/). |
| 50 | + |
| 51 | +By adding those platform to your `configuration.yaml` file, your demo will become more interactive. |
| 52 | + |
| 53 | +```yaml |
| 54 | +sensor: |
| 55 | + - platform: demo |
| 56 | + name: Temperature |
| 57 | + unit_of_measurement: "°C" |
| 58 | +binary_sensor: |
| 59 | + - platform: random |
| 60 | + name: Front Door |
| 61 | + - platform: random |
| 62 | + name: Back Door |
| 63 | + scan_interval: 5 |
| 64 | +``` |
| 65 | + |
| 66 | +<p class='img'> |
| 67 | + <img src='/images/blog/2017-10-interactive-demo/demo-random.png' /> |
| 68 | + Demo with `random` platforms |
| 69 | +</p> |
| 70 | + |
| 71 | +The `random` and the `demo` platforms can, of course, be used together. With a little work and some of the [`template`](/components/#search/template) platforms or the [`input_*`](/components/#search/input) components it would even be possible to simulate a complete apartment or a house. For a hint check the sample below: |
| 72 | + |
| 73 | +{% raw %} |
| 74 | +```yaml |
| 75 | +input_boolean: |
| 76 | + on_off: |
| 77 | + name: On or off |
| 78 | +binary_sensor: |
| 79 | + - platform: template |
| 80 | + sensors: |
| 81 | + on_tester: |
| 82 | + value_template: "{{ states.input_boolean.on_off.state == 'on' }}" |
| 83 | + friendly_name: 'Movement' |
| 84 | + device_class: motion |
| 85 | +``` |
| 86 | +{% endraw %} |
| 87 | + |
| 88 | +## {% linkable_title MQTT Discovery %} |
| 89 | +This is a section for advanced users as it will require to run a separate script. Instead of adding `demo` platforms to the configuration this setup make use of [MQTT discovery](/docs/mqtt/discovery/) and the [embedded MQTT broker](/docs/mqtt/broker/#embedded-broker). Simply add MQTT to your `configuration.yaml` file with `discovery:` |
| 90 | + |
| 91 | +```yaml |
| 92 | +mqtt: |
| 93 | + discovery: true |
| 94 | +``` |
| 95 | + |
| 96 | +Download the [sample script](https://github.com/home-assistant/home-assistant-dev-helper/blob/master/ha-mqtt-demo.py). It depends on [paho-mqtt](https://pypi.python.org/pypi/paho-mqtt). If you run the script inside your [Home Assistant's virtual environment](/docs/installation/virtualenv/) then you are good to go as the dependency should be present if you have used MQTT before. Otherwise, install it with `$ pip3 install paho-mqtt`. The same applies to the embedded broker. |
| 97 | + |
| 98 | +```bash |
| 99 | +(ha)[ha-demo]$ python3 ha-mqtt-demo.py |
| 100 | +Demo is running... -> CTRL + C to shutdown |
| 101 | +``` |
| 102 | + |
| 103 | +It will create sensors, a light, and a switch and update the states as long the script is running. It possible to stop and restart script without losing the entities. |
| 104 | + |
| 105 | +Some users share their slides and other documents in [our assets repository](https://github.com/home-assistant/home-assistant-assets). Also, take a look at that repository if you need a logo for your slides. |
| 106 | + |
0 commit comments