diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index c497427..4b91d8e 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -122,13 +122,13 @@ uart: ##### START - BUTTON CONFIGURATION ##### button: ###### REBOOT BUTTON ##### - - platform: restart - name: ${device_name} Restart + - name: ${device_name} Restart + platform: restart id: restart_nspanel ##### UPDATE TFT DISPLAY ##### - - platform: template - name: ${device_name} Update TFT display + - name: ${device_name} Update TFT display + platform: template icon: mdi:file-sync id: tft_update entity_category: config @@ -138,8 +138,8 @@ button: - lambda: id(disp1).upload_tft(); ##### EXIT REPARSE TFT DISPLAY ##### - - platform: template - name: ${device_name} Exit reparse + - name: ${device_name} Exit reparse + platform: template icon: mdi:file-sync id: tft_reparse_off entity_category: config @@ -419,8 +419,8 @@ globals: binary_sensor: ###### LEFT BUTTON BELOW DISPLAY TO TOGGLE RELAY##### - - platform: gpio - name: ${device_name} Left Button + - name: ${device_name} Left Button + platform: gpio id: left_button pin: number: 14 @@ -445,10 +445,9 @@ binary_sensor: - lambda: id(disp1).send_command_printf("home.left_bt_pic.pic=77"); - lambda: id(disp1).send_command_printf("home.icon_top_01","\U0000FFFF"); - ##### RIGHT BUTTON BELOW DISPLAY TO TOGGLE RELAY ##### - - platform: gpio - name: ${device_name} Right Button + - name: ${device_name} Right Button + platform: gpio id: right_button pin: number: 27 @@ -474,8 +473,8 @@ binary_sensor: - lambda: id(disp1).send_command_printf("home.icon_top_02","\U0000FFFF"); ##### JUMP PAGE TO SETTING PAGE ##### - - platform: nextion - name: $device_name setting page + - name: $device_name setting page + platform: nextion page_id: 0 component_id: 52 internal: true @@ -486,8 +485,8 @@ binary_sensor: - lambda: 'id(disp1).send_command_printf("page settings");' ##### Restart NSPanel Button - Setting Page ##### - - platform: nextion - name: ${device_name} Restart + - name: ${device_name} Restart + platform: nextion page_id: 7 component_id: 13 internal: true @@ -495,8 +494,8 @@ binary_sensor: - button.press: restart_nspanel ##### Restart NSPanel Button - Boot Page ##### - - platform: nextion - name: ${device_name} Restart + - name: ${device_name} Restart + platform: nextion page_id: 8 component_id: 4 internal: true @@ -504,8 +503,8 @@ binary_sensor: - button.press: restart_nspanel ##### Sleep Modus NSPanel Button ##### - - platform: nextion - name: ${device_name} Sleep Modus + - name: ${device_name} Sleep Modus + platform: nextion page_id: 7 component_id: 14 internal: true @@ -516,13 +515,13 @@ binary_sensor: sensor: ##### Uptime ##### - - platform: uptime - name: ${device_name} uptime + - name: ${device_name} uptime + platform: uptime disabled_by_default: true ##### WIFI Signal stregth - - platform: wifi_signal - name: ${device_name} RSSI + - name: ${device_name} RSSI + platform: wifi_signal update_interval: 60s on_value: - if: @@ -534,22 +533,22 @@ sensor: - lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\U0000FFFF"); ##### INTERNAL TEMPERATURE SENSOR, ADC VALUE ##### - - platform: adc - id: ntc_source + - id: ntc_source + platform: adc pin: 38 update_interval: 60s attenuation: 11db ##### INTERNAL TEMPERATURE SENSOR, adc reading converted to resistance (calculation)##### - - platform: resistance - id: resistance_sensor + - id: resistance_sensor + platform: resistance sensor: ntc_source configuration: DOWNSTREAM resistor: 11.2kOhm ##### INTERNAL TEMPERATURE SENSOR, resistance to temperature (calculation) ##### - - platform: ntc - name: ${device_name} Temperature + - name: ${device_name} Temperature + platform: ntc id: temp_nspanel sensor: resistance_sensor calibration: @@ -566,16 +565,16 @@ sensor: # - lambda: id(disp1).set_component_text_printf("climate.current_temp", "%.1f", id(temp_nspanel).state); ##### current value of page-climate target_temp ##### - - platform: template - name: ${device_name} Display Target Temperature + - name: ${device_name} Display Target Temperature + platform: template id: display_target_temp lambda: return {}; update_interval: 10s ###### Display Brightness GET VALUE FROM NSPanel SLIDER ##### - - platform: nextion + - name: ${device_name} brightness Slider + platform: nextion id: brightslider - name: ${device_name} brightness Slider variable_name: brightslider internal: true on_value: @@ -589,9 +588,9 @@ sensor: - lambda: id(disp1).set_component_text_printf("settings.a03", "%i", id(display_brightness_global)); ###### Display DIM Brightness GET VALUE FROM NSPanel SLIDER ##### - - platform: nextion + - name: ${device_name} dim brightness slider + platform: nextion id: dimslider - name: ${device_name} dim brightness slider variable_name: dimslider internal: true on_value: @@ -624,22 +623,22 @@ text_sensor: name: ${device_name} BSSID disabled_by_default: true - - platform: template - name: ${device_name} Notification Label + - name: ${device_name} Notification Label + platform: template id: notification_label - - platform: template - name: ${device_name} Notification Text + - name: ${device_name} Notification Text + platform: template id: notification_text - - platform: template - name: ${device_name} Settings Entity + - name: ${device_name} Settings Entity + platform: template id: settings_entity ##### NSPanel event sensor, the main action sensor - push to HA ##### - - platform: nextion + - name: ${device_name} NSPanel event + platform: nextion nextion_id: disp1 - name: ${device_name} NSPanel event id: disp1_nspanel_event component_name: nspanelevent internal: false @@ -654,10 +653,10 @@ text_sensor: id(page_timer)->execute(int(id(page_timeout).state)); ##### touchevent sensor, Reset the page timeout ##### - - platform: nextion + - id: disp1_touchevent + platform: nextion nextion_id: disp1 #name: ${device_name} touchevent - id: disp1_touchevent component_name: touchevent internal: true filters: @@ -674,8 +673,8 @@ text_sensor: switch: ##### global variable to keep track on whether the Nextion display is ready or not. Delays initial info from HA to the display ##### - - platform: template - name: ${device_name} Nextion inited + - name: ${device_name} Nextion inited + platform: template id: nextion_init entity_category: config restore_state: false @@ -683,46 +682,46 @@ switch: optimistic: true ##### Notification unread ##### - - platform: template - name: ${device_name} Notification unread + - name: ${device_name} Notification unread + platform: template id: notification_unread entity_category: config restore_state: true optimistic: true ##### Notification sound ##### - - platform: template - name: ${device_name} Notification sound + - name: ${device_name} Notification sound + platform: template id: notification_sound entity_category: config restore_state: true optimistic: true ##### Confirmation Message ##### - - platform: template - name: ${device_name} Confirmation Message + - name: ${device_name} Confirmation Message + platform: template id: confirmation_message entity_category: config restore_state: false optimistic: true ##### PHYSICAL SWITCH 1 ##### - - platform: gpio - name: ${device_name} Relay 1 + - name: ${device_name} Relay 1 + platform: gpio id: relay_1 pin: number: 22 ##### PHYSICAL SWITCH 2 ###### - - platform: gpio - name: ${device_name} Relay 2 + - name: ${device_name} Relay 2 + platform: gpio id: relay_2 pin: number: 19 ##### DISPLAY ALWAYS ON ##### - - platform: gpio - name: ${device_name} Screen Power + - name: ${device_name} Screen Power + platform: gpio id: screen_power entity_category: config pin: @@ -732,9 +731,9 @@ switch: internal: true ##### Switch Display Sleep Modus ##### - - platform: template + - name: ${device_name} Sleep Modus + platform: template device_class: switch - name: ${device_name} Sleep Modus id: sleep_modus entity_category: config restore_state: true @@ -754,15 +753,15 @@ switch: - lambda: id(disp1).set_component_value("settings.bt1",1); ##### Relay Local control Fallback ##### - - platform: template - name: ${device_name} Relay 1 Local Fallback + - name: ${device_name} Relay 1 Local Fallback + platform: template id: relay1_fallback entity_category: config restore_state: true optimistic: true - - platform: template - name: ${device_name} Relay 2 Local Fallback + - name: ${device_name} Relay 2 Local Fallback + platform: template id: relay2_fallback entity_category: config restore_state: true @@ -839,8 +838,8 @@ number: ##### START - DISPLAY START CONFIGURATION ##### display: - - platform: nextion - id: disp1 + - id: disp1 + platform: nextion uart_id: tf_uart tft_url: ${nextion_update_url} on_setup: