Skip to content

Commit

Permalink
Some wll deserved maintainence (#57)
Browse files Browse the repository at this point in the history
* dropshadow optional, working devcontainer with HA

* fixes

* remove stuff

* gitignore

* Re-add yaml files

* re-add yaml
  • Loading branch information
helto4real authored Apr 9, 2023
1 parent a2b47e8 commit 35ea56c
Show file tree
Hide file tree
Showing 27 changed files with 1,030 additions and 784 deletions.
20 changes: 20 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.10-bullseye

RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
python3-dev nodejs bluez libffi-dev libssl-dev libjpeg-dev \
zlib1g-dev autoconf build-essential libopenjp2-7 \
libtiff5 libturbojpeg0-dev tzdata libpcap0.8


RUN useradd -rm homeassistant && \
mkdir /srv/homeassistant && \
chown homeassistant:homeassistant /srv/homeassistant && \
cd /srv/homeassistant && \
python3 -m pip install wheel && \
pip3 install homeassistant==2023.4.2



9 changes: 9 additions & 0 deletions .devcontainer/HA/config/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*.*
!.gitignore
!*.yaml

www/custom_cards/*.*
!*.md
blueprints
deps
tts
1 change: 1 addition & 0 deletions .devcontainer/HA/config/automations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
35 changes: 35 additions & 0 deletions .devcontainer/HA/config/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes

# Text to speech
tts:
- platform: google_translate

lovelace:
mode: yaml
resources:
- url: /local/custom_cards/canvas-gauge-card.js
type: module

sensor:
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: /home
- type: memory_use_percent
- type: processor_use
# - type: last_boot
# - type: network_out
# arg: "wlp2s0"
- type: load_1m
#- type: load_5m
#- type: load_15m

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions .devcontainer/HA/config/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# Use this file to store secrets like usernames and passwords.
# Learn more at https://www.home-assistant.io/docs/configuration/secrets/
some_password: welcome
Original file line number Diff line number Diff line change
@@ -1,56 +1,55 @@
resources:
- url: http://127.0.0.1:5000/canvas-gauge-card.js?v6
type: module
views:
- title: Example
cards:
- type: "custom:canvas-gauge-card"
name: Canvas Guage Card Development
card_height: 125
#background_color: "#000"
entity: sensor.processor_use
gauge:
colorValueBoxBackground: "#000"
borderShadowWidth: 0
borderOuterWidth: 0
borderMiddleWidth: 0
borderInnerWidth: 0
animationDuration: 1500
animationRule: linear
borders: false
colorPlate: "#ddd"
height: 210
highlights:
- color: "rgba(200, 50, 50, .75)"
from: 80
to: 100
majorTicks:
- "0"
- "10"
- "20"
- "30"
- "40"
- "50"
- "60"
- "70"
- "80"
- "90"
- "100"
maxValue: 100
minValue: 0
minorTicks: 2
needleCircleInner: false
needleCircleOuter: true
needleCircleSize: 7
needleType: arrow
needleWidth: 2
startAngle: 90
strokeTicks: true
ticksAngle: 180
type: radial-gauge
valueBox: false
width: 210
style:
left: 4.2%
top: 9.6%
transform: none
title: Hellströms home
views:
- cards:
- type: "custom:canvas-gauge-card"
card_height: 220
entity: sensor.processor_use
# dropshadow: false
gauge:
# colorValueBoxBackground: "#000"
borderShadowWidth: 0
borderOuterWidth: 0
borderMiddleWidth: 0
borderInnerWidth: 0
animationDuration: 1500
animationRule: linear
borders: false
colorPlate: "#ddd"
# data-width: 400
# data-height: 400
height: 400
# width: 100%
highlights:
- color: "rgba(200, 50, 50, .75)"
from: 80
to: 100
majorTicks:
- "0"
- "10"
- "20"
- "30"
- "40"
- "50"
- "60"
- "70"
- "80"
- "90"
- "100"
maxValue: 100
minValue: 0
minorTicks: 2
needleCircleInner: false
needleCircleOuter: true
needleCircleSize: 7
needleType: arrow
needleWidth: 2
startAngle: 90
strokeTicks: true
ticksAngle: 180
type: radial-gauge
valueBox: false

style:
left: 4.2%
top: 9.6%
transform: none
1 change: 1 addition & 0 deletions .devcontainer/HA/config/www/custom_cards/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the place where you should copy the card js file. Use the devcontainer vscode task `Deploy` for it.
18 changes: 0 additions & 18 deletions .devcontainer/configuration.yaml

This file was deleted.

53 changes: 21 additions & 32 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "Boilerplate Card Development",
"image": "ludeeus/container:monster",
"context": "..",
"appPort": ["5000:5000", "9123:8123"],
"postCreateCommand": "npm install",
"runArgs": [
"-v",
"${env:HOME}${env:USERPROFILE}/.ssh:/tmp/.ssh" // This is added so you can push from inside the container
],
"extensions": [
"github.vscode-pull-request-github",
"eamodio.gitlens",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bierner.lit-html",
"runem.lit-plugin",
"auchenberg.vscode-browser-preview",
"davidanson.vscode-markdownlint",
"redhat.vscode-yaml"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"terminal.integrated.shell.linux": "/bin/bash",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{
"name": "Custom card development",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"context": "..",
// Path is relataive to the devcontainer.json file.
"dockerfile": "Dockerfile"
},
"postCreateCommand": "npm install",
"runArgs": [
"-v",
"${env:HOME}${env:USERPROFILE}/.ssh:/tmp/.ssh" // This is added so you can push from inside the container
],
"mounts": [
"source=${localWorkspaceFolder}/.devcontainer/HA/Config,target=/usr/src/config,type=bind,consistency=cached"
]


}
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8123",
"webRoot": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/.devcontainer/HA/config/www/custom_cards/*.js",
"!**/node_modules/**"
]
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"debug.javascript.unmapMissingSources": true
}
35 changes: 35 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"label": "npm: build"
},
{
"label": "Deploy",
"type": "shell",
"command": "cp -f dist/canvas-gauge-card.js .devcontainer/HA/config/www/custom_cards/",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{
"label": "Start HA",
"type": "shell",
"command": "cd /srv/homeassistant && hass -c /usr/src/config",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}
6 changes: 5 additions & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ gauge:
Update to latest guage-card package to 2.1.7

# 0.7.0

Fix animation issues

# 0.8.0
- Dropshadow is now optional
- Removed dependency on custom-card-helpers
- Added devconainer that let you run HA and debug card
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.0
0.8.0
10 changes: 5 additions & 5 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Canvas Gauge Card",
"render_readme": true,
"filename": "canvas-gauge-card.js"
}
{
"name": "Canvas Gauge Card",
"render_readme": true,
"filename": "canvas-gauge-card.js"
}
Loading

0 comments on commit 35ea56c

Please sign in to comment.