Add validation actions (#693)

* Add validation action

* Clean-up yaml

Removed trailing spaces

* Clean-up yaml

Removed trailing spaces

* Clean-up yaml

Removed trailing spaces

* Clean-up yaml

Removed trailing spaces

* Clean-up yaml

Removed trailing spaces

* Update validate_yaml.yml

* Validate on push

Only for nspanel_esphome.yaml and nspanel_blueprint.yaml

* Extending warnings for +255-char lines

* Update validate_yaml.yml

* Clean-up yaml

* Update validate_yaml.yml

* Clean-up yaml

* Clean-up yaml

* Clean-up yaml

* Clean-up yaml

* Clean-up yaml

* Update and rename validate_yaml.yml to validate_blueprint.yml

* Create validate_esphome.yml

* Clean-up yaml
This commit is contained in:
Edward Firmo
2023-04-19 13:16:28 +02:00
committed by GitHub
parent cf5829af8f
commit 60c43e99bd
8 changed files with 184 additions and 139 deletions

View File

@@ -0,0 +1,19 @@
name: Validate Blueprint YAML
on:
push:
paths:
- "nspanel_blueprint.yaml"
pull_request:
#schedule:
# - cron: "0 0 * * *"
workflow_dispatch:
jobs:
code_scan:
name: Validate Blueprint YAML
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Validate nspanel_blueprint.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_blueprint.yaml

19
.github/workflows/validate_esphome.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Validate ESPHome YAML
on:
push:
paths:
- "nspanel_esphome.yaml"
pull_request:
#schedule:
# - cron: "0 0 * * *"
workflow_dispatch:
jobs:
code_scan:
name: Validate Blueprint YAML
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Validate nspanel_esphome.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome.yaml

7
.yamllint/rules.yml Normal file
View File

@@ -0,0 +1,7 @@
extends: relaxed
rules:
# 255 chars should be enough, but don't fail if a line is longer
line-length:
max: 255
level: warning

View File

@@ -1,4 +1,4 @@
# Please insert into the default file "configuration.yaml # Please insert into the default file "configuration.yaml"
# Folder must be changed to the directory where the tft file (Nextion Editor) will be uploaded # Folder must be changed to the directory where the tft file (Nextion Editor) will be uploaded
########### ###########
# #

File diff suppressed because one or more lines are too long

View File

@@ -186,7 +186,7 @@ api:
message: string message: string
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: 'id(disp1).set_component_text_printf(component.c_str(), "%s", message.c_str());' - lambda: 'id(disp1).set_component_text_printf(component.c_str(), "%s", message.c_str());'
##### Service to send a command "component_value (Dualstate Button)" directly to the display ##### ##### Service to send a command "component_value (Dualstate Button)" directly to the display #####
@@ -196,7 +196,7 @@ api:
message: int message: int
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: 'id(disp1).set_component_value(component.c_str(), message);' - lambda: 'id(disp1).set_component_value(component.c_str(), message);'
##### Service to send a command "hide componente" directly to the display ##### ##### Service to send a command "hide componente" directly to the display #####
@@ -205,7 +205,7 @@ api:
component: string component: string
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: 'id(disp1).hide_component(component.c_str());' - lambda: 'id(disp1).hide_component(component.c_str());'
##### Service to send a command "show componente" directly to the display ##### ##### Service to send a command "show componente" directly to the display #####
@@ -214,14 +214,14 @@ api:
component: string component: string
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: 'id(disp1).show_component(component.c_str());' - lambda: 'id(disp1).show_component(component.c_str());'
##### Service to send a command "show ALL componente" directly to the display ##### ##### Service to send a command "show ALL componente" directly to the display #####
- service: send_command_show_all ### unused ### - service: send_command_show_all ### unused ###
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: 'id(disp1).show_component("255");' - lambda: 'id(disp1).show_component("255");'
##### Service to send a command "font color" directly to the display ##### ##### Service to send a command "font color" directly to the display #####
@@ -231,7 +231,7 @@ api:
message: int message: int
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: 'id(disp1).set_component_font_color(component.c_str(), message);' - lambda: 'id(disp1).set_component_font_color(component.c_str(), message);'
##### Service to send a command "background color" directly to the display ##### ##### Service to send a command "background color" directly to the display #####
@@ -241,7 +241,7 @@ api:
message: int message: int
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: 'id(disp1).set_component_background_color(component.c_str(), message);' - lambda: 'id(disp1).set_component_background_color(component.c_str(), message);'
##### Service to show a notification-message on the screen ##### ##### Service to show a notification-message on the screen #####
@@ -251,7 +251,7 @@ api:
text: string text: string
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: |- - lambda: |-
id(disp1).send_command_printf("page notification"); id(disp1).send_command_printf("page notification");
id(disp1).set_component_text_printf("notification.notifi_label", "%s", label.c_str()); id(disp1).set_component_text_printf("notification.notifi_label", "%s", label.c_str());
@@ -269,7 +269,7 @@ api:
- service: notification_clear - service: notification_clear
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: |- - lambda: |-
id(notification_label).publish_state(""); id(notification_label).publish_state("");
id(notification_text).publish_state(""); id(notification_text).publish_state("");
@@ -300,7 +300,7 @@ api:
qrdata: string qrdata: string
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: |- - lambda: |-
id(disp1).send_command_printf("page qrcode"); id(disp1).send_command_printf("page qrcode");
id(disp1).set_component_text_printf("qrcode.qrcode_value", "%s", qrdata.c_str()); id(disp1).set_component_text_printf("qrcode.qrcode_value", "%s", qrdata.c_str());
@@ -311,7 +311,7 @@ api:
value: float value: float
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: |- - lambda: |-
//ESP_LOGD("nextion", "thermostat sendig value %f", value); //ESP_LOGD("nextion", "thermostat sendig value %f", value);
int v = int(2 * std::min(std::max(value - 13.5, 0.0), 5.0)); int v = int(2 * std::min(std::max(value - 13.5, 0.0), 5.0));
@@ -345,7 +345,7 @@ api:
btn_bri_txt: string btn_bri_txt: string
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: |- - lambda: |-
// ESP_LOGD("nextion", "set button %s", btn_id.c_str()); // ESP_LOGD("nextion", "set button %s", btn_id.c_str());
std::string btnicon = btn_id.c_str() + std::string("icon"); std::string btnicon = btn_id.c_str() + std::string("icon");
@@ -375,7 +375,7 @@ api:
ent_value: string ent_value: string
then: then:
- wait_until: - wait_until:
switch.is_on: nextion_init switch.is_on: nextion_init
- lambda: |- - lambda: |-
// ESP_LOGD("nextion", "set entity %s", ent_id.c_str()); // ESP_LOGD("nextion", "set entity %s", ent_id.c_str());
std::string enticon = ent_id.c_str() + std::string("_pic"); std::string enticon = ent_id.c_str() + std::string("_pic");
@@ -429,9 +429,9 @@ binary_sensor:
- if: - if:
condition: condition:
and: and:
- switch.is_on: relay1_fallback - switch.is_on: relay1_fallback
- not: - not:
api.connected: api.connected:
then: then:
- switch.toggle: relay_1 - switch.toggle: relay_1
- if: - if:
@@ -457,9 +457,9 @@ binary_sensor:
- if: - if:
condition: condition:
and: and:
- switch.is_on: relay2_fallback - switch.is_on: relay2_fallback
- not: - not:
api.connected: api.connected:
then: then:
- switch.toggle: relay_2 - switch.toggle: relay_2
- if: - if:
@@ -744,15 +744,15 @@ switch:
on_turn_off: on_turn_off:
- lambda: id(disp1).send_command_printf("home.sleepmodus.val=0"); - lambda: id(disp1).send_command_printf("home.sleepmodus.val=0");
- globals.set: - globals.set:
id: sleep_modus_global id: sleep_modus_global
value: '0' value: '0'
- lambda: id(disp1).set_component_value("settings.bt1",0); - lambda: id(disp1).set_component_value("settings.bt1",0);
on_turn_on: on_turn_on:
- lambda: id(disp1).send_command_printf("home.sleepmodus.val=1"); - lambda: id(disp1).send_command_printf("home.sleepmodus.val=1");
- globals.set: - globals.set:
id: sleep_modus_global id: sleep_modus_global
value: '1' value: '1'
- lambda: id(disp1).set_component_value("settings.bt1",1); - lambda: id(disp1).set_component_value("settings.bt1",1);
##### Relay Local control Fallback ##### ##### Relay Local control Fallback #####
- platform: template - platform: template