diff --git a/source/_components/dweet.markdown b/source/_components/dweet.markdown index 5acb5647dcb..fdfab021d8f 100644 --- a/source/_components/dweet.markdown +++ b/source/_components/dweet.markdown @@ -31,7 +31,7 @@ To use the `dweet` component in your installation, add the following to your `co dweet: name: HAExport whitelist: - - input_slider.brightness + - input_number.brightness - input_boolean.notify_home - sensor.weather_temperature - sensor.cpu diff --git a/source/_components/input_slider.markdown b/source/_components/input_number.markdown similarity index 62% rename from source/_components/input_slider.markdown rename to source/_components/input_number.markdown index c58fbbe6a36..eba24e1383a 100644 --- a/source/_components/input_slider.markdown +++ b/source/_components/input_number.markdown @@ -1,8 +1,8 @@ --- layout: page -title: "Input Slider" -description: "Instructions how to integrate the Input Slider component into Home Assistant." -date: 2016-03-15 06:00 +title: "Input Number" +description: "Instructions how to integrate the Input Number component into Home Assistant." +date: 2017-09-19 03:30 sidebar: true comments: false sharing: true @@ -12,40 +12,48 @@ ha_category: Automation ha_release: 0.16 --- -The `input_slider` component allows the user to define values that can be controlled via the frontend and can be used within conditions of automation. Changes to the slider generate state events. These state events can be utilized as `automation` triggers as well. +The `input_number` component allows the user to define values that can be controlled via the frontend and can be used within conditions of automation. The frontend can display a slider, or a numeric input box. Changes to the slider or numeric input box generate state events. These state events can be utilized as `automation` triggers as well. -To enable this input sliders in your installation, add the following lines to your `configuration.yaml`: +To enable this input number in your installation, add the following lines to your `configuration.yaml`: ```yaml # Example configuration.yaml entry -input_slider: +input_number: slider1: - name: Slider 1 + name: Slider initial: 30 min: -20 max: 35 step: 1 + box1: + name: Numeric Input Box + initial: 30 + min: -20 + max: 35 + step: 1 + mode: box ``` Configuration variables: -- **[alias]** (*Required*): Alias for the slider input. Multiple entries are allowed. - - **min** (*Required*): Minimum value for the slider. - - **max** (*Required*): Maximum value for the slider. - - **name** (*Optional*): Friendly name of the slider input. +- **[alias]** (*Required*): Alias for the input. Multiple entries are allowed. + - **min** (*Required*): Minimum value. + - **max** (*Required*): Maximum value. + - **name** (*Optional*): Friendly name of the input. - **initial** (*Optional*): Initial value when Home Assistant starts. Defaults to 0. - **step** (*Optional*): Step value for the slider. Defaults to 1. + - **mode** (*Optional*): Can specify `box`, or `slider`. Defaults to `slider`. ## {% linkable_title Automation Examples %} -Here's an example of `input_slider` being used as a trigger in an automation. +Here's an example of `input_number` being used as a trigger in an automation. ```yaml {% raw %} -# Example configuration.yaml entry using 'input_slider' as a trigger in an automation +# Example configuration.yaml entry using 'input_number' as a trigger in an automation -# Define input_slider -input_slider: +# Define input_number +input_number: bedroom_brightness: name: Brightness initial: 254 @@ -58,7 +66,7 @@ automation: - alias: Bedroom Light - Adjust Brightness trigger: platform: state - entity_id: input_slider.bedroom_brightness + entity_id: input_number.bedroom_brightness action: - service: light.turn_on # Note the use of 'data_template:' below rather than the normal 'data:' if you weren't using an input variable @@ -68,11 +76,11 @@ automation: {% endraw %} ``` -Another code example using `input_slider`, this time being used in an action in an automation. +Another code example using `input_number`, this time being used in an action in an automation. ```yaml {% raw %} -# Example configuration.yaml entry using 'input_slider' in an action in an automation +# Example configuration.yaml entry using 'input_number' in an action in an automation # Define 'input_select' input_select: @@ -87,8 +95,8 @@ input_select: - 'OFF' initial: 'Select' -# Define input_slider -input_slider: +# Define input_number +input_number: bedroom_brightness: name: Brightness initial: 254 @@ -108,19 +116,19 @@ automation: # Again, note the use of 'data_template:' rather than the normal 'data:' if you weren't using an input variable. data_template: entity_id: light.bedroom - brightness: '{{ states.input_slider.bedroom_brightness.state | int }}' + brightness: '{{ states.input_number.bedroom_brightness.state | int }}' {% endraw %} ``` -Example of `input_slider` being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation. +Example of `input_number` being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation. ```yaml {% raw %} -# Example configuration.yaml entry using 'input_slider' in an action in an automation +# Example configuration.yaml entry using 'input_number' in an action in an automation -# Define input_slider -input_slider: +# Define input_number +input_number: target_temp: name: Target Heater Temperature Slider min: 1 @@ -136,11 +144,11 @@ input_slider: trigger: platform: mqtt topic: "setTemperature" - # entity_id: input_slider.target_temp + # entity_id: input_number.target_temp action: - service: input_slider.select_value + service: input_number.set_value data_template: - entity_id: input_slider.target_temp + entity_id: input_number.target_temp value: '{{ trigger.payload}}' # This automation script runs when the target temperature slider is moved. @@ -148,12 +156,12 @@ input_slider: - alias: Temp slider moved trigger: platform: state - entity_id: input_slider.target_temp + entity_id: input_number.target_temp action: service: mqtt.publish data_template: topic: "setTemperature" retain: true - payload: '{{ states.input_slider.target_temp.state | int }}' + payload: '{{ states.input_number.target_temp.state | int }}' {% endraw %} ``` diff --git a/source/_components/shell_command.markdown b/source/_components/shell_command.markdown index c7c55e557de..2a50140747c 100644 --- a/source/_components/shell_command.markdown +++ b/source/_components/shell_command.markdown @@ -39,11 +39,11 @@ automation: - alias: run_set_ac trigger: platform: state - entity_id: input_slider.ac_temperature + entity_id: input_number.ac_temperature action: service: shell_command.set_ac_to_slider -input_slider: +input_number: ac_temperature: name: A/C Setting initial: 24 @@ -53,6 +53,6 @@ input_slider: {% raw %} shell_command: - set_ac_to_slider: 'irsend SEND_ONCE DELONGHI AC_{{ states.input_slider.ac_temperature.state }}_AUTO' + set_ac_to_slider: 'irsend SEND_ONCE DELONGHI AC_{{ states.input_number.ac_temperature.state }}_AUTO' {% endraw %} ``` diff --git a/source/_cookbook/dim_and_brighten_lights.markdown b/source/_cookbook/dim_and_brighten_lights.markdown index ee3f24ff80c..21fc4f02699 100644 --- a/source/_cookbook/dim_and_brighten_lights.markdown +++ b/source/_cookbook/dim_and_brighten_lights.markdown @@ -78,10 +78,10 @@ automation: There are 2 variables that control the speed of the change for the scripts below. The first is the `step`, small steps create a smooth transition. The second is the delay, larger delays will create a slower transition. -To allow flexibility, an [Input Slider](/components/input_slider/) is used for the step (at the time of writing this, it's not possible to template the delay when the delay uses milliseconds). Two additional [Input Sliders](/components/input_slider/) are used to set the minimum and maximum brightness, so that it's easy to tune that (or manage it through an automation). +To allow flexibility, an [Input Number](/components/input_number/) is used for the step (at the time of writing this, it's not possible to template the delay when the delay uses milliseconds). Two additional [Input Numbers](/components/input_number/) are used to set the minimum and maximum brightness, so that it's easy to tune that (or manage it through an automation). ```yaml -input_slider: +input_number: light_step: name: 'Step the lights this much' initial: 20 @@ -116,10 +116,10 @@ script: entity_id: light.YOUR_LIGHT brightness: >- {% raw %}{% set current = states.light.YOUR_LIGHT.attributes.brightness|default(0)|int %} - {% set step = states('input_slider.light_step')|int %} + {% set step = states('input_number.light_step')|int %} {% set next = current + step %} - {% if next > states('input_slider.light_maximum')|int %} - {% set next = states('input_slider.light_maximum')|int %} + {% if next > states('input_number.light_maximum')|int %} + {% set next = states('input_number.light_maximum')|int %} {% endif %} {{ next }}{% endraw %} @@ -142,10 +142,10 @@ script: entity_id: light.YOUR_LIGHT brightness: >- {% raw %}{% set current = states.light.YOUR_LIGHT.attributes.brightness|default(0)|int %} - {% set step = states('input_slider.light_step')|int %} + {% set step = states('input_number.light_step')|int %} {% set next = current - step %} - {% if next < states('input_slider.light_minimum')|int %} - {% set next = states('input_slider.light_minimum')|int %} + {% if next < states('input_number.light_minimum')|int %} + {% set next = states('input_number.light_minimum')|int %} {% endif %} {{ next }}{% endraw %} diff --git a/source/_docs/ecosystem/appdaemon/api.markdown b/source/_docs/ecosystem/appdaemon/api.markdown index dde8c25442a..792fca55dee 100755 --- a/source/_docs/ecosystem/appdaemon/api.markdown +++ b/source/_docs/ecosystem/appdaemon/api.markdown @@ -1257,7 +1257,7 @@ self.toggle("light.office_1", color_name = "green") ### {% linkable_title select_value() %} -This is a convenience function for the `input_slider.select_value` function. It is able to set the value of an input_slider in Home Assistant. +This is a convenience function for the `input_number.select_value` function. It is able to set the value of an input_number in Home Assistant. #### {% linkable_title Synopsis %} @@ -1273,16 +1273,16 @@ None ##### {% linkable_title entity_id %} -Fully qualified entity_id of the input_slider to be changed, e.g. `input_slider.alarm_hour`. +Fully qualified entity_id of the input_number to be changed, e.g. `input_number.alarm_hour`. ##### {% linkable_title value %} -The new value to set the input slider to. +The new value to set the input number to. #### {% linkable_title Examples %} ```python -self.select_value("input_slider.alarm_hour", 6) +self.select_value("input_number.alarm_hour", 6) ``` ### {% linkable_title select_option() %} @@ -1307,7 +1307,7 @@ Fully qualified entity_id of the input_select to be changed, e.g. `input_select. ##### {% linkable_title value %} -The new value to set the input slider to. +The new value to set the input number to. #### {% linkable_title Examples %} diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index 2a6abdd8d5c..3f7106a35a5 100644 --- a/source/_docs/scripts.markdown +++ b/source/_docs/scripts.markdown @@ -71,9 +71,9 @@ delay: ``` ```yaml -# Waits however many minutes input_slider.minute_delay is set to +# Waits however many minutes input_number.minute_delay is set to # Valid formats include HH:MM and HH:MM:SS -delay: {% raw %}'00:{{ states.input_slider.minute_delay.state | int }}:00'{% endraw %} +delay: {% raw %}'00:{{ states.input_number.minute_delay.state | int }}:00'{% endraw %} ``` ### {% linkable_title Wait %} diff --git a/source/demo/frontend.html b/source/demo/frontend.html index ca813ce680a..0cb5b148868 100644 --- a/source/demo/frontend.html +++ b/source/demo/frontend.html @@ -1,5 +1,5 @@ \ No newline at end of file +t},updateStyles:function(e){e&&this.mixin(this.customStyle,e),i?t.updateNativeStyleProperties(this,this.customStyle):(this.isAttached?this._needsStyleProperties()?this._updateStyleProperties():this._styleProperties=null:this.__stylePropertiesInvalid=!0,this._styleCache&&this._styleCache.clear(),this._updateRootStyles())},_updateRootStyles:function(e){e=e||this.root;for(var t,n=Polymer.dom(e)._query(function(e){return e.shadyRoot||e.shadowRoot}),r=0,s=n.length;r0&&l.push(t);return[{removed:a,added:l}]}},Polymer.Collection.get=function(e){return Polymer._collections.get(e)||new Polymer.Collection(e)},Polymer.Collection.applySplices=function(e,t){var n=Polymer._collections.get(e);return n?n._applySplices(t):null},Polymer({is:"dom-repeat",extends:"template",_template:null,properties:{items:{type:Array},as:{type:String,value:"item"},indexAs:{type:String,value:"index"},sort:{type:Function,observer:"_sortChanged"},filter:{type:Function,observer:"_filterChanged"},observe:{type:String,observer:"_observeChanged"},delay:Number,renderedItemCount:{type:Number,notify:!0,readOnly:!0},initialCount:{type:Number,observer:"_initializeChunking"},targetFramerate:{type:Number,value:20},_targetFrameTime:{type:Number,computed:"_computeFrameTime(targetFramerate)"}},behaviors:[Polymer.Templatizer],observers:["_itemsChanged(items.*)"],created:function(){this._instances=[],this._pool=[],this._limit=1/0;var e=this;this._boundRenderChunk=function(){e._renderChunk()}},detached:function(){this.__isDetached=!0;for(var e=0;e=0;t--){var n=this._instances[t];n.isPlaceholder&&t=this._limit&&(n=this._downgradeInstance(t,n.__key__)),e[n.__key__]=t,n.isPlaceholder||n.__setProperty(this.indexAs,t,!0)}this._pool.length=0,this._setRenderedItemCount(this._instances.length),this.fire("dom-change"),this._tryRenderChunk()},_applyFullRefresh:function(){var e,t=this.collection;if(this._sortFn)e=t?t.getKeys():[];else{e=[];var n=this.items;if(n)for(var r=0;r=r;a--)this._detachAndRemoveInstance(a)},_numericSort:function(e,t){return e-t},_applySplicesUserSort:function(e){for(var t,n,r=this.collection,s={},i=0;i=0;i--){var h=a[i];void 0!==h&&this._detachAndRemoveInstance(h)}var c=this;if(l.length){this._filterFn&&(l=l.filter(function(e){return c._filterFn(r.getItem(e))})),l.sort(function(e,t){return c._sortFn(r.getItem(e),r.getItem(t))});var u=0;for(i=0;i>1,a=this._instances[o].__key__,l=this._sortFn(n.getItem(a),r);if(l<0)e=o+1;else{if(!(l>0)){i=o;break}s=o-1}}return i<0&&(i=s+1),this._insertPlaceholder(i,t),i},_applySplicesArrayOrder:function(e){for(var t,n=0;n=0?(e=this.as+"."+e.substring(n+1),i._notifyPath(e,t,!0)):i.__setProperty(this.as,t,!0))}},itemForElement:function(e){var t=this.modelForElement(e);return t&&t[this.as]},keyForElement:function(e){var t=this.modelForElement(e);return t&&t.__key__},indexForElement:function(e){var t=this.modelForElement(e);return t&&t[this.indexAs]}}),Polymer({is:"array-selector",_template:null,properties:{items:{type:Array,observer:"clearSelection"},multi:{type:Boolean,value:!1,observer:"clearSelection"},selected:{type:Object,notify:!0},selectedItem:{type:Object,notify:!0},toggle:{type:Boolean,value:!1}},clearSelection:function(){if(Array.isArray(this.selected))for(var e=0;e