diff --git a/.coveragerc b/.coveragerc index cc639df0c44..7cfcacaaa2d 100644 --- a/.coveragerc +++ b/.coveragerc @@ -30,6 +30,11 @@ omit = homeassistant/components/device_tracker/ddwrt.py homeassistant/components/sensor/transmission.py + homeassistant/components/isy994.py + homeassistant/components/light/isy994.py + homeassistant/components/switch/isy994.py + homeassistant/components/sensor/isy994.py + [report] # Regexes for lines to exclude from consideration diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 973415c1866..e6bc947d771 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,9 +27,25 @@ A state can have several attributes that will help the frontend in displaying yo - `friendly_name`: this name will be used as the name of the device - `entity_picture`: this picture will be shown instead of the domain icon - `unit_of_measurement`: this will be appended to the state in the interface + - `hidden`: This is a suggestion to the frontend on if the state should be hidden These attributes are defined in [homeassistant.components](https://github.com/balloob/home-assistant/blob/master/homeassistant/components/__init__.py#L25). +## Proper Visibility Handling ## + +Generally, when creating a new entity for Home Assistant you will want it to be a class that inherits the [homeassistant.helpers.entity.Entity](https://github.com/balloob/home-assistant/blob/master/homeassistant/helpers/entity.py] Class. If this is done, visibility will be handled for you. +You can set a suggestion for your entitie's visibility by setting the hidden property by doing something similar to the following. + +```python +self.hidden = True +``` + +This will SUGGEST that the active frontend hide the entity. This requires that the active frontend support hidden cards (the default frontend does) and that the value of hidden be included in your attributes dictionary (see above). The Entity abstract class will take care of this for you. + +Remember: The suggestion set by your component's code will always be overwritten by manual settings in the configuration.yaml file. This is why you may set hidden to be False, but the property may remain True (or vice-versa). + +If you would not like to use the Entity Abstract Class, you may also inherity the Visibility Abstract Class which will include the logic for the hidden property but not automatically add the hidden property to the attributes dictionary. If you use this class, ensure that your class correctly adds the hidden property to the attributes. + ## Working on the frontend The frontend is composed of Polymer web-components and compiled into the file `frontend.html`. During development you do not want to work with the compiled version but with the seperate files. To have Home Assistant serve the seperate files, set `development=1` for the http-component in your config. diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 4a6aab53483..17e8cb3391b 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -20,6 +20,7 @@ import homeassistant import homeassistant.loader as loader import homeassistant.components as core_components import homeassistant.components.group as group +from homeassistant.helpers.entity import VisibilityABC from homeassistant.const import ( EVENT_COMPONENT_LOADED, CONF_LATITUDE, CONF_LONGITUDE, CONF_TEMPERATURE_UNIT, CONF_NAME, CONF_TIME_ZONE, TEMP_CELCIUS, @@ -207,6 +208,8 @@ def process_ha_core_config(hass, config): if key in config: setattr(hass.config, attr, config[key]) + VisibilityABC.visibility.update(config.get('visibility', {})) + if CONF_TEMPERATURE_UNIT in config: unit = config[CONF_TEMPERATURE_UNIT] diff --git a/homeassistant/components/frontend/index.html.template b/homeassistant/components/frontend/index.html.template index c4da4f0369d..4844eb46760 100644 --- a/homeassistant/components/frontend/index.html.template +++ b/homeassistant/components/frontend/index.html.template @@ -15,8 +15,8 @@ - + diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index 8d5abe4a084..984ddf18ab7 100644 --- a/homeassistant/components/frontend/version.py +++ b/homeassistant/components/frontend/version.py @@ -1,2 +1,2 @@ """ DO NOT MODIFY. Auto-generated by build_frontend script """ -VERSION = "b432551a6704deb437aac61cdecef864" +VERSION = "e7801905cc2ea1ee349ec199604fb984" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index 3cac1e4d560..fd47ffa638d 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -11,12 +11,11 @@ window.PolymerGestures={},function(a){var b=!1,c=document.createElement("meta"); LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ThisExpression:"ThisExpression",UnaryExpression:"UnaryExpression"},V={UnexpectedToken:"Unexpected token %0",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared"};var ab=H,bb=L;a.esprima={parse:R}}(this),function(a){"use strict";function b(a,b,d,e){var f;try{if(f=c(a),f.scopeIdent&&(d.nodeType!==Node.ELEMENT_NODE||"TEMPLATE"!==d.tagName||"bind"!==b&&"repeat"!==b))throw Error("as and in can only be used within