Skip to content

Commit

Permalink
Merge pull request #337 from UI-Lovelace-Minimalist/dev
Browse files Browse the repository at this point in the history
0.0.5
  • Loading branch information
CM000n authored Feb 14, 2022
2 parents 3013d63 + 7d37efe commit d1fd5ce
Show file tree
Hide file tree
Showing 214 changed files with 7,992 additions and 903 deletions.
23 changes: 8 additions & 15 deletions .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,23 @@ default_config:
frontend:
themes: !include_dir_merge_named "themes"

# For some reason default_config is not picking it up.
automation ui: !include "automations.yaml"

# lovelace:
# mode: "storage"

# sensor:
# - platform: "time_date"

logger:
default: "info"
logs:
custom_components.ui_lovelace_minimalist: "debug"
# If you need to debug uncommment the line below (doc: https://www.home-assistant.io/integrations/debugpy/)
# debugpy:

#
# Uncomment part below after installing dependencies
#
## Requirement for popups, install browser mod with hacs
browser_mod:

## Install virtual integration with hacs
virtual:

weather:
- platform: "template"
name: "DummyTown"
condition_template: "cloudy"
temperature_template: "{{ '20' | float }}"
humidity_template: "{{ '50' | float }}"

light:
- platform: "virtual"
name: "Livingroom"
Expand All @@ -37,6 +29,7 @@ light:
support_white_value: true

sensor:
- platform: "time_date"
- platform: "virtual"
name: "Livingroom Temperature"
class: "temperature"
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/automatic-custom-card-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ jobs:
replace: "../../assets/img"
include: "docs/usage/custom_cards/**"
regex: true
- name: "Commit files"
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git pull -p
git add --all
git commit -a -m "Add changes for automatically custom_cards docs"
- name: "Push changes"
uses: "ad-m/github-push-action@master"
- name: "Create Pull Request"
uses: "peter-evans/create-pull-request@v3"
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
branch: "${{ github.ref }}"
token: "${{ secrets.GITHUB_TOKEN }}"
branch: "automated_custom_card_docs"
delete-branch: true
commit-message: "Update docs"
committer: "GitHub <[email protected]>"
title: "[Action] Update custom_cards docs"
labels: ":memo: documentation"
body: |
Update custom_cards docs due to latest changes.
2 changes: 1 addition & 1 deletion custom_cards/custom_card_bar_card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Version: 1.0.0

<details>
<summary>1.0.0</summary>
Initial release
Initial release.
</details>

## Requirements
Expand Down
307 changes: 307 additions & 0 deletions custom_cards/custom_card_homeassistant_updates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
---
title: custom_card_homeassistant_updates
hide:
- toc
---
<!-- markdownlint-disable MD046 -->

# Custom-card "Homeassistant updates"

![Homeassistant updates card](../../docs/assets/img/ulm_cards/card_homeassistant_updates.png)

!! Attention !!

This card needs additional template sensors and a group.updaters sensor to work, all detail can be found in this readme.

## Credits

- Author: AndyVRD - 2021
- Special thanks to [basbruss](https://github.com/basbruss/UI)
- Version: 1.0.1

## Changelog

<details>
<summary>1.0.0</summary>
Initial release
</details>
<details>
<summary>1.0.1</summary>
Added support for ulm_language variables
</details>

## Usage

```yaml
- type: 'custom:button-card'
template: card_homeassistant_updates
variables:
ulm_card_homeassistant_entity: 'group.updaters'
ulm_card_homeassistant_core: "sensor.core_updates"
ulm_card_homeassistant_supervisor: "sensor.supervisor_updates"
ulm_card_homeassistant_os: "sensor.os_updates"
```
## Requirements
n/a
## Variables
<table>
<tr>
<th>Variable</th>
<th>Example</th>
<th>Required</th>
<th>Explanation</th>
</tr>
<tr>
<td>entity_</td>
<td>group.updaters</td>
<td>yes</td>
<td>Group of template sensors</td>
</tr>
<tr>
<td>core_</td>
<td>sensor.core_updates</td>
<td>yes</td>
<td>sensor core installed/latest version</td>
</tr>
<tr>
<td>os_</td>
<td>sensor.os_updates</td>
<td>no</td>
<td>sensor os installed/latest version</td>
</tr>
<tr>
<td>supervisor_</td>
<td>sensor.supervisor_updates</td>
<td>no</td>
<td>sensor supervisor installed/latest version</td>
</tr>
</table>
## Template code
```yaml
---
card_homeassistant_updates:
triggers_update: "all"
styles:
grid:
- grid-template-areas: "'item1' 'item2'"
- grid-template-columns: "1fr"
- grid-template-rows: "min-content min-content"
- row-gap: "12px"
card:
- border-radius: "var(--border-radius)"
- box-shadow: "var(--box-shadow)"
- padding: "12px"
custom_fields:
item1:
card:
triggers_update: "all"
type: "custom:button-card"
template:
- "icon_info_updates"
- "ulm_language_variables"
icon: 'mdi:home-assistant'
tap_action:
action: "none"
entity: "[[[ return variables.ulm_card_homeassistant_entity ]]]"
name: >
[[[
if(states[variables.ulm_card_homeassistant_core].state ==='True' || states[variables.ulm_card_homeassistant_supervisor].state ==='True' || states[variables.ulm_card_homeassistant_os].state ==='True'){
return 'Updates beschikbaar!';
} else {
return 'Geen updates'
}
]]]
label: >
[[[
if(variables.ulm_card_homeassistant_core){
if(states[variables.ulm_card_homeassistant_core].state ==='True'){
var core = 'Core: ' + states[variables.ulm_card_homeassistant_core].attributes.installed_version + ' -> ' + states[variables.ulm_card_homeassistant_core].attributes.latest_version;
} else {
var core = 'Core: ' + states[variables.ulm_card_homeassistant_core].attributes.installed_version;
}
}
if(variables.ulm_card_homeassistant_supervisor){
if(states[variables.ulm_card_homeassistant_supervisor].state ==='True'){
var supervisor = 'Supervisor: ' + states[variables.ulm_card_homeassistant_supervisor].attributes.installed_version + ' -> ' + states[variables.ulm_card_homeassistant_supervisor].attributes.latest_version;
} else {
var supervisor = 'Supervisor: ' + states[variables.ulm_card_homeassistant_supervisor].attributes.installed_version;
}
}
if(variables.ulm_card_homeassistant_os){
if(states[variables.ulm_card_homeassistant_os].state ==='True'){
var os = 'Os: ' + states[variables.ulm_card_homeassistant_os].attributes.installed_version + ' -> ' + states[variables.ulm_card_homeassistant_os].attributes.latest_version;
} else {
var os = 'Os: ' + states[variables.ulm_card_homeassistant_os].attributes.installed_version;
}
}
if(variables.ulm_card_homeassistant_core && variables.ulm_card_homeassistant_supervisor && variables.ulm_card_homeassistant_os){
return supervisor + '<br>' + core + '<br>' + os;
} else if(variables.ulm_card_homeassistant_core && variables.ulm_card_homeassistant_supervisor){
return supervisor + '<br>' + core;
} else if(variables.ulm_card_homeassistant_core){
return core;
}
]]]
styles:
icon:
- color: "rgba(var(--color-theme),0.9)"
item2:
card:
type: "custom:button-card"
template: "list_3_items"
custom_fields:
item1:
card:
type: "custom:button-card"
template: "widget_icon"
icon: "mdi:file-document"
tap_action:
action: url
url_path: https://www.home-assistant.io/latest-release-notes/
item2:
card:
type: "custom:button-card"
template: "widget_icon"
icon: "mdi:cog"
tap_action:
action: navigate
navigation_path: /config/server_control

item3:
card:
type: "custom:button-card"
template: "widget_icon"
icon: "mdi:update"
tap_action:
action: navigate
navigation_path: /config/dashboard

icon_info_updates:
color: var(--google-grey)
show_icon: true
show_label: true
show_name: true
state:
- value: "on"
styles:
custom_fields:
notification:
- border-radius: "50%"
- position: "absolute"
- left: "28px"
- top: "8px"
- height: "16px"
- width: "16px"
- border: "2px solid var(--card-background-color)"
- font-size: "12px"
- line-height: "14px"
- background-color: >
[[[
return "rgba(var(--color-blue),1)";
]]]
icon:
- color: 'rgba(var(--color-blue),1)'
img_cell:
- background-color: 'rgba(var(--color-blue), 0.2)'
styles:
icon:
- color: 'rgba(var(--color-theme),0.2)'
label:
- justify-self: start
- align-self: start
- font-weight: bolder
- font-size: 12px
- filter: opacity(40%)
- margin-left: 16px
- text-align: "start"
name:
- align-self: end
- justify-self: start
- font-weight: bold
- font-size: 14px
- margin-left: 16px
- margin-bottom: 4px
state:
- justify-self: start
- align-self: start
- font-weight: bolder
- font-size: 12px
- filter: opacity(40%)
- margin-left: 12px
img_cell:
- background-color: 'rgba(var(--color-theme),0.05)'
- border-radius: 50%
- place-self: center
- width: 42px
- height: 42px
grid:
- grid-template-areas: '"i n" "i l"'
- grid-template-columns: min-content auto
- grid-template-rows: min-content min-content
card:
- border-radius: 21px 8px 8px 21px
- box-shadow: none
- padding: 0px
# - background-color: 'rgba(var(--color-theme),0)'
custom_fields:
notification: >
[[[
if ( entity.state =="unavailable" || entity.state =="on" ){
return `<ha-icon icon="mdi:party-popper" style="width: 12px; height: 12px; color: var(--primary-background-color);"></ha-icon>`;
}
]]]
size: 20px

```

## Template sensors code

```yaml
- platform: command_line
name: core_updates
command: 'curl http://supervisor/core/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"latest_version":.data.version_latest,"installed_version":.data.version,"update_available":.data.update_available}'''
value_template: '{{ value_json.update_available }}'
scan_interval: 600
json_attributes:
- update_available
- latest_version
- installed_version

- platform: command_line
name: supervisor_updates
command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"latest_version":.data.version_latest,"installed_version":.data.version,"update_available":.data.update_available}'''
value_template: '{{ value_json.update_available }}'
scan_interval: 600
json_attributes:
- update_available
- latest_version
- installed_version

- platform: command_line
name: os_updates
command: 'curl http://supervisor/os/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"latest_version":.data.version_latest,"installed_version":.data.version,"update_available":.data.update_available}'''
value_template: '{{ value_json.update_available }}'
scan_interval: 600
json_attributes:
- update_available
- latest_version
- installed_version
```
## Template sensor group.updates
```yaml
group:
updaters:
name: Updates
entities:
- binary_sensor.updater_core
- binary_sensor.updater_supervisor
- binary_sensor.updater_os
```
Loading

0 comments on commit d1fd5ce

Please sign in to comment.