Browse Source

add-linters

pull/19/head
fedy95 4 years ago
parent
commit
f6fb257bda
  1. 68
      .drone.yml
  2. 10
      .editorconfig
  3. 31
      Makefile
  4. 2
      docker-compose.yml
  5. 4
      etc/config/automations.yaml
  6. 2
      etc/config/blueprints/automation/homeassistant/motion_light.yaml
  7. 2
      etc/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml
  8. 124
      etc/config/configuration.yaml
  9. 8
      etc/config/custom_components/circadian_lighting/manifest.json
  10. 2
      etc/config/custom_components/circadian_lighting/services.yaml
  11. 2
      etc/config/groups.yaml
  12. 2
      etc/config/recorder.yaml
  13. 2
      etc/config/scenes.yaml
  14. 2
      etc/config/scripts.yaml

68
.drone.yml

@ -1,28 +1,60 @@
---
kind: pipeline
type: docker
name: pull_request
image_pull_secrets:
- dockerconfigjson
steps:
- name: lint yaml
image: registry.fedy95.com/baseimage-yamllint:latest
commands:
- yamllint -c /yamllint/relaxed.yaml etc/config/blueprints/automation/homeassistant/motion_light.yaml
- yamllint -c /yamllint/relaxed.yaml etc/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml
- yamllint -c /yamllint/relaxed.yaml etc/config/custom_components/circadian_lighting/services.yaml
- yamllint -c /yamllint/relaxed.yaml etc/config/automations.yaml
- yamllint -c /yamllint/relaxed.yaml etc/config/configuration.yaml
- yamllint -c /yamllint/relaxed.yaml etc/config/groups.yaml
- yamllint -c /yamllint/relaxed.yaml etc/config/recorder.yaml
- yamllint -c /yamllint/relaxed.yaml etc/config/scenes.yaml
- yamllint -c /yamllint/relaxed.yaml etc/config/scripts.yaml
- yamllint -c /yamllint/relaxed.yaml docker-compose.yml
when:
event: pull_request
- name: lint json
image: registry.fedy95.com/baseimage-jsonlint:latest
commands:
- jsonlint -qc etc/config/custom_components/circadian_lighting/manifest.json
when:
event: pull_request
---
kind: pipeline kind: pipeline
type: ssh type: ssh
name: default
name: master_push
clone: clone:
disable: true
disable: true
server: server:
host:
from_secret: host
user:
from_secret: user
password:
from_secret: password
host:
from_secret: host
user:
from_secret: user
password:
from_secret: password
steps: steps:
- name: release
commands:
- cd /mnt/md0/infra/homeassistant
- git pull
- make restart
- make check
- name: release
commands:
- cd /mnt/md0/infra/homeassistant
- git pull
- make restart
- make check
trigger: trigger:
branch:
- master
event:
- push
branch:
- master
event:
- push
...

10
.editorconfig

@ -1,10 +1,10 @@
root = true root = true
[*] [*]
end_of_line = lf
insert_final_newline = true
charset = utf-8 charset = utf-8
[*.json]
end_of_line = lf
indent_style = space indent_style = space
indent_size = 4
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100

31
Makefile

@ -1,15 +1,38 @@
MAKEFLAGS += --silent MAKEFLAGS += --silent
.PHONY: * .PHONY: *
REGISTRY=registry.fedy95.com
YAMLLINT_TAG=baseimage-yamllint:latest
JSONLINT_TAG=baseimage-jsonlint:latest
lint: lint-yaml lint-json
LINT-YAML-CMD=docker run --rm -it -v $(PWD):/data ${REGISTRY}/${YAMLLINT_TAG}
lint-yaml:
docker pull ${REGISTRY}/${YAMLLINT_TAG}
$(LINT-YAML-CMD) etc/config/blueprints/automation/homeassistant/motion_light.yaml
$(LINT-YAML-CMD) etc/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml
$(LINT-YAML-CMD) etc/config/custom_components/circadian_lighting/services.yaml
$(LINT-YAML-CMD) etc/config/automations.yaml
$(LINT-YAML-CMD) etc/config/configuration.yaml
$(LINT-YAML-CMD) etc/config/groups.yaml
$(LINT-YAML-CMD) etc/config/recorder.yaml
$(LINT-YAML-CMD) etc/config/scenes.yaml
$(LINT-YAML-CMD) etc/config/scripts.yaml
$(LINT-YAML-CMD) docker-compose.yml
LINT-JSON-CMD=docker run --rm -it -v $(PWD):/data ${REGISTRY}/${JSONLINT_TAG}
lint-json:
docker pull ${REGISTRY}/${JSONLINT_TAG}
$(LINT-JSON-CMD) -qc etc/config/custom_components/circadian_lighting/manifest.json
restart: down start
start: start:
docker-compose -f docker-compose.yml up -d docker-compose -f docker-compose.yml up -d
down: down:
docker-compose -f docker-compose.yml down docker-compose -f docker-compose.yml down
restart: down start
check: check:
docker exec homeassistant_instance python -m homeassistant --script check_config --config /config docker exec homeassistant_instance python -m homeassistant --script check_config --config /config
.DEFAULT_GOAL := restart
.DEFAULT_GOAL := lint

2
docker-compose.yml

@ -1,3 +1,4 @@
---
version: "3" version: "3"
services: services:
@ -27,3 +28,4 @@ services:
volumes: volumes:
- ./etc/homeassistant_db/data:/var/lib/mysql - ./etc/homeassistant_db/data:/var/lib/mysql
...

4
etc/config/automations.yaml

@ -1 +1,3 @@
[]
---
[ ]
...

2
etc/config/blueprints/automation/homeassistant/motion_light.yaml

@ -1,3 +1,4 @@
---
blueprint: blueprint:
name: Motion-activated Light name: Motion-activated Light
description: Turn on a light when motion is detected. description: Turn on a light when motion is detected.
@ -48,3 +49,4 @@ action:
- delay: !input no_motion_wait - delay: !input no_motion_wait
- service: light.turn_off - service: light.turn_off
target: !input light_target target: !input light_target
...

2
etc/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml

@ -1,3 +1,4 @@
---
blueprint: blueprint:
name: Zone Notification name: Zone Notification
description: Send a notification to a device when a person leaves a specific zone. description: Send a notification to a device when a person leaves a specific zone.
@ -41,3 +42,4 @@ action:
type: notify type: notify
device_id: !input notify_device device_id: !input notify_device
message: "{{ person_name }} has left {{ zone_state }}" message: "{{ person_name }} has left {{ zone_state }}"
...

124
etc/config/configuration.yaml

@ -1,18 +1,19 @@
---
homeassistant: homeassistant:
name: Home Assistant KR
latitude: !secret latitude_home
longitude: !secret longitude_home
elevation: !secret elevation_home
temperature_unit: C
time_zone: Europe/Moscow
unit_system: metric
name: Home Assistant KR
latitude: !secret latitude_home
longitude: !secret longitude_home
elevation: !secret elevation_home
temperature_unit: C
time_zone: Europe/Moscow
unit_system: metric
zone: zone:
- name: Home
latitude: !secret latitude_home
longitude: !secret longitude_home
radius: 200
icon: mdi:home
- name: Home
latitude: !secret latitude_home
longitude: !secret longitude_home
radius: 200
icon: mdi:home
default_config: default_config:
@ -24,55 +25,55 @@ script: !include scripts.yaml
# https://www.home-assistant.io/integrations/yeelight # https://www.home-assistant.io/integrations/yeelight
yeelight: yeelight:
devices:
10.10.10.10:
name: Room unit0
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.11:
name: Room unit1
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.12:
name: Room unit2
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.13:
name: Room unit3
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.14:
name: Room unit4
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.15:
name: Room unit5
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.16:
name: Room unit6
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.17:
name: Room unit7
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
devices:
10.10.10.10:
name: Room unit0
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.11:
name: Room unit1
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.12:
name: Room unit2
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.13:
name: Room unit3
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.14:
name: Room unit4
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.15:
name: Room unit5
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.16:
name: Room unit6
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
10.10.10.17:
name: Room unit7
transition: 1000
use_music_mode: false
save_on_change: false
model: color4
# https://github.com/claytonjn/hass-circadian_lighting # https://github.com/claytonjn/hass-circadian_lighting
circadian_lighting: circadian_lighting:
@ -101,3 +102,4 @@ light:
- light.room_unit5 - light.room_unit5
- light.room_unit6 - light.room_unit6
- light.room_unit7 - light.room_unit7
...

8
etc/config/custom_components/circadian_lighting/manifest.json

@ -3,6 +3,10 @@
"name": "Circadian Lighting", "name": "Circadian Lighting",
"documentation": "https://github.com/claytonjn/hass-circadian_lighting", "documentation": "https://github.com/claytonjn/hass-circadian_lighting",
"dependencies": [], "dependencies": [],
"codeowners": ["@claytonjn"],
"requirements": ["timezonefinder==4.2.0"]
"codeowners": [
"@claytonjn"
],
"requirements": [
"timezonefinder==4.2.0"
]
} }

2
etc/config/custom_components/circadian_lighting/services.yaml

@ -1,2 +1,4 @@
---
values_update: values_update:
description: Updates values for Circadian Lighting. description: Updates values for Circadian Lighting.
...

2
etc/config/groups.yaml

@ -0,0 +1,2 @@
---
...

2
etc/config/recorder.yaml

@ -1 +1,3 @@
---
db_url: !secret recorder_db_url db_url: !secret recorder_db_url
...

2
etc/config/scenes.yaml

@ -0,0 +1,2 @@
---
...

2
etc/config/scripts.yaml

@ -0,0 +1,2 @@
---
...