From b30feb926ff1f0ee89bd520811556a02ebc0c688 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 17 Mar 2020 16:14:34 +0100 Subject: [PATCH 1/7] Clarify supported systems for Supervised, improve installation instructions (#12412) * Clarify supported systems for Supervised, improve installation instructions * Update source/hassio/installation.markdown Co-Authored-By: Pascal Vizeli Co-authored-by: Pascal Vizeli --- source/hassio/installation.markdown | 76 +++++++++-------------------- 1 file changed, 23 insertions(+), 53 deletions(-) diff --git a/source/hassio/installation.markdown b/source/hassio/installation.markdown index 33109490214..8132d95f178 100644 --- a/source/hassio/installation.markdown +++ b/source/hassio/installation.markdown @@ -106,82 +106,59 @@ You can also install Home Assistant on a Linux operating system of choice, calle Home Assistant Supervised, will still give you access to most features Home Assistant has to offer, including add-ons. -The packages you need to have available on your system needed to Home Assistant may vary. +### Supported systems and limitations -### Debian/Ubuntu +While Home Assistant Supervised can be run on practically any Linux systems, +the Home Assistant project limits support for this installation method. -- `apparmor-utils` -- `apt-transport-https` -- `avahi-daemon` -- `ca-certificates` -- `curl` -- `dbus` -- `jq` -- `socat` -- `software-properties-common` +Only the use of Debian or Ubuntu is supported. Other Linux-based system may work +but is not part of our testing and thus not supported. -Optional: +Furthermore, if you choose to run Home Assistant Supervised, the operating +system of your choosing (including Debian/Ubuntu) is **your** responsibility. +Both in terms of systems upgrade and system configuration. -- `network-manager` +Customizations to your custom operating system may interfere with Home Assistant. +For that reason, please be sure you have to knowledge to manage, configure and +maintain the operating system of your choosing. -
- - Without the NetworkManager, you will be not able to control your host network setup over the UI. The `modemmanager` package will interfere with any Z-Wave or Zigbee stick and should be removed or disabled. Failure to do so will result in random failures of those integrations. For example, you can disable with `sudo systemctl disable ModemManager` and remove with `sudo apt-get purge modemmanager` - -
- -### Arch Linux - -- `apparmor` -- `avahi` -- `ca-certificates` -- `curl` -- `dbus` -- `docker` -- `jq` -- `socat` - -You also need to have Docker-CE installed. There are well-documented procedures for installing Docker on Ubuntu at [Docker.com](https://docs.docker.com/install/linux/docker-ce/ubuntu/), you can find installation steps for your Linux distribution in the menu on the left. - -
- - Some distributions, like Ubuntu, have a `docker.io` package available. Using that package will cause issues! - Be sure to install the official Docker-CE from the above-listed URL. - - Docker is not always ready with a release when a new Ubuntu version is out. Check if your version of Ubuntu is supported by Docker [here](https://docs.docker.com/install/linux/docker-ce/ubuntu/). - -
+When in doubt, we highly recommend using the regular installation of Home +Assistant as provided above. In that case, Home Assistant will manage and update +the Home Assistant Operating System for you. ### Preparation To prepare your machine for the Home Assistant installation, run the following commands: -For Ubuntu: +If you run Ubuntu, first run this command: ```bash -add-apt-repository universe +sudo add-apt-repository universe ``` -Debian/Ubuntu: +Next run the following commands (for both Debian and Ubuntu): ```bash sudo -i apt-get update apt-get install -y software-properties-common apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat systemctl disable ModemManager +systemctl stop ModemManager curl -fsSL get.docker.com | sh ``` +### Installation of Home Assistant Supervised + The following script will then install Home Assistant on a variety of operating systems and machine types. ```bash curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | bash -s ``` -Some installation types require flags to identify the computer type, for example, when using a Raspberry Pi 3, the flag `-- -m raspberrypi3` is required. The install script would then look like this: +Some installation types require flags to identify the computer type, for example, when using a Raspberry Pi 4, the flag `-- -m raspberrypi4` is required. The install script would then look like this: ```bash -curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | bash -s -- -m raspberrypi3 +curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | bash -s -- -m raspberrypi4 ``` #### Other machine types @@ -194,7 +171,7 @@ curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/mast - `raspberrypi4` - `raspberrypi4-64` - `odroid-c2` -- `odroid-cu2` +- `odroid-n2` - `odroid-xu` - `tinker` - `qemuarm` @@ -206,12 +183,6 @@ See the [hassio-installer](https://github.com/home-assistant/hassio-installer) G If you can not find your machine type in the list, you should pick the `qemu` release. i.e., `qemux86-64` for a normal 64-bit Linux distribution, or `qemuarm-64` for most modern ARM-based target like Raspberry Pi clones, or TV boxes. -
-When you use this installation method, the core SSH add-on may not function correctly. If that happens, use the community SSH add-on. Some of the documentation might not work for your installation either. -
- -A detailed guide about running Home Assistant as a virtual machine is available in the [blog][hassio-vm]. - [balenaEtcher]: https://www.balena.io/etcher [Virtual Appliance]: https://github.com/home-assistant/operating-system/blob/dev/Documentation/boards/ova.md [hassos-network]: https://github.com/home-assistant/operating-system/blob/dev/Documentation/network.md @@ -235,5 +206,4 @@ A detailed guide about running Home Assistant as a virtual machine is available [samba]: /addons/samba/ [ssh]: /addons/ssh/ [pi-power]: https://www.raspberrypi.org/help/faqs/#powerReqs -[hassio-vm]: /blog/2017/11/29/hassio-virtual-machine/ [configure]: /getting-started/configuration/ From 4b24fd82dca4a6dab486898441c4746ad802f376 Mon Sep 17 00:00:00 2001 From: akasma74 Date: Tue, 17 Mar 2020 17:36:55 +0000 Subject: [PATCH 2/7] add note about time (#12411) Similar to https://github.com/home-assistant/home-assistant.io/pull/12236 I think it's worth to make it clear how before and after keys work together and separately. --- source/_docs/scripts/conditions.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/_docs/scripts/conditions.markdown b/source/_docs/scripts/conditions.markdown index 561b59a4eb1..e0fcdde6c3d 100644 --- a/source/_docs/scripts/conditions.markdown +++ b/source/_docs/scripts/conditions.markdown @@ -235,7 +235,9 @@ condition: ``` Valid values for `weekday` are `mon`, `tue`, `wed`, `thu`, `fri`, `sat`, `sun`. -Time condition windows can span across the midnight threshold. In the example above, the condition window is from 3pm to 2am. +Note that if only `before` key is used, the condition will be `true` *from midnight* until the specified time. +If only `after` key is used, the condition will be `true` from the specified time *until midnight*. +Time condition windows can span across the midnight threshold if **both** `after` and `before` keys are used. In the example above, the condition window is from 3pm to 2am.
From 86fc0c0031e1af200fa0316811860e1ad2d08073 Mon Sep 17 00:00:00 2001 From: Willem-Jan Date: Tue, 17 Mar 2020 21:10:38 +0000 Subject: [PATCH 3/7] fix spelling appdeamon to Appdaemon (#12415) --- source/_docs/ecosystem/appdaemon/tutorial.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_docs/ecosystem/appdaemon/tutorial.markdown b/source/_docs/ecosystem/appdaemon/tutorial.markdown index b546206e660..c5a81f7fe6a 100644 --- a/source/_docs/ecosystem/appdaemon/tutorial.markdown +++ b/source/_docs/ecosystem/appdaemon/tutorial.markdown @@ -19,7 +19,7 @@ So given the importance of Automation, what should Automation allow us to do? I In my opinion, Home Assistant accomplishes the majority of these very well with a combination of Automations, Scripts and Templates, and its Restful API. -So why `AppDaemon`? AppDaemon is not meant to replace Home Assistant Automations and Scripts, rather complement them. For a lot of things, automations work well and can be very succinct. However, there is a class of more complex automations for which they become harder to use, and appdeamon then comes into its own. It brings quite a few things to the table: +So why `AppDaemon`? AppDaemon is not meant to replace Home Assistant Automations and Scripts, rather complement them. For a lot of things, automations work well and can be very succinct. However, there is a class of more complex automations for which they become harder to use, and AppDaemon then comes into its own. It brings quite a few things to the table: - New paradigm - some problems require a procedural and/or iterative approach, and `AppDaemon` Apps are a much more natural fit for this. Recent enhancements to Home Assistant scripts and templates have made huge strides, but for the most complex scenarios, Apps can do things that Automations can't - Ease of use - AppDaemon's API is full of helper functions that make programming as easy and natural as possible. The functions and their operation are as "Pythonic" as possible, experienced Python programmers should feel right at home. From 7f46da993ddfca7c0538225e01ee3fdb431da386 Mon Sep 17 00:00:00 2001 From: Chris Talkington Date: Wed, 18 Mar 2020 04:11:35 -0500 Subject: [PATCH 4/7] Migrate directv logo to brands. (#12418) * Migrate directv logo to brands * Delete directv.png --- source/_integrations/directv.markdown | 1 - source/images/supported_brands/directv.png | Bin 1913 -> 0 bytes 2 files changed, 1 deletion(-) delete mode 100644 source/images/supported_brands/directv.png diff --git a/source/_integrations/directv.markdown b/source/_integrations/directv.markdown index af10e475b72..6234502cd5d 100644 --- a/source/_integrations/directv.markdown +++ b/source/_integrations/directv.markdown @@ -1,7 +1,6 @@ --- title: DirecTV description: Instructions on how to integrate DirecTV receivers into Home Assistant. -logo: directv.png ha_category: - Media Player ha_release: 0.25 diff --git a/source/images/supported_brands/directv.png b/source/images/supported_brands/directv.png deleted file mode 100644 index aa0fe2da9214ffb94b00e1a1f1e5adf8e84fca1f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1913 zcmYk7cQ_mPAIB53rCjVgNyUiKqc~by2ti|y#NN9-4PwNqttclyQG5KXMyZ;ms%lhS zRAQDxs~S{Gs@=kmKg&pp5A`F`G?*Zcb!|9-Mz^S)p}- zouvd}vo2QR2trsP0DyJ^@2L+b%L60q&5Qso6Oc`o@w2r=o0x@J>bKEZ58g^={jrqA zEC4&g|6le08UMEm|7Vp>s4ZDtFfvf6 zvFJ;#Duvdassc0hvPF<|m+UjL006FR6cT|BUY>JZ>@HWm^r|_KFIvzjS?T<|u+Sf@ z>W!UgsIICKRZT%qayhD=YDgT^`iB2G)=`3~{h`m;bqb>tKd$75!Rsm6x6Qv*D}wTx zORg3VugV}c7k?$6uBd9Q&bKh8rM!`z{e(5lt_=&_9;X{CCy0{6xkSm-R;2u4JLD1Kka9&u zGCFXi&@AOXE_ncP?S1#fzSB%zQ6>{b$yZ$5?oDTsetu@u+A5cqoup+E$0Lp@ar{Q) z6=A&TD+w|O8~JhzG_Z*xYA<>4$0gbg>#NuWe5gDQhh?OScyK zS50@Tu4 zXlWkH7E7DyK*>=XaNw-o!^}i)NRk4O5c$$S@>@{SkaukQR_P&Da=U(!d#}GpnGnWo zuucHqh)+pUd7Rg*j$P98v|7I=jx&f(oBmpuE-vqAs2rpkHFwevOwaqm*$5;)eBr-w zBW`y4FGb$@IUiEH|EI|-BrbgU+-K<#!DBccc#}FF!fq!Kk?z>JybdsG&zK|3 zn48rZ5gE^xeoq}s)TYxb=WXyQ3RNYHsj^e50><=O;Ta1&f9be<16;@FfF4`V0zh*$g!V^`)3**A+wD(hut~ZKY1($Wm{KSTPPL;6`&|UU- zk8<->bX9yDV1L#1eeX_%;izoEAFh1RnOF2uh6HHtuE#U|oXIB(WATszV&lyzu1>TX z4J%ok`aDIU*tTX70^eEfDD&+}UND)^JDPw2_*+VChO2Mm(w74^#3WF;bDuwH1S$t3 zI5{vrIwXaVY76T(E--LZR~%e8c)O%&(^qT{-~Q!i(HkZSc!AG z9$Zik-Ln*8AW2i>8s{P1ZBC3i2BW3RuBTT&O)o38??$JZ12m};=R5B-H#-9+C!)TV zb)`-xv&nu-I(c87T%}Kgsxm{@0NjyOlk9_guT+^pcv3YMUyp=P1+M&AS>l=Bb_#+T zY=rB*pvZQj1bW?LvqGU-H*FJ+hIe_Ojl5&Gp3js_~llaHIY2I8lN z(ozM=J=$8J)s%IF6DE^E&F=8mzKuld2N$P(Wb{SXKpKNTChwb8G}63}W4x}Lo~;g- p?Rw1ZDv1a8i1=L=W&C1$$_~v!+a Date: Wed, 18 Mar 2020 10:26:04 +0100 Subject: [PATCH 5/7] Add missing abbreviations (#12401) * Add missing abbreviations * Add line break Co-authored-by: Fabian Affolter --- source/_docs/mqtt/discovery.markdown | 47 +++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/source/_docs/mqtt/discovery.markdown b/source/_docs/mqtt/discovery.markdown index 1bce903b750..80a80e20815 100644 --- a/source/_docs/mqtt/discovery.markdown +++ b/source/_docs/mqtt/discovery.markdown @@ -80,6 +80,9 @@ Configuration variable names in the discovery payload may be abbreviated to cons Supported abbreviations: ```txt + 'act_t': 'action_topic', + 'act_tpl': 'action_template', + 'atype': 'automation_type', 'aux_cmd_t': 'aux_command_topic', 'aux_stat_tpl': 'aux_state_template', 'aux_stat_t': 'aux_state_topic', @@ -93,18 +96,23 @@ Supported abbreviations: 'bri_stat_t': 'brightness_state_topic', 'bri_tpl': 'brightness_template', 'bri_val_tpl': 'brightness_value_template', + 'clr_temp_cmd_tpl': 'color_temp_command_template', 'bat_lev_t': 'battery_level_topic', 'bat_lev_tpl': 'battery_level_template', 'chrg_t': 'charging_topic', 'chrg_tpl': 'charging_template', 'clr_temp_cmd_t': 'color_temp_command_topic', 'clr_temp_stat_t': 'color_temp_state_topic', + 'clr_temp_tpl': 'color_temp_template', 'clr_temp_val_tpl': 'color_temp_value_template', 'cln_t': 'cleaning_topic', 'cln_tpl': 'cleaning_template', 'cmd_off_tpl': 'command_off_template', 'cmd_on_tpl': 'command_on_template', 'cmd_t': 'command_topic', + 'cmd_tpl': 'command_template', + 'cod_arm_req': 'code_arm_required', + 'cod_dis_req': 'code_disarm_required', 'curr_temp_t': 'current_temperature_topic', 'curr_temp_tpl': 'current_temperature_template', 'dev': 'device', @@ -116,6 +124,8 @@ Supported abbreviations: 'fanspd_t': 'fan_speed_topic', 'fanspd_tpl': 'fan_speed_template', 'fanspd_lst': 'fan_speed_list', + 'flsh_tlng': 'flash_time_long', + 'flsh_tsht': 'flash_time_short', 'fx_cmd_t': 'effect_command_topic', 'fx_list': 'effect_list', 'fx_stat_t': 'effect_state_topic', @@ -130,10 +140,14 @@ Supported abbreviations: 'hold_cmd_t': 'hold_command_topic', 'hold_stat_tpl': 'hold_state_template', 'hold_stat_t': 'hold_state_topic', + 'hs_cmd_t': 'hs_command_topic', + 'hs_stat_t': 'hs_state_topic', + 'hs_val_tpl': 'hs_value_template', 'ic': 'icon', 'init': 'initial', 'json_attr': 'json_attributes', 'json_attr_t': 'json_attributes_topic', + 'json_attr_tpl': 'json_attributes_template', 'max_temp': 'max_temp', 'min_temp': 'min_temp', 'mode_cmd_t': 'mode_command_topic', @@ -146,24 +160,41 @@ Supported abbreviations: 'osc_cmd_t': 'oscillation_command_topic', 'osc_stat_t': 'oscillation_state_topic', 'osc_val_tpl': 'oscillation_value_template', + 'pl': 'payload', 'pl_arm_away': 'payload_arm_away', 'pl_arm_home': 'payload_arm_home', + 'pl_arm_nite': 'payload_arm_night', 'pl_avail': 'payload_available', + 'pl_cln_sp': 'payload_clean_spot', 'pl_cls': 'payload_close', 'pl_disarm': 'payload_disarm', 'pl_hi_spd': 'payload_high_speed', + 'pl_home': 'payload_home', 'pl_lock': 'payload_lock', + 'pl_loc': 'payload_locate', 'pl_lo_spd': 'payload_low_speed', 'pl_med_spd': 'payload_medium_speed', 'pl_not_avail': 'payload_not_available', + 'pl_not_home': 'payload_not_home', 'pl_off': 'payload_off', + 'pl_off_spd': 'payload_off_speed', 'pl_on': 'payload_on', 'pl_open': 'payload_open', 'pl_osc_off': 'payload_oscillation_off', 'pl_osc_on': 'payload_oscillation_on', + 'pl_paus': 'payload_pause', 'pl_stop': 'payload_stop', + 'pl_strt': 'payload_start', + 'pl_stpa': 'payload_start_pause', + 'pl_ret': 'payload_return_to_base', + 'pl_toff': 'payload_turn_off', + 'pl_ton': 'payload_turn_on', 'pl_unlk': 'payload_unlock', + 'pos_clsd': 'position_closed', + 'pos_open': 'position_open', 'pow_cmd_t': 'power_command_topic', + 'pow_stat_t': 'power_state_topic', + 'pow_stat_tpl': 'power_state_template', 'r_tpl': 'red_template', 'ret': 'retain', 'rgb_cmd_tpl': 'rgb_command_template', @@ -172,6 +203,7 @@ Supported abbreviations: 'rgb_val_tpl': 'rgb_value_template', 'send_cmd_t': 'send_command_topic', 'send_if_off': 'send_if_off', + 'set_fan_spd_t': 'set_fan_speed_topic', 'set_pos_tpl': 'set_position_template', 'set_pos_t': 'set_position_topic', 'pos_t': 'position_topic', @@ -179,18 +211,30 @@ Supported abbreviations: 'spd_stat_t': 'speed_state_topic', 'spd_val_tpl': 'speed_value_template', 'spds': 'speeds', + 'src_type': 'source_type', 'stat_clsd': 'state_closed', + 'stat_closing': 'state_closing', 'stat_off': 'state_off', 'stat_on': 'state_on', 'stat_open': 'state_open', + 'stat_opening': 'state_opening', + 'stat_locked': 'state_locked', + 'stat_unlocked': 'state_unlocked', 'stat_t': 'state_topic', 'stat_tpl': 'state_template', 'stat_val_tpl': 'state_value_template', + 'stype': 'subtype', 'sup_feat': 'supported_features', 'swing_mode_cmd_t': 'swing_mode_command_topic', 'swing_mode_stat_tpl': 'swing_mode_state_template', 'swing_mode_stat_t': 'swing_mode_state_topic', 'temp_cmd_t': 'temperature_command_topic', + 'temp_hi_cmd_t': 'temperature_high_command_topic', + 'temp_hi_stat_tpl': 'temperature_high_state_template', + 'temp_hi_stat_t': 'temperature_high_state_topic', + 'temp_lo_cmd_t': 'temperature_low_command_topic', + 'temp_lo_stat_tpl': 'temperature_low_state_template', + 'temp_lo_stat_t': 'temperature_low_state_topic', 'temp_stat_tpl': 'temperature_state_template', 'temp_stat_t': 'temperature_state_topic', 'tilt_clsd_val': 'tilt_closed_value', @@ -199,8 +243,9 @@ Supported abbreviations: 'tilt_max': 'tilt_max', 'tilt_min': 'tilt_min', 'tilt_opnd_val': 'tilt_opened_value', - 'tilt_status_opt': 'tilt_status_optimistic', + 'tilt_opt': 'tilt_optimistic', 'tilt_status_t': 'tilt_status_topic', + 'tilt_status_tpl': 'tilt_status_template', 't': 'topic', 'uniq_id': 'unique_id', 'unit_of_meas': 'unit_of_measurement', From 3940293fc8c204cf7673cdd234d08c35b74a7825 Mon Sep 17 00:00:00 2001 From: Chris Talkington Date: Wed, 18 Mar 2020 04:21:16 -0500 Subject: [PATCH 6/7] Migrate roku logo to brands (#12414) * migrate roku logo to brands * Delete roku.png --- source/_integrations/roku.markdown | 1 - source/images/supported_brands/roku.png | Bin 1691 -> 0 bytes 2 files changed, 1 deletion(-) delete mode 100644 source/images/supported_brands/roku.png diff --git a/source/_integrations/roku.markdown b/source/_integrations/roku.markdown index 262cfa2f13b..5dcf9461c5e 100644 --- a/source/_integrations/roku.markdown +++ b/source/_integrations/roku.markdown @@ -1,7 +1,6 @@ --- title: Roku description: Instructions how to integrate Roku devices into Home Assistant. -logo: roku.png ha_category: - Hub - Media Player diff --git a/source/images/supported_brands/roku.png b/source/images/supported_brands/roku.png deleted file mode 100644 index 5e964140c9504867dea04b346ce718e5cfbdba3e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1691 zcmV;M24wk(P)Px#Hc(7dMMrQw7000H%Nkl(o*gIS!erZT7-avFP663hbm%5ncBT5b4DU;jB;VNN!f}u=uBAI2 zS)ZJ|L{bX|B$J+l+-|9e{$TB9O)}J@{Tbnl#8rTcLh#4OqbSat=Vv39;}=rxkLLAx zm-P|OL2UB9oA`&9Xe}#RFw?4l=u%f_F01cGwV&HYEIyP>r4Wd&afC}5T+H>X2(Sd{i60DtZ+1kskNVufE-V5AQ>n;)Pv~^#O8iU z#J>Ldl{s8Y+Az0sk2w&>{>=Dy%dRH zW{V4B5SuFDSj+3rfJ{o1Bgi29CQl!wb0N|jvr`a=h610y37&5OfrN-^lx&$(*c}|y zSxk}u;Fo%31OiD&&4k-`fVB8XN|cP)jF)yxZh}a$F$i!N!ts%5zX1ftd02jH1LEKt z2VkSeY+@RM=uC_=K5EIggIFdj$NrnZNs(cNM`FNHK(*T=AX;J$b>Mg#NE01xWJ%pO zX1ENxS$+^(EDZDu21(M-v*$ZOjA-J53uO$Ex?mQ_5w@CT8xonK&jdt-Xb8u#T7DY{ zWQ8_pid*8mMy}p>B#`lgPZ1C!)T{=0H^{0R1{}?G8FHK0DL$O7O`sqr_2t_^#?2tM zBo;o(6^Ag_A1(xBR>}Mj2-xvbKiG^wD(meVgXnV*%JID*YFA4735X;h_8cVU+mC|m zdH3BQEkb{vY0;nsnb&UBFb3&;gqW6n;v-;Oh~&L_1WW1ta@5)L*PNZY2?0r;&Foc5 z8E_S`cO6)KCH$&E_@%<755O2CrmxgmI%Dx9);oTZ5TkjP5LG1&Ak(Ep1Y*7h0@LxK zo8S_~bS5lOJ{*)NJX4_zv1?j1-o@8Ih!klSU~g3C^20r_f=c|BL`n6_TqM@zr)9iR zc^(xnmGMNxEp9@~_(zAHRK{Xh#@_}c_XmkZE218IengO6(<2#QPP8d)K;|R%97A;R zOjuFkPFhJr?Q`#hVE4MD5UHE+b}=G#HcR7eAHaTNsI1Uo!f3(Ya$D1zj*4uyt9zwD$Cz;vXV{m!4ZP~p7LiR&fc?#Dmd>9dz zSE8ro?VIM8Cktr#JL_pAeO{+aDe6ine-x;Erw<9{vybrI9&sZWs+?8 zF1xIowBBM~58}H~Njo4HALH>;R^ba53)S;2g)DDCR*V4^M?KCS3x4x~h3e5*-g2|a zl^VC%VV&2>AKUzJSKjycD*HiRFoP;*_F6@IaDLryZ||hKOy3`3{p|D%oh2UIbJsc4 lxO66gqrLFjuVqH}`VUkPg4opOp Date: Wed, 18 Mar 2020 10:35:12 +0100 Subject: [PATCH 7/7] =?UTF-8?q?Added=20example=20for=20extracting=20sensor?= =?UTF-8?q?=20data=20from=20email=20body=20using=E2=80=A6=20(#12374)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added example for extracting sensor data from email body using regex. * Update source/_integrations/imap_email_content.markdown Co-Authored-By: Franck Nijhof * Update source/_integrations/imap_email_content.markdown Co-Authored-By: Franck Nijhof * :pencil2: Tweak Co-authored-by: Franck Nijhof Co-authored-by: Klaas Schoute --- .../_integrations/imap_email_content.markdown | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/source/_integrations/imap_email_content.markdown b/source/_integrations/imap_email_content.markdown index 859e995035f..343ae525e98 100644 --- a/source/_integrations/imap_email_content.markdown +++ b/source/_integrations/imap_email_content.markdown @@ -73,7 +73,7 @@ value_template: description: The date and time the email was sent. {% endconfiguration %} -## Example +## Example - keyword spotting The following example shows the usage of the IMAP email content sensor to scan the subject of an email for text, in this case, an email from the APC SmartConnect service which tells whether the UPS is running on battery or not. @@ -98,3 +98,46 @@ sensor: {% endraw %} The same template structure can scan the date, body or sender for matching text before setting the state of the sensor. + +## Example - extracting formatted text from an email using template sensors + +This example shows how to extract numbers or other formatted data from an email to change the value of a template sensor to a value extracted from the email. In this example, we will be extracting energy use, cost, and billed amount from an email (from Georgia Power) and putting it into sensor values using a template sensor that runs against our IMAP email sensor already set up. A sample of the body of the email used is below: + +```text +Yesterday's Energy Use: 76 kWh +Yesterday's estimated energy cost: $8 +Monthly Energy use-to-date for 23 days: 1860 kWh +Monthly estimated energy cost-to-date for 23 days: $198 + +To view your account for details about your energy use, please click here. +``` + +Below is the template sensor which extracts the information from the body of the email in our IMAP email sensor (named sensor.energy_email) into 3 sensors for the energy use, daily cost, and billing cycle total. + +{% raw %} +```yaml +sensor: + - platform: template + sensors: + previous_day_energy_use: + friendly_name: Previous Day Energy Use + unit_of_measurement: kWh + value_template: > + {{ state_attr('sensor.energy_email','body') + |regex_findall_index("\*Yesterday's Energy Use:\* ([0-9]+) kWh") }} + previous_day_cost: + friendly_name: Previous Day Cost + unit_of_measurement: $ + value_template: > + {{ state_attr('sensor.energy_email', 'body') + |regex_findall_index("\*Yesterday's estimated energy cost:\* \$([0-9.]+)") }} + billing_cycle_total: + friendly_name: Billing Cycle Total + unit_of_measurement: $ + value_template: > + {{ state_attr('sensor.energy_email', 'body') + |regex_findall_index("\ days:\* \$([0-9.]+)") }} +``` +{% endraw %} + +By making small changes to the regular expressions defined above, a similar structure can parse other types of data out of the body of other emails.