Skip to content

Commit

Permalink
Merge pull request #365 from flixlix/chore-dev-create-devconteiner-co…
Browse files Browse the repository at this point in the history
…nfig

build: 🏗️ add .devconteiner config
  • Loading branch information
flixlix authored Sep 8, 2023
2 parents f459b53 + cac0daa commit d0bbc72
Show file tree
Hide file tree
Showing 5 changed files with 6,393 additions and 2 deletions.
210 changes: 210 additions & 0 deletions .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
default_config:
lovelace:
mode: yaml
resources:
- url: http://127.0.0.1:5000/power-flow-card-plus.js
type: module
demo:

input_number:
solar_power:
name: Solar Power
min: 0
max: 2000
step: 1
mode: box
unit_of_measurement: "W"
solar_secondary:
name: Solar Secondary
min: 0
max: 100
step: 1
mode: box
unit_of_measurement: "%"
home_power:
name: Home Power
min: 0
max: 2000
step: 1
mode: box
unit_of_measurement: "W"
home_secondary:
name: Home Secondary
min: 0
max: 100
step: 1
mode: box
unit_of_measurement: "%"
battery_power:
name: Battery Power
min: -2000
max: 2000
step: 1
mode: box
unit_of_measurement: "W"
battery_secondary:
name: Battery Secondary
min: 0
max: 100
step: 1
mode: box
unit_of_measurement: "%"
grid_power:
name: Grid Power
min: -2000
max: 2000
step: 1
mode: box
unit_of_measurement: "W"
grid_secondary:
name: Grid Secondary
min: 0
max: 100
step: 1
mode: box
unit_of_measurement: "%"
fossil_fuel_percentage:
name: Fossil Fuel Percentage
min: 0
max: 100
step: 0.01
mode: box
unit_of_measurement: "%"
fossil_fuel_power:
name: Fossil Fuel Power
min: 0
max: 2000
step: 0.01
mode: box
unit_of_measurement: "W"
individual1_power:
name: Individual 1 Power
min: 0
max: 2000
step: 1
mode: box
unit_of_measurement: "W"
individual1_secondary:
name: Individual 1 Secondary
min: 0
max: 100
step: 1
mode: box
unit_of_measurement: "%"
individual2_power:
name: Individual 2 Power
min: 0
max: 2000
step: 1
mode: box
unit_of_measurement: "W"
individual2_secondary:
name: Individual 2 Secondary
min: 0
max: 100
step: 1
mode: box
unit_of_measurement: "%"
individual3_power:
name: Individual 3 Power
min: 0
max: 2000
step: 1
mode: box
unit_of_measurement: "W"
individual3_secondary:
name: Individual 3 Secondary
min: 0
max: 100
step: 1
mode: box
unit_of_measurement: "%"

homeassistant:
customize:
switch.skylight:
device_class: switch

switch:
- platform: template
switches:
skylight:
value_template: "{{ states('input_number.test') | int == 255 }}"
turn_on:
service: input_number.set_value
data:
entity_id: input_number.test
value: "255"
turn_off:
service: input_number.set_value
data:
entity_id: input_number.test
value: "0"

sensor:
- platform: template
sensors:
sensor1:
value_template: "{{ states('input_number.test') }}"
unit_of_measurement: Kb/s
raspi_cpu:
value_template: "{{ ((states('input_number.test') | int) / 255 * 100) | int }}"
unit_of_measurement: "%"
raspi_ram:
value_template: "{{ ((states('input_number.test') | int) / 255 * 100) | int }}"
unit_of_measurement: "%"
raspi_sd:
value_template: "{{ ((states('input_number.test') | int) / 255 * 100) | int }}"
unit_of_measurement: "%"
raspi_temp:
value_template: "{{ ((states('input_number.test') | int) / 255 * 100) | int }}"
unit_of_measurement: "°C"

binary_sensor:
- platform: template
sensors:
bsensor1:
friendly_name: Binary 1
value_template: "{{ states('switch.skylight') == 'on' }}"
device_class: door

light:
- platform: template
lights:
test_light:
friendly_name: "Test Light"
level_template: "{{ states.sensor.sensor1.state | int }}"
value_template: "{{ states.sensor.sensor1.state | int > 0 }}"
turn_on:
service: input_number.set_value
data:
entity_id: input_number.test
value: "255"
turn_off:
service: input_number.set_value
data:
entity_id: input_number.test
value: "0"
set_level:
service: input_number.set_value
data_template:
value: "{{ brightness }}"

alarm_control_panel:
- platform: manual
name: Home Alarm
code: 1234
# pending_time: 30
delay_time: 20
trigger_time: 4
disarmed:
trigger_time: 0
armed_home:
# pending_time: 0
delay_time: 0

timer:
laundry:
duration: "01:00:10"

stream:
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "Homekit Button Development",
"image": "ghcr.io/ludeeus/devcontainer/generic:latest",
"context": "..",
"remoteUser": "vscode",
"appPort": ["5000:5000", "9123:8123"],
"postCreateCommand": "yarn install && sudo container install",
"runArgs": ["-v", "${localWorkspaceFolder}/.devcontainer/www:/config/www"],
"extensions": [
"github.vscode-pull-request-github",
"eamodio.gitlens",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bierner.lit-html",
"runem.lit-plugin",
"davidanson.vscode-markdownlint",
"redhat.vscode-yaml",
"msjsdiag.debugger-for-chrome",
"yzhang.markdown-all-in-one"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 2,
"terminal.integrated.shell.linux": "/bin/bash",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"markdown.extension.toc.githubCompatibility": true,
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true,
"**/.hg/store/**": true,
"**/.rpt2_cache/**": true
}
}
}
5 changes: 5 additions & 0 deletions .devcontainer/ui-lovelace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
views:
- title: Main
cards:
- type: button
entity: switch.skylight
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"build": "rollup -c",
"lint": "eslint src/*",
"release": "semantic-release",
"start": "rollup -wc"
"start": "rollup -wc",
"watch": "rollup -c --watch"
},
"dependencies": {
"@material/mwc-ripple": "^0.19.1",
Expand Down Expand Up @@ -64,4 +65,4 @@
"semantic-release": "^19.0.2",
"typescript": "^4.9.5"
}
}
}
Loading

0 comments on commit d0bbc72

Please sign in to comment.