Skip to content

Commit

Permalink
Merge branch 'release/2018-04-04'
Browse files Browse the repository at this point in the history
  • Loading branch information
renemarc committed Apr 5, 2018
2 parents a0267cd + 993d7a3 commit 6534ca7
Show file tree
Hide file tree
Showing 278 changed files with 5,589 additions and 1,581 deletions.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
As a **actor**, I want **something** so that I can **goal**.

### Acceptance criteria
1. It's done when .
1. It's done when .

### Additional details
-
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Description


### Scenario
1.
1.

### Expected result


### Actual result
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Short description of what this resolves


### Changes proposed in this pull request


### Fixes issue number
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ OZW_Log.txt
plex.conf
secrets.yaml

!.github
!.gitignore
!.gitkeep
!/.travis.yml
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "custom_components/display"]
path = custom_components/display
url = https://github.com/daemondazz/homeassistant-displays.git
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
#
language: python
python:
- "3.5"
- "3.6"
before_install:
- cp secrets-dummy.yaml secrets.yaml
- touch home-assistant_v2.db
- touch home-assistant.log
install:
- pip3 install homeassistant
script:
- hass -c . --script check_config
- hass --script check_config -c . -f
366 changes: 257 additions & 109 deletions README.md

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions appdaemon/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# AppDaemon 2.0 configuration
# AppDaemon 3.0 configuration

## Folders

## [`apps`](apps)
### [`📂 ./apps/`](apps)

Empty, to be used for eventual AppDaemon apps.


## [`custom_css`](custom_css/modern)
### [`🌈 ./custom_css/`](custom_css/modern)

For the **Modern** theme.


## [`custom_widgets`](custom_widgets)
### [`🔘 ./custom_widgets/`](custom_widgets)

For third-party, custom and modified dashboard widgets.


## [`dashboards`](dashboards)
### [`🖼 ./dashboards/`](dashboards)

For the dashboards used in HADashboard.
16 changes: 11 additions & 5 deletions appdaemon/appdaemon.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
AppDaemon:
secrets: /config/secrets.yaml
log:
logfile: STDOUT
errorfile: STDERR
appdaemon:
threads: 10
app_dir: /config/appdaemon/apps
disable_apps: 1
HASS:
ha_url: http://homeassistant:8123
HADashboard:
dash_url: http://127.0.0.1:5050
plugins:
HASS:
type: hass
ha_url: http://hassio/homeassistant
ha_key: f411986db776442b864aa2a31f2d948c
hadashboard:
dash_url: !secret hadashboard_dash_url
dash_dir: /config/appdaemon/dashboards
dash_compile_on_start: 1
Empty file removed appdaemon/apps.yaml
Empty file.
2 changes: 1 addition & 1 deletion appdaemon/custom_css/modern/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# AppDaemon _Modern_ custom theme

This theme is based very closely on the [default](https://github.com/home-assistant/appdaemon/tree/dev/appdaemon/assets/css/default) one, except with some minor tweaks to the CSS and extra classes and variables to support [`/appdaemon/custom_widgets`](../custom_widgets).
This theme is based very closely on the [default](https://github.com/home-assistant/appdaemon/tree/master/appdaemon/assets/css/default) one, except with some minor tweaks to the CSS and extra classes and variables to support [`/appdaemon/custom_widgets/`](../../custom_widgets).
32 changes: 31 additions & 1 deletion appdaemon/custom_css/modern/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,37 @@ head_includes:
#

body_includes:
- <! body tags go here ->
- |
<script>
/**
* Send motion detection event to Home Assistant API
*
* It turns off the sensor before turning it on again, to make sure that
* any change is registered. A bit dirty, but it works!
*/
if (typeof fully != 'undefined') {
function reportKioskMotion() {
var xhttp = new XMLHttpRequest();
xhttp.open('POST', 'http://hassio.local:8123/api/states/binary_sensor.kiosk_motion', false);
xhttp.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
xhttp.send(JSON.stringify({
'state': 'off',
'attributes': {
'friendly_name': 'Kiosk Motion'
}
}));
xhttp.open('POST', 'http://hassio.local:8123/api/states/binary_sensor.kiosk_motion', false);
xhttp.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
xhttp.send(JSON.stringify({
'state': 'on',
'attributes': {
'friendly_name': 'Kiosk Motion'
}
}));
}
fully.bind('onMotion', 'reportKioskMotion();');
}
</script>
#
# Styles
Expand Down
98 changes: 83 additions & 15 deletions appdaemon/custom_widgets/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,99 @@
# Custom AppDaemon widgets

AppDaemon offers [many widgets](https://github.com/home-assistant/appdaemon/tree/dev/appdaemon/widgets/), but can support some third-party and custom ones.
[AppDaemon](https://home-assistant.io/docs/ecosystem/appdaemon/) offers [many default widgets](https://github.com/home-assistant/appdaemon/tree/master/appdaemon/widgets/), but can also support third-party and custom ones.


## Community widgets

- [`baseiconsensor`](baseentitydisplay) from [ReneTode's repo]([)https://github.com/ReneTode/My-AppDaemon/tree/master/custom_widgets), modified with:
+ Support for entities used as **title** and **title2**.
### [`💡 iconsensor.yaml`](iconsensor.yaml) and [`baseiconsensor`](baseiconsensor)

- [`baseselect`](baseentitydisplay) also from [ReneTode's repo](https://github.com/ReneTode/My-AppDaemon/tree/master/custom_widgets), modified with:
+ Support for **sub_entities**.
Icon widget from [ReneTode's repo](https://github.com/ReneTode/My-AppDaemon/tree/master/custom_widgets/baseiconsensor), modified with:
- Added support for entities used as **title** and **title2**.

<div align="center">
<figure>
<div>
<img src="../../www/screenshots/widget-iconsensor.png" alt="Icon sensor widget" title="Icon sensor widget" width="160">
</div>
<figcaption>
<p><strong>Icon sensor widget with title2 entity.</strong></p>
</figcaption>
</figure>
</div>


### [`🔘 input_select.yaml`](input_select.yaml) and [`baseselect`](baseselect)

Selector widget also from [ReneTode's repo](https://github.com/ReneTode/My-AppDaemon/tree/master/custom_widgets/baseselect), modified with:
- Added support for **sub_entities**.

<div align="center">
<figure>
<div>
<img src="../../www/screenshots/widget-input_select.png" alt="Input selectwidget" title="Input select widget" width="160">
</div>
<figcaption>
<p><strong>Input select widget with sub entity.</strong></p>
</figcaption>
</figure>
</div>


## Custom widgets

- [`baseentitydisplay`](baseentitydisplay) is based on the default [basedisplay](https://github.com/home-assistant/appdaemon/tree/dev/appdaemon/widgets/basedisplay) but with the following modifications:
+ Support for entities used as **title** and **title2**.
+ Include **unit_of_measurement** to the **sub_entity**, if any.
### [`👽 entitysensor.yaml`](entitysensor.yaml) and [`baseentitydisplay`](baseentitydisplay)

Multipurpose widget based on the default [basedisplay](https://github.com/home-assistant/appdaemon/tree/master/appdaemon/widgets/basedisplay) but with the following modifications:
- Support for entities used as **title** and **title2**.
- Include **unit_of_measurement** to the **sub_entity**, if any.

<div align="center">
<figure>
<div>
<img src="../../www/screenshots/widget-entitysensor.png" alt="Entity sensor widget" title="Entity sensor widget" width="160">
</div>
<figcaption>
<p><strong>Entity sensor widget with title2 entity.</strong></p>
</figcaption>
</figure>
</div>


### [`📸 entitycamera.yaml`](entitycamera.yaml) and [`baseentityiframe`](baseentityiframe)

IFrame widget to showcase images and slideshows, based on the default [baseiframe](https://github.com/home-assistant/appdaemon/tree/master/appdaemon/widgets/baseiframe) but includes:
- Cache-buster added to already parameterized URLs.
- Optional **cache** integer parameter to add longevity to the cache-buster JS parameter.
- Optional entity dynamic titles, where an image can have a related title shown if it has a companion entity that provides such textual information.

<div align="center">
<figure>
<div>
<img src="../../www/screenshots/widget-entitycamera.gif" alt="Entity camera widget" title="Entity camera widget" width="600">
</div>
<figcaption>
<p><strong>Entity camera widget with dynamic titles.</strong></p>
</figcaption>
</figure>
</div>


- [`baseentityiframe`](baseentityiframe) is based on the default [baseiframe](https://github.com/home-assistant/appdaemon/tree/dev/appdaemon/widgets/baseiframe) but includes:
+ Cache-buster added to already parameterized URLs.
+ Optional **cache** integer parameter to add longevity to the cache-buster JS parameter.
### [`📶 multisensor.yaml`](multisensor.yaml) and [`basemultisensor`](basemultisensor)
Multi-sensors widget, like the **entitysensor** above, but adds:
- List two sensors size by side (useful to showcase both _temperature_ and _humidity_ together).

- [`basemultisensor`](basemultisensor) is like **baseentitydisplay** above, but adds:
+ List two sensors size by side (useful to showcase both _temperature_ and _humidity_ together).
<div align="center">
<figure>
<div>
<img src="../../www/screenshots/widget-multisensor.png" alt="Multisensor widget" title="Multisensor widget" width="160">
</div>
<figcaption>
<p><strong>Multisensor widget with temperature and humidity.</strong></p>
</figcaption>
</figure>
</div>


## Configuration
## Customization

The extra styling of these widgets is done in the theme [`/appdaemon/custom_css/modern`](../custom_css/modern) as well as directly in [`/appdaemon/dashboards`](../dashboards).
The extra styling of these widgets is done in the theme [`/appdaemon/custom_css/modern/`](../custom_css/modern) as well as directly in [`/appdaemon/dashboards/`](../dashboards).
50 changes: 46 additions & 4 deletions appdaemon/custom_widgets/baseentityiframe/baseentityiframe.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,54 @@
function baseentityiframe(widget_id, url, skin, parameters)
{
self = this
self = this;

// Initialization

self.parameters = parameters;

var callbacks = []
var callbacks = [];

var monitored_entities = []
var monitored_entities = [];

var _titles = [];

// Define dynamic methods.
if ("title_entity_list" in self.parameters)
{
function record_title_value(self, state, idx)
{
_titles[idx] = state.state;
}
self.record_title_value = record_title_value;

self.title_index = 0;

// Set title entities changes to be recorded.
var nameAvailable, nameUpdate, funcAvailable, funcUpdate,
title_size = self.parameters.title_entity_list.length;

for (var i = 0; i < title_size; ++i)
{
_titles[i] = '';
entity_title = self.parameters.title_entity_list[i];
if (entity_title.trim() != "") {
nameAvailable = "OnTitle" + self.title_index + "StateAvailable";
funcAvailable = new Function(
"return function " + nameAvailable + "(self, state){ self.record_title_value(self, state, " + self.title_index + ");}"
)();
Object.defineProperty(self, nameAvailable, {value: funcAvailable, writable: false});

nameUpdate = "OnTitle" + self.title_index + "StateUpdate";
funcUpdate = new Function(
"return function " + nameUpdate + "(self, state){ self.record_title_value(self, state, " + self.title_index + ");}"
)();
Object.defineProperty(self, nameUpdate, {value: funcUpdate, writable: false});

monitored_entities.push({"entity": entity_title, "initial": self[nameAvailable], "update": self[nameUpdate]});
}
self.title_index = self.title_index + 1;
}
}

// Call the parent constructor to get things moving

Expand All @@ -34,16 +74,18 @@ function baseentityiframe(widget_id, url, skin, parameters)
{
self.set_field(self, "frame_src", self.parameters.url_list[self.index]);
self.set_field(self, "img_src", "/images/Blank.gif");
self.set_field(self, "title", _titles[self.index]);
size = self.parameters.url_list.length
}
else if ("img_list" in self.parameters)
else if ("img_list" in self.parameters)
{
var url = self.parameters.img_list[self.index];
var separator = url.indexOf('?') > -1 ? '&' : '?';
var date = (new Date).getTime();
var timestamp = Math.floor(date/1000) - (self.cache ? Math.floor(date/1000) % self.cache : 0);
url = url + separator + "time=" + timestamp;
self.set_field(self, "img_src", url);
self.set_field(self, "title", _titles[self.index]);
size = self.parameters.img_list.length
}
else if ("entity_picture" in self.parameters)
Expand Down
34 changes: 19 additions & 15 deletions appdaemon/dashboards/Main.dash
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,16 @@ slideshow:
widget_type: entitycamera
refresh: 5
img_list:
- http://hassio.local:8123/api/camera_proxy/camera.bing_wallpaper?token=bc9ccd0575dfb05d63df105cc8ed76d6578d63e60083e48fe265a07513a9861d
- http://hassio.local:8123/api/camera_proxy/camera.environment_canada_snow?token=72401f9a299bbf9f8521bd46bb8e2366d29d59af19006522910aaed73502cb47
- http://hassio.local:8123/api/camera_proxy/camera.astronomy_picture_of_the_day?token=8a93f72de0a6538bd4c8348a338bd13a65be0bab41545f1b2f97676fb584c150
- http://hassio.local:8123/api/camera_proxy/camera.bing_wallpaper?token=bc9ccd0575dfb05d63df105cc8ed76d6578d63e60083e48fe265a07513a9861d
- http://hassio.local:8123/api/camera_proxy/camera.noaa_geocolor?token=c5c3e871bce6c743f4bb50b41cfed061fb9ac474735d22710d6d44d23725a961

slideshow_apod:
widget_type: sensor
entity: sensor.apod_title
widget_style: "background-color:inherit;"

slideshow_bing:
widget_type: sensor
entity: sensor.bing_wallpaper_info
widget_style: "background-color:inherit;"
- http://hassio.local:8123/api/camera_proxy/camera.astronomy_picture_of_the_day?token=8a93f72de0a6538bd4c8348a338bd13a65be0bab41545f1b2f97676fb584c150
title_entity_list:
- ""
- sensor.bing_wallpaper_info
- ""
- sensor.apod_info
title_style: "line-height:2em;opacity:0.8;"


#
Expand Down Expand Up @@ -114,6 +110,14 @@ night_mode:
entity: input_boolean.night_mode
title2: Go to sleep

scene:
widget_type: input_select
title2: Set a scene
entity: input_select.scene
sub_entity: input_select.scene
state_text_style: "background-color:#555;"
select_style: "background-color:#555;color:$white;"


#
# Weather
Expand Down Expand Up @@ -237,6 +241,6 @@ layout:
- nav_main, label(6x1), reload, temperature, clock
- nav_switchboard, slideshow(6x4), wind, temperature_now, weather_icon_now
- nav_weather, outdoor_safety, daily_forecast(2x1)
- nav_spacer(1x2), slideshow_bing, to_metro, to_market
- slideshow_apod, to_metro_2, to_market_2
- nav_status, good_morning, night_mode, nap_mode, quiet_mode, low_power_mode, spacer(2x1), to_metro_3, to_market_3
- nav_spacer(1x2), spacer, to_metro, to_market
- spacer, to_metro_2, to_market_2
- nav_status, good_morning, night_mode, nap_mode, scene, quiet_mode, low_power_mode, spacer, to_metro_3, to_market_3
Loading

0 comments on commit 6534ca7

Please sign in to comment.