TL; DR: Don’t hack the framework, separate responsibilities, ship less, use service workers, use (future) web standards.
This year at Google I/O I saw Monica from the Polymer team talk about web components and performance. In her talk she mentions a mantra that they use in the Polymer team to make things fast: Do less and be lazy.
Do less and be lazy. It sounds so obvious and it took a while before it started to dawn on me. I think most of the code I write is pretty fast, but I don’t often stop to take a harder look at how and when it runs in practice. When do we need the result, can it be postponed?
And thus started my journey to take a critical look at how the Home Assistant app was working and how to make things faster. Below is the list of the different things that I did to make it fast.
I hope this list can be useful to other people, as a guide for optimizing their own apps or for avoiding pitfalls when building a new one.
The first thing to do is to measure. The Home Assistant front end is a mobile web app, so we shouldn’t measure this on a machine with 8 cores and gigabytes of ram but instead measure on devices you expect a mobile web app to run: phones. Below are two timelines recorded with Home Assistant 0.18.2 (pre-optimizations) and Google Chrome 53. On my Mac the app starts in 1400 milliseconds and on my Nexus 5x in ~6500 milliseconds (~4.5 times slower!).
Although the app takes 6500 milliseconds to load on my phone, it would perform well afterwards. Still, that initial load is unacceptable. You expect to open an app on your phone and be able to use it, quickly. After I applied all the changes described below, I managed to reduce startup time to 900 milliseconds (-35%) on my Mac and 2400 milliseconds (-63%) on my Nexus 5x. Check out the demo here.
Read on →
This is a guest post by Home Assistant user and contributor Nolan Gilley.
Today I’ll show you how I used Home Assistant, a NodeMCU (ESP8266), and a couple of accelerometers to automate our laundry room. This is a rewrite of an old post where I did the same thing using a Moteino & Raspberry Pi. This version only requires a NodeMCU.
We have an older washer and dryer which doesn’t have any form of notification when cycles complete. Home Assistant was the obvious solution, I just needed to create sensors for the washer and dryer. I tried using sound sensors but found them unreliable. I ended up using an accelerometer attached to the back of each appliance. I also added magnetic reed switches on the doors of the washer and dryer to detect whether they’re open or closed. I connected the accelerometers and reed switches to an NodeMCU which will relay the data to my MQTT broker.
Block diagram of schematicRead on →
When Home Assistant started the focus has always been on making a great developer experience. Allowing anyone to add support for their favorite devices to Home Assistant easily. This focus has been a great success since we now have 339 components and platforms!
Starting with this release, we are extending our extensibility to the frontend. Starting this release, any component can add its own page to the frontend. Examples of this today are the map, logbook and history. We are looking forward to all the crazy panels you’ll come up with!
We have also seen an exciting trend of people starting to visualize their Internet of Things data using Jupyter Notebooks, which are a great way to create and share documents that contain code, visualizations, and explanatory text. In case you missed it, the blog post by @kireyeu shows an advanced usecase while our Notebooks in the Home Assistant Notebooks repository cover the basics.
This release also includes a bunch of new integrations, among others three new media player platforms. This means that today Home Assistant can talk to 26 different media players!
The brand-new iFrame panel component allows you to add other websites as pages in the Home Assistant frontend. They will show up in the sidebar and can be used the same way as you open the frontend in your browser but all within one view.
- Frontend: Support for iFrame panels to adding other sites to sidebar (@balloob)
- Allow components to register custom frontend panels (@balloob)
- Add example custom_component react_panel showing custom panels (@balloob)
- Light: MagicLight/Flux WiFi Color LED Light support (@Danielhiversen)
- Script: Specify a delay using templates (@Teagan42)
- Media player: Russound RNET integration (@laf)
- Remote: Option specifying custom timeout when calling Home Assistant API (@n8henrie)
- Thermostat: Integration of KNX thermostats (@open-homeautomation)
- Thermostat: Support for HVAC mode of Nest devices (@vladonemo)
- InfluxDB: Option to specify additional tags (@open-homeautomation)
- Input slider: Support for float value (@ngraziano)
- Template: New filters (
- Binary sensor - Wink: Water leak sensor support added (@w1ll1am23)
- Sensor - Tellduslive: Support for luminance of Fibaro Motion Sensor (@PetitCircuitLab)
- Switch - RPi GPIO: Fix when inverted logic (@zeroDenial)
- Z-Wave: Rollershutter update (@turbokongen)
- RFXtrx: Fire events when receiving signals from sensors and tests added (@Danielhiversen)
- Core: Add type checking using mypy to the core (@fabianhjr)
- Remote: Support for getting the Configuration through the Python API (@fabaff)
- Media player: Support for DirecTV (@cbulock)
- Use browser timezone for frontend logbook and history dates (@armills)
- Light: New support for X10 lights (@fotoetienne)
- Sensor: Support for observing IMAP accounts (@danieljkemp)
- Media Player: Integration for MPC-HC (Media Player Classic - Home Cinema) mediaplayer (@abcminiuser)
locationextension for Telegram and photo bug fixed (@keatontaylor and @pvizeli)
- Groups: Lock states will now be properly grouped (@jwl17330536)
- Media Player: Added tests for Sonos to improve code quality (@americanwookie)
- Device Tracker: iCloud stability fixes (@kellerza)
- Sensor: Speedtest with improved error handling and state restoring (@nkgilley)
- Recorder: Stability fixes (@kellerza)
- Qwikswitch: Stability fixes (@kellerza)
- Light: Hyperion keeps now track of active color (@schneefux)
- Light - Z-Wave: Bring back delayed value update behavior (@jnewland)
- Recorder: Properly close session after execute (@kellerza)
- Media Player - Kodi: No longer block startup if connecting to wrong port (@shoekstra)
- Downgrade voluptuous to 0.8.9 as it blocked the upgrade for some (@balloob)
- Hotfix to make sure Z-Wave locks work again. Thanks to @tobiebooth for the quick fix.
- Google Voice SMS notification support was removed.
Until a couple of weeks ago, the pre-built MicroPython binary for the ESP8266 was only available to backers of the Kickstarter campaign. This has changed now and it is available to the public for download.Read on →
This is the first blog post by Anton Kireyeu. A new contributor to Home Assistant who will focus on exploring and visualizing Home Assistant data.
As we learned in the recent blog post by Fabian, all operational data of your Home Assistant application is stored locally and is available for exploration. Our first steps were querying data with the DB Browser for SQLite, exporting the data extract as a CSV file and graphing in LibreOffice. But what else can be done with this data and what tools are there available?
This post will help you get set up using a few popular data scientist tools to allow you to locally process your data:
- Pandas: an open source tool for data analysis for Python
- matplotlib: a Python plotting library
- Jupyter notebook: application for creation and sharing of documents containing live code, visualizations and explanatory text
One of the graphs created with this tutorial.
TL; DR: Use this Jupyter Notebook to visualize of your dataRead on →
The history component is tracking everything that is going on within Home Assistant. This means that you have access to all stored information about your home. Our history is not a full-fledged graphical processing and visualization component as you may know from systems and network monitoring tools. The current limitation is that you only can select a day for a visual output of your information and not a period. Also, there is no possibility to drill down on a specific entity.
This blog post will show you ways to export data for reporting, visualization, or further analysis of automation rules.Read on →
It’s time for Home Assistant 0.24 and it’s full of new integration for your Home. It contains some structural changes to our history which requires action from your end, so please keep reading.
Roy Hooper did an amazing job migrating the history support from being tied to SQLite to use the ORM SQLAlchemy instead. This means that you can now use any SQL backend for the history. So besides SQLite you can now databases like MySQL or PostgreSQL. However, this does require that you install SQLAlchemy and run a command to migrate your existing history over. We tried to make the process as seamless as possible by introducing a new command line script:
pip3 install SQLAlchemy hass --script db_migrator --config /path/to/config
You can omit the
--config option if you use the default configuration directory. Run the script with
--help to get more options.
- Config: Improved support for storing secrets (@kellerza)
- Sensor: Support for Yahoo! Weather (@pvizeli)
- Add scripts to command line to expose advanced options (@balloob)
- Alarm: SimpliSafe is now supported (@w1ll1am23)
- Core: Switch to SQLAlchemy for the Recorder component (@rhooper)
- Support for Join by Joaoapps added incl. Join Notify (@nkgilley)
- Media Player: Plex will no longer spam the logs if server goes offline (@dale3h)
- Sensor: APCUPSd Sensor now supports names, icons and units (@dale3h)
- Lock: Verisure entities will now use name instead of serial number for entity id (@turbokongen)
- StatsD can now also export attributes (@bah2830)
- Support for KNX added (@usul27)
- Switch: TPLink HS100/HS110 now supported (@GadgetReactor)
- Stability fixes for RFXtrx (@Danielhiversen)
- Tweaks to Z-Wave (@turbokongen)
- Light: Brightness now clamped to 0-255 (@keatontaylor)
- Thermostat: Radiotherm HVAC mode now supported (@danieljkemp)
- Sensor: Google Travel times can now use dynamic locations for start/end (@bah2830)
- Notify: Allow sending photos to Telegram (@pvizeli)
- Frontend: Improve loading times (@balloob)
- Frontend: Fix stream not reconnecting after standby (@balloob)
- Frontend: Wait up to two seconds for new state before resetting toggle after toggling state (@balloob)
- Migrating existing databases (see above).
- The APCUPSd Sensor was updated. This will need that you modify your
- Entity IDs of Verisure locks will change. This is a one time change but should improve readability.
It’s time for Home Assistant 0.23 and it’s full of goodies. It’s also the release that bumps us over a 1000 tests and to 94% test coverage! Also our install issues on the Raspberry Pi and Synology have been resolved.
This release brings support for two new ecosystems: Envisalink and Homematic. We can now also control your TV via HDMI using HDMI-CEC (which works on the Pi!) and another cool feature is the persistent notifications which allow you to add a notification to the frontend till dismissed.
Wink support has been dramatically improved by migrating to the PubNub API. This allows Wink to push changes from their system to Home Assistant. This change came just in time as somehow our Wink integration was causing a lot of requests to their servers. Thanks to Wink for letting us know so we could solve it instead of blocking us.
On the config side, you can now store your passwords in your OS keyring or just in a standalone file. We also got a new service to reload the core config so no reboots needed anymore after changing customize settings!
- Support for Envisalink added (alarm control panel, binary sensor, sensor) (@cinntax)
- Support for Homematic added (binary sensor, light, rollershutter, sensor, switch) (@pvizeli, @danielperna84)
- New HDMI-CEC component (@happyleavesaoc, @lukas-hetzenecker)
- Major rewrite of Wink which now pushes changes to Home Assistant (@w1ll1am23)
- Core: new add reload core config service (@balloob)
- Support for persistent notifications added (@fabaff, @balloob)
- Garage door: Z-Wave support added (@turbokongen)
- Rollershutter: Z-Wave support added (@turbokongen)
- Media Player: Sony Bravia TV now supported (@aparraga)
- Sensor: Fixer.io now supported (@fabaff)
- Garage door: Control any garage door using Raspberry Pi GPIO pins (@kellerza)
- Sensor: OpenExchangeRates support added (@arsaboo)
- Notify: Pushover now supports target device, sound, URL and priority (@dale3h)
- Sensor: Netatmo now supports wind, battery and radio signals (@Jypy)
- Log successful and failed login attemps (@fabaff)
- Config: allow extracting account info into OS keyring or separate YAML file (@kellerza)
- Core: add option to not filter out duplicate states per entity (@philipbl)
- HTTP: Follow Mozilla SSL recommendations (@danieljkemp, @AlucardZero)
- Light: Z-Wave colorbulb support added (@armills)
- Core: new elevation config option added (@balloob)
- Sensor: OneWire support extended with support for DS18S20, DS1822, DS1825 and DS28EA00 temperature sensors + support for bus masters which use fuse to mount device tree. (@Ardetus)
- Lock: Vera now supported (@rhooper)
- HTTP: Migrate to CherryPy WSGI server to fix install and runtime problems (@balloob)
- Homematic thermostat configuration has changed and now depends on the new Homematic component.
- Bump PyVera to 0.2.13 to fix traceback and pyvera thread dying related to bug (@rhooper)
- HTTP - SSL: Check for OP_NO_COMPRESSION support before trying to use it (@AlucardZero)
- Wink: Downgraded pubnub to work around pycryptodome conflicts (@w1ll1am23)
elevation:was introduced to the configuration for weather/sunrise data. For existing configurations add the value shown in the warning
[homeassistant.config] Incomplete core config. Auto detected elevation: 665to your
In this blog post I am using a Fedora 24 (will most likely work on other distributions too) installation with Home Assistant 0.22.1 on a Foxconn nT-330i with an old Logitech QuickCam Orbit AF and a Logitech HD Webcam C270. As a start only the Quickcam is used. No multi-camera setup for now.Read on →