diff --git a/mcu-nspanel-bedroom.yaml b/mcu-nspanel-bedroom.yaml index f659fa3..4814f7f 100644 --- a/mcu-nspanel-bedroom.yaml +++ b/mcu-nspanel-bedroom.yaml @@ -5,10 +5,6 @@ substitutions: name_short: Bedroom area: Bedroom comment: NSPanel - panel_recv_topic: "tele/${device}/RESULT" - panel_send_topic: "cmnd/${device}/CustomSend" - tft_url: !secret tft_url - esphome: name: mcu-${device} @@ -20,6 +16,8 @@ esphome: - switch.turn_off: screen_power - delay: 1s - switch.turn_on: screen_power + - delay: 2s + - lambda: 'id(nspanel_id).set_display_dim(5, 80);' esp32: variant: esp32 @@ -33,15 +31,27 @@ esp32: external_components: - source: type: git - url: https://github.com/sairon/esphome-nspanel-lovelace-ui - ref: dev + url: https://github.com/randybb/esphome-nspanel-lovelace-native + ref: devices + refresh: 0s components: [nspanel_lovelace] packages: common: !include common/common.yaml +script: + - id: apply_sleep_dim + then: + - lambda: |- + uint8_t dim; + if (id(bedroom_lights).state) dim = 5; // sleepOverride + else if (id(sun_id).is_above_horizon(-6)) dim = 5; // day + else dim = 0; // night + id(nspanel_id).set_display_inactive_dim(dim); + api: - # https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h + homeassistant_services: true + homeassistant_states: true actions: - action: play_rtttl variables: @@ -56,110 +66,20 @@ api: message: string song: string then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' + - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);' - rtttl.play: rtttl: !lambda 'return song;' - - delay: 10s - - lambda: 'id(nspanel_id).send_custom_command("notify~~");' - - action: update_tft - then: - - lambda: |- - id(nspanel_id).upload_tft("${tft_url}"); - - - action: upload_tft - variables: - url: string - then: - - lambda: |- - id(nspanel_id).upload_tft(url); - - # Service to send a command directly to the display. Useful for testing - - action: send_command - variables: - cmd: string - then: - - lambda: "id(nspanel_id).send_custom_command(cmd.c_str());" - - # Service to pusblish to mqtt used for refreshin the panel - - action: publish_to_recv_topic - variables: - cmd: string - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: !lambda "return cmd;" - - # Service to send a command wake the screen - - action: wake - then: - - lambda: 'id(nspanel_id).send_custom_command("wake");' - - # Service to send a command to show screensaver (some of the values are hardcoded) - - action: show_screensaver - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: '{"CustomRecv":"event,sleepReached,cardGrid"}' - # Service to navigate to screen - - action: navigate_to_page - variables: - page: string - then: - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate." + page + ",button"; - - # Service to send a command disable screensaver - - action: disable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~0");' - - # Service to send a command enabled screensaver - - action: enable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~20");' - - # Service to send a command wake the screen - - action: dim_0_to_100 - variables: - intensity: string - then: - - lambda: 'id(nspanel_id).send_custom_command("dimmode~"+intensity+"~100");' - - # Service to send a command To show the screen of a specific like - - action: show_entity - variables: - entity: string - title: string - then: - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupLight~" + title + "~" + entity);' - - # Service to send a command To show the screen of a specific like - - action: notify_on_screensaver - variables: - line1: string - line2: string - then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + line1 + "~" + line2);' - - rtttl.play: "short:d=4,o=5,b=100:16e6" - - # Service to send a command To show the screen of a specific like - # interaction of the buttons are on implemented yet - action: notify_fullscreen variables: title: string description: string button1: string button2: string - time_secs: string + timeout: int + icon: string then: - # show notification screen - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupNotify");' - # set values on notification screen - # color defined as number created in binary and converted to decimal (rrrrggggbbbbaaaa) - - lambda: 'id(nspanel_id).send_custom_command("entityUpdateDetail~id~"+ title + "~65535~" + button1 +"~3840~" + button2 + "~61440~" + description + "~65535~" + time_secs);' + - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);' - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" uart: @@ -168,24 +88,59 @@ uart: rx_pin: 17 baud_rate: 115200 -mqtt: - id: mqtt_client - broker: !secret mqtt_ip - username: !secret mqtt_username - password: !secret mqtt_password - discovery: false - idf_send_async: true - reboot_timeout: 0s - nspanel_lovelace: id: nspanel_id - mqtt_recv_topic: $panel_recv_topic - mqtt_send_topic: $panel_send_topic + sleep_timeout: 10 + experimental_vertical_ui: true + locale: + language: sk + temperature_unit: celcius + screensaver: + time_id: ha_time + time_format: '%H:%M' + date_format: '%A, %d. %b. %Y' + weather: + entity_id: sensor.weather_forecast_daily + icon_color: [255, 255, 255] + entities: + - entity_id: sensor.zigbee_bedroom_temperature + icon: + value: home-thermometer-outline + color: [255, 255, 255] + precision: 1 + cards: + - type: cardGrid + title: Spálňa + entities: + - name: TV + entity_id: switch.mcu_socket_01_relay + icon: television-classic + - name: Raid + entity_id: switch.mcu_socket_02_relay + icon: emoticon-dead + - name: "" + entity_id: switch.mcu_socket_03_relay + icon: power-socket-fr + - name: Svetlo + entity_id: light.mcu_nspanel_bedroom_light + icon: wall-sconce-flat + - name: Nočná lampa J + entity_id: light.mcu_bedroom_lamp_right_light + icon: lamp + - name: Nočná lampa R + entity_id: light.mcu_bedroom_lamp_left_light + icon: lamp + + - type: cardThermo + title: Kúrenie + thermo_entity_id: climate.bt_trv_bedroom time: - platform: homeassistant id: ha_time timezone: Europe/Bratislava + on_time_sync: + - script.execute: apply_sleep_dim binary_sensor: - platform: gpio @@ -195,10 +150,7 @@ binary_sensor: inverted: true on_click: - light.toggle: light_1 - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; + - lambda: 'id(nspanel_id).render_default_page();' - platform: gpio name: Right Button @@ -212,10 +164,13 @@ binary_sensor: action: light.toggle data: entity_id: light.bedroom_lamps - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; + - lambda: 'id(nspanel_id).render_default_page();' + + - platform: homeassistant # sleepOverride + id: bedroom_lights + entity_id: light.bedroom_lights + on_state: + - script.execute: apply_sleep_dim light: - platform: binary @@ -237,6 +192,20 @@ output: # pin: # number: 19 +sun: + id: sun_id + time_id: ha_time + latitude: 48.15° + longitude: 17.11° + on_sunrise: + - elevation: -6° + then: + - script.execute: apply_sleep_dim + on_sunset: + - elevation: -6° + then: + - script.execute: apply_sleep_dim + switch: - platform: gpio name: Screen Power @@ -265,13 +234,19 @@ sensor: resistor: 11.2kOhm - platform: ntc + name: Temperature id: temperature sensor: resistance_sensor calibration: b_constant: 3950 reference_temperature: 25°C reference_resistance: 10kOhm - name: Temperature - - platform: template - id: room_temperature_id +text_sensor: + - platform: homeassistant + id: name_day + entity_id: sensor.nameday_sk + on_value: + - lambda: |- + id(nspanel_id).set_time_format("%H:%M~" + x); + id(nspanel_id).update_time(); diff --git a/mcu-nspanel-dev.yaml b/mcu-nspanel-dev.yaml index f2b9df2..bbad252 100644 --- a/mcu-nspanel-dev.yaml +++ b/mcu-nspanel-dev.yaml @@ -39,8 +39,6 @@ esp32: advanced: minimum_chip_revision: 3.0 sram1_as_iram: true - include_builtin_idf_components: - - esp_http_client external_components: # - source: @@ -51,8 +49,10 @@ external_components: # components: [nspanel_lovelace] - source: type: git - url: https://github.com/olicooper/esphome-nspanel-lovelace-native - ref: dev + # url: https://github.com/olicooper/esphome-nspanel-lovelace-native + # ref: dev + url: https://github.com/randybb/esphome-nspanel-lovelace-native + ref: devices refresh: 0s components: [nspanel_lovelace] # - source: components @@ -84,7 +84,6 @@ api: song: string then: - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);' - # - lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' - rtttl.play: rtttl: !lambda 'return song;' # - delay: 10s @@ -203,15 +202,37 @@ uart: nspanel_lovelace: id: nspanel_id sleep_timeout: 10 + experimental_vertical_ui: true locale: language: sk temperature_unit: celcius screensaver: time_id: ha_time - time_format: '%H:%M~$name_day' + time_format: '%H:%M' date_format: '%A, %d. %b. %Y' weather: entity_id: sensor.weather_forecast_daily + # entity_id: weather.openweathermap + # forecast_method: service + icon_color: [255, 255, 255] + entities: + - entity_id: sensor.zigbee_office_r_temperature + icon: + value: home-thermometer-outline + color: [255, 255, 255] + precision: 1 + # type: screensaver2 + ## Custom entities, filled into the layout slots in order after the weather items. + ## Use 'entity_id: delete' to leave a slot empty. + ## screensaver: weather main + 4 forecast items, 1 extra entity switches to the alternative layout (max 6 items) + ## screensaver2: weather main only, then 3 left + 6 bottom + 5 indicator icons (max 15 items) + # entities: + # - entity_id: sensor.outside_humidity + # name: Humidity + # icon: water-percent + # - entity_id: delete + # - entity_id: binary_sensor.front_door + # type: screensaver2 # statusIcon1: # entity: switch.office_r_light @@ -281,7 +302,7 @@ nspanel_lovelace: entity_id: light.living_room icon: ceiling-light - name: TV - entity_id: light.tv_light + entity_id: light.mcu_tv_light_light icon: led-strip-variant - name: (Stôl) entity_id: light.dining_table_ambilight @@ -293,7 +314,7 @@ nspanel_lovelace: title: Romanko entities: - name: Svetlo - entity_id: switch.office_r_light + entity_id: light.mcu_nspanel_office_r_light icon: wall-sconce-flat - name: LED pásik entity_id: light.office_r_desk_strip @@ -305,40 +326,38 @@ nspanel_lovelace: - name: (Monitor) entity_id: light.office_r_display_lamp_ambilight icon: monitor-star - - name: Whitebox - entity_id: switch.whitebox - type: cardGrid title: Von entities: - name: Terasa - entity_id: light.patio_light + entity_id: light.patio_lights icon: lightbulb-group - name: Terasa - entity_id: switch.patio_relay + entity_id: switch.mcu_patio_relay icon: power-socket-fr - name: Vzadu - entity_id: switch.outside_light_back + entity_id: switch.mcu_nspanel_patio_outside_light_back icon: light-flood-down - name: Z. domček - entity_id: switch.shed_light + entity_id: switch.mcu_shed_light icon: wall-sconce-flat # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' - name: Z. domček - entity_id: switch.shed_socket + entity_id: switch.mcu_shed_socket icon: power-socket-fr # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' - name: Záhrada - entity_id: switch.garden_light + entity_id: switch.mcu_shed_garden_light icon: light-flood-down # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' - type: cardGrid title: Brána entities: - name: Otvoriť - entity_id: button.gate_open + entity_id: button.mcu_gate_open icon: gate-open - name: Zatvoriť - entity_id: button.gate_close + entity_id: button.mcu_gate_close icon: gate - name: Automatizácia entity_id: navigate.card_gate_automation @@ -346,19 +365,19 @@ nspanel_lovelace: title: Závlaha entities: - name: A1 - entity_id: switch.irrigation_valve_a1 + entity_id: switch.mcu_well_irrigation_valve_a1 icon: valve - name: A2 - entity_id: switch.irrigation_valve_a2 + entity_id: switch.mcu_well_irrigation_valve_a2 icon: valve - name: A3 - entity_id: switch.irrigation_valve_a3 + entity_id: switch.mcu_well_irrigation_valve_a3 icon: valve - name: A4 - entity_id: switch.irrigation_valve_a4 + entity_id: switch.mcu_well_irrigation_valve_a4 icon: valve - name: A5 - entity_id: switch.irrigation_valve_a5 + entity_id: switch.mcu_well_irrigation_valve_a5 icon: valve - name: Automatizácia entity_id: navigate.card_irrigation_automation @@ -381,13 +400,13 @@ nspanel_lovelace: title: Zwift entities: - name: Svetlo - entity_id: light.basement_light + entity_id: light.mcu_basement_light icon: lightbulb-multiple - name: LED entity_id: light.exercise_room icon: led-strip-variant - name: Ventilátor - entity_id: light.exercise_room_fan + entity_id: light.mcu_dimmer_exercise_room_fan icon: fan - name: Automatizácia entity_id: navigate.card_exercise_automation @@ -421,11 +440,6 @@ nspanel_lovelace: - name: Rast trávy entity_id: automation.irrigation_grow_grass -time: - - platform: homeassistant - id: ha_time - timezone: Europe/Bratislava - binary_sensor: - platform: gpio name: Left Button @@ -526,10 +540,19 @@ sensor: - platform: template id: room_temperature_id +time: + platform: homeassistant + id: ha_time + timezone: Europe/Bratislava + text_sensor: - platform: homeassistant id: name_day entity_id: sensor.nameday_sk + on_value: + - lambda: |- + id(nspanel_id).set_time_format("%H:%M~" + x); + id(nspanel_id).update_time(); # esp32_ble_tracker: # scan_parameters: diff --git a/mcu-nspanel-fireplace.yaml b/mcu-nspanel-fireplace.yaml index 61454d1..139643a 100644 --- a/mcu-nspanel-fireplace.yaml +++ b/mcu-nspanel-fireplace.yaml @@ -4,9 +4,6 @@ substitutions: name: Fireplace NSPanel area: Living Room & Kitchen comment: NSPanel - panel_recv_topic: "tele/${device}/RESULT" - panel_send_topic: "cmnd/${device}/CustomSend" - tft_url: !secret tft_url esphome: name: mcu-${device} @@ -18,6 +15,8 @@ esphome: - switch.turn_off: screen_power - delay: 1s - switch.turn_on: screen_power + - delay: 2s + - lambda: 'id(nspanel_id).set_display_dim(5, 80);' esp32: variant: esp32 @@ -31,15 +30,17 @@ esp32: external_components: - source: type: git - url: https://github.com/sairon/esphome-nspanel-lovelace-ui - ref: dev + url: https://github.com/randybb/esphome-nspanel-lovelace-native + ref: devices + refresh: 0s components: [nspanel_lovelace] packages: common: !include common/common.yaml api: - # https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h + homeassistant_services: true + homeassistant_states: true actions: - action: play_rtttl variables: @@ -54,110 +55,20 @@ api: message: string song: string then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' + - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);' - rtttl.play: rtttl: !lambda 'return song;' - - delay: 10s - - lambda: 'id(nspanel_id).send_custom_command("notify~~");' - - action: update_tft - then: - - lambda: |- - id(nspanel_id).upload_tft("${tft_url}"); - - - action: upload_tft - variables: - url: string - then: - - lambda: |- - id(nspanel_id).upload_tft(url); - - # Service to send a command directly to the display. Useful for testing - - action: send_command - variables: - cmd: string - then: - - lambda: "id(nspanel_id).send_custom_command(cmd.c_str());" - - # Service to pusblish to mqtt used for refreshin the panel - - action: publish_to_recv_topic - variables: - cmd: string - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: !lambda "return cmd;" - - # Service to send a command wake the screen - - action: wake - then: - - lambda: 'id(nspanel_id).send_custom_command("wake");' - - # Service to send a command to show screensaver (some of the values are hardcoded) - - action: show_screensaver - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: '{"CustomRecv":"event,sleepReached,cardGrid"}' - # Service to navigate to screen - - action: navigate_to_page - variables: - page: string - then: - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate." + page + ",button"; - - # Service to send a command disable screensaver - - action: disable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~0");' - - # Service to send a command enabled screensaver - - action: enable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~20");' - - # Service to send a command wake the screen - - action: dim_0_to_100 - variables: - intensity: string - then: - - lambda: 'id(nspanel_id).send_custom_command("dimmode~"+intensity+"~100");' - - # Service to send a command To show the screen of a specific like - - action: show_entity - variables: - entity: string - title: string - then: - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupLight~" + title + "~" + entity);' - - # Service to send a command To show the screen of a specific like - - action: notify_on_screensaver - variables: - line1: string - line2: string - then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + line1 + "~" + line2);' - - rtttl.play: "short:d=4,o=5,b=100:16e6" - - # Service to send a command To show the screen of a specific like - # interaction of the buttons are on implemented yet - action: notify_fullscreen variables: title: string description: string button1: string button2: string - time_secs: string + timeout: int + icon: string then: - # show notification screen - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupNotify");' - # set values on notification screen - # color defined as number created in binary and converted to decimal (rrrrggggbbbbaaaa) - - lambda: 'id(nspanel_id).send_custom_command("entityUpdateDetail~id~"+ title + "~65535~" + button1 +"~3840~" + button2 + "~61440~" + description + "~65535~" + time_secs);' + - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);' - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" uart: @@ -166,19 +77,113 @@ uart: rx_pin: 17 baud_rate: 115200 -mqtt: - id: mqtt_client - broker: !secret mqtt_ip - username: !secret mqtt_username - password: !secret mqtt_password - discovery: false - idf_send_async: true - reboot_timeout: 0s - nspanel_lovelace: id: nspanel_id - mqtt_recv_topic: $panel_recv_topic - mqtt_send_topic: $panel_send_topic + sleep_timeout: 10 + experimental_vertical_ui: true + locale: + language: sk + temperature_unit: celcius + screensaver: + time_id: ha_time + time_format: '%H:%M' + date_format: '%A, %d. %b. %Y' + weather: + entity_id: sensor.weather_forecast_daily + icon_color: [255, 255, 255] + entities: + - entity_id: sensor.zigbee_living_room_kitchen_temperature + icon: + value: home-thermometer-outline + color: [255, 255, 255] + precision: 1 + cards: + - type: cardGrid + title: Kuchyňa / Obývačka + entities: + - name: Kuchyňa / Obývačka + entity_id: light.kitchen + icon: ceiling-light + - name: Stôl + entity_id: light.dining_table + icon: ceiling-light + - name: Gauč + entity_id: light.living_room + icon: ceiling-light + - name: TV + entity_id: light.mcu_tv_light_strip + icon: led-strip-variant + - name: (Stôl) + entity_id: light.dining_table_ambilight + icon: ceiling-light-multiple-outline + - name: (Gauč) + entity_id: light.living_room_ambilight + icon: ceiling-light-multiple-outline + + - type: cardGrid + title: Kuchyňa + entities: + - name: Linka + entity_id: light.worktop_lights + icon: countertop + - name: Sporák + entity_id: light.mcu_kitchen_stove + icon: stove + + - type: cardGrid + title: Von + entities: + - name: Terasa + entity_id: light.patio_lights + icon: lightbulb-group + - name: Terasa + entity_id: switch.mcu_patio_relay + icon: power-socket-fr + - name: Vzadu + entity_id: switch.mcu_nspanel_patio_outside_light_back + icon: light-flood-down + - name: Z. domček + entity_id: switch.mcu_shed_light + icon: wall-sconce-flat + # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' + - name: Z. domček + entity_id: switch.mcu_shed_socket + icon: power-socket-fr + # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' + - name: Záhrada + entity_id: switch.mcu_shed_garden_light + icon: light-flood-down + # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' + + - type: cardGrid + title: Brána + entities: + - name: Otvoriť + entity_id: button.mcu_gate_open + icon: gate-open + - name: Zatvoriť + entity_id: button.mcu_gate_close + icon: gate + - name: Automatizácia + entity_id: navigate.card_gate_automation + + - type: cardThermo + title: Kúrenie + thermo_entity_id: climate.bt_trv_living_room_kitchen + + - type: cardThermo + title: Kúrenie - Izba + thermo_entity_id: climate.bt_trv_room + + - type: cardEntities + title: Automatizácia + id: card_gate_automation + hidden: true + entities: + - name: Auto-otváranie + entity_id: switch.gate_auto_open + - name: Auto-zatváranie + entity_id: switch.gate_auto_close time: - platform: homeassistant @@ -200,10 +205,7 @@ binary_sensor: action: light.toggle data: entity_id: light.living_room - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; + - lambda: 'id(nspanel_id).render_default_page();' - min_length: 500ms max_length: 2000ms then: @@ -211,10 +213,8 @@ binary_sensor: action: light.toggle data: entity_id: light.worktop_lights - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_kitchen,button"; + - lambda: 'id(nspanel_id).render_default_page();' + - lambda: 'id(nspanel_id).render_next_page();' - platform: gpio name: Right Button @@ -230,10 +230,7 @@ binary_sensor: action: light.toggle data: entity_id: light.dining_table - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; + - lambda: 'id(nspanel_id).render_default_page();' - min_length: 500ms max_length: 2000ms then: @@ -241,10 +238,8 @@ binary_sensor: action: light.toggle data: entity_id: light.mcu_kitchen_stove - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_kitchen,button"; + - lambda: 'id(nspanel_id).render_default_page();' + - lambda: 'id(nspanel_id).render_next_page();' output: - platform: ledc id: buzzer_out @@ -292,13 +287,19 @@ sensor: resistor: 11.2kOhm - platform: ntc + name: "Living Room Temperature" id: temperature sensor: resistance_sensor calibration: b_constant: 3950 reference_temperature: 25°C reference_resistance: 10kOhm - name: "Living Room Temperature" - - platform: template - id: room_temperature_id +text_sensor: + - platform: homeassistant + id: name_day + entity_id: sensor.nameday_sk + on_value: + - lambda: |- + id(nspanel_id).set_time_format("%H:%M~" + x); + id(nspanel_id).update_time(); diff --git a/mcu-nspanel-office-j.yaml b/mcu-nspanel-office-j.yaml index 4320676..31e465b 100644 --- a/mcu-nspanel-office-j.yaml +++ b/mcu-nspanel-office-j.yaml @@ -4,10 +4,6 @@ substitutions: name: Office J NSPanel area: Office J comment: NSPanel - panel_recv_topic: "tele/${device}/RESULT" - panel_send_topic: "cmnd/${device}/CustomSend" - tft_url: !secret tft_url - esphome: name: mcu-${device} @@ -19,6 +15,8 @@ esphome: - switch.turn_off: screen_power - delay: 1s - switch.turn_on: screen_power + - delay: 2s + - lambda: 'id(nspanel_id).set_display_dim(5, 80);' esp32: variant: esp32 @@ -32,20 +30,17 @@ esp32: external_components: - source: type: git - url: https://github.com/sairon/esphome-nspanel-lovelace-ui - ref: dev + url: https://github.com/randybb/esphome-nspanel-lovelace-native + ref: devices + refresh: 0s components: [nspanel_lovelace] packages: common: !include common/common.yaml api: - # https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h - # - # stupnovane:d=4,o=6,b=180:c,e,g - # help:d=4,o=6,b=100:f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f - # gate_opening:d=16,o=5,b=160:a, 8p, a - # fireplace_attention:d=16,o=5,b=160:a, 8p, g, 16p, c + homeassistant_services: true + homeassistant_states: true actions: - action: play_rtttl variables: @@ -60,110 +55,20 @@ api: message: string song: string then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' + - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);' - rtttl.play: rtttl: !lambda 'return song;' - - delay: 10s - - lambda: 'id(nspanel_id).send_custom_command("notify~~");' - - action: update_tft - then: - - lambda: |- - id(nspanel_id).upload_tft("${tft_url}"); - - - action: upload_tft - variables: - url: string - then: - - lambda: |- - id(nspanel_id).upload_tft(url); - - # Service to send a command directly to the display. Useful for testing - - action: send_command - variables: - cmd: string - then: - - lambda: "id(nspanel_id).send_custom_command(cmd.c_str());" - - # Service to pusblish to mqtt used for refreshin the panel - - action: publish_to_recv_topic - variables: - cmd: string - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: !lambda "return cmd;" - - # Service to send a command wake the screen - - action: wake - then: - - lambda: 'id(nspanel_id).send_custom_command("wake");' - - # Service to send a command to show screensaver (some of the values are hardcoded) - - action: show_screensaver - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: '{"CustomRecv":"event,sleepReached,cardGrid"}' - # Service to navigate to screen - - action: navigate_to_page - variables: - page: string - then: - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate." + page + ",button"; - - # Service to send a command disable screensaver - - action: disable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~0");' - - # Service to send a command enabled screensaver - - action: enable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~20");' - - # Service to send a command wake the screen - - action: dim_0_to_100 - variables: - intensity: string - then: - - lambda: 'id(nspanel_id).send_custom_command("dimmode~"+intensity+"~100");' - - # Service to send a command To show the screen of a specific like - - action: show_entity - variables: - entity: string - title: string - then: - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupLight~" + title + "~" + entity);' - - # Service to send a command To show the screen of a specific like - - action: notify_on_screensaver - variables: - line1: string - line2: string - then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + line1 + "~" + line2);' - - rtttl.play: "short:d=4,o=5,b=100:16e6" - - # Service to send a command To show the screen of a specific like - # interaction of the buttons are on implemented yet - action: notify_fullscreen variables: title: string description: string button1: string button2: string - time_secs: string + timeout: int + icon: string then: - # show notification screen - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupNotify");' - # set values on notification screen - # color defined as number created in binary and converted to decimal (rrrrggggbbbbaaaa) - - lambda: 'id(nspanel_id).send_custom_command("entityUpdateDetail~id~"+ title + "~65535~" + button1 +"~3840~" + button2 + "~61440~" + description + "~65535~" + time_secs);' + - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);' - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" uart: @@ -172,19 +77,62 @@ uart: rx_pin: 17 baud_rate: 115200 -mqtt: - id: mqtt_client - broker: !secret mqtt_ip - username: !secret mqtt_username - password: !secret mqtt_password - discovery: false - idf_send_async: true - reboot_timeout: 0s - nspanel_lovelace: id: nspanel_id - mqtt_recv_topic: $panel_recv_topic - mqtt_send_topic: $panel_send_topic + sleep_timeout: 10 + experimental_vertical_ui: true + locale: + language: sk + temperature_unit: celcius + screensaver: + time_id: ha_time + time_format: '%H:%M' + date_format: '%A, %d. %b. %Y' + weather: + entity_id: sensor.weather_forecast_daily + icon_color: [255, 255, 255] + entities: + - entity_id: sensor.zigbee_office_j_temperature + icon: + value: home-thermometer-outline + color: [255, 255, 255] + precision: 1 + cards: + - type: cardGrid + title: Janko + entities: + - name: Svetlo + entity_id: light.mcu_nspanel_office_j_light + icon: wall-sconce-flat + - name: Nočná lampa + entity_id: light.bedside_left + icon: lamp + + - type: cardGrid + title: Brána + entities: + - name: Otvoriť + entity_id: button.mcu_gate_open + icon: gate-open + - name: Zatvoriť + entity_id: button.mcu_gate_close + icon: gate + - name: Automatizácia + entity_id: navigate.card_gate_automation + + - type: cardThermo + title: Kúrenie + thermo_entity_id: climate.bt_trv_office_j + + - type: cardEntities + title: Automatizácia + id: card_gate_automation + hidden: true + entities: + - name: Auto-otváranie + entity_id: switch.gate_auto_open + - name: Auto-zatváranie + entity_id: switch.gate_auto_close time: - platform: homeassistant @@ -192,26 +140,6 @@ time: timezone: Europe/Bratislava binary_sensor: - # - platform: gpio - # name: Left Button - # pin: - # number: 14 - # inverted: true - # on_click: - # - switch.toggle: relay_1 - - # - platform: gpio - # name: Right Button - # pin: - # number: 27 - # inverted: true - # # on_click: - # # - switch.toggle: relay_2 - # on_click: - # - homeassistant.service: - # service: light.toggle - # data: - # entity_id: light.office_r_desk_strip - platform: gpio name: Left Button pin: @@ -219,10 +147,7 @@ binary_sensor: inverted: true on_click: - light.toggle: light_1 - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; + - lambda: 'id(nspanel_id).render_default_page();' - platform: gpio name: Right Button @@ -234,16 +159,14 @@ binary_sensor: action: light.toggle data: entity_id: light.bedside_left - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; + - lambda: 'id(nspanel_id).render_default_page();' output: - platform: ledc id: buzzer_out pin: number: 21 + - id: relay_1 platform: gpio pin: @@ -283,28 +206,27 @@ sensor: pin: 38 update_interval: 5min attenuation: 12db + - platform: resistance id: resistance_sensor sensor: ntc_source configuration: DOWNSTREAM resistor: 11.2kOhm + - platform: ntc + name: Temperature id: temperature sensor: resistance_sensor calibration: b_constant: 3950 reference_temperature: 22°C reference_resistance: 10kOhm - name: Temperature - - platform: template - id: room_temperature_id -# esp32_ble_tracker: - -# text_sensor: -# - platform: ble_scanner -# name: BLE Scanner - -# esp32_ble_beacon: -# type: iBeacon -# uuid: '6d68252f-2e6f-b5b9-965f-43c0a3713880' +text_sensor: + - platform: homeassistant + id: name_day + entity_id: sensor.nameday_sk + on_value: + - lambda: |- + id(nspanel_id).set_time_format("%H:%M~" + x); + id(nspanel_id).update_time(); diff --git a/mcu-nspanel-office-r.yaml b/mcu-nspanel-office-r.yaml index af5eb2f..99b71c0 100644 --- a/mcu-nspanel-office-r.yaml +++ b/mcu-nspanel-office-r.yaml @@ -4,10 +4,6 @@ substitutions: name: Office R NSPanel area: Office R comment: NSPanel - panel_recv_topic: "tele/${device}/RESULT" - panel_send_topic: "cmnd/${device}/CustomSend" - tft_url: !secret tft_url - esphome: name: mcu-${device} @@ -19,6 +15,8 @@ esphome: - switch.turn_off: screen_power - delay: 1s - switch.turn_on: screen_power + - delay: 2s + - lambda: 'id(nspanel_id).set_display_dim(5, 80);' esp32: variant: esp32 @@ -26,15 +24,15 @@ esp32: framework: type: esp-idf advanced: - enable_lwip_mdns_queries: true minimum_chip_revision: 3.0 sram1_as_iram: true external_components: - source: type: git - url: https://github.com/sairon/esphome-nspanel-lovelace-ui - ref: dev + url: https://github.com/randybb/esphome-nspanel-lovelace-native + ref: devices + refresh: 0s components: [nspanel_lovelace] packages: @@ -58,12 +56,8 @@ script: - script.execute: geiger_click api: - # https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h - # - # stupnovane:d=4,o=6,b=180:c,e,g - # help:d=4,o=6,b=100:f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f,8p,f - # gate_opening:d=16,o=5,b=160:a, 8p, a - # fireplace_attention:d=16,o=5,b=160:a, 8p, g, 16p, c + homeassistant_services: true + homeassistant_states: true actions: - action: play_rtttl variables: @@ -78,111 +72,20 @@ api: message: string song: string then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' + - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);' - rtttl.play: rtttl: !lambda 'return song;' - - delay: 10s - - lambda: 'id(nspanel_id).send_custom_command("notify~~");' - - action: update_tft - then: - - logger.log: "tft updating from: ${tft_url}" - - lambda: |- - id(nspanel_id).upload_tft("${tft_url}"); - - - action: upload_tft - variables: - url: string - then: - - lambda: |- - id(nspanel_id).upload_tft(url); - - # Service to send a command directly to the display. Useful for testing - - action: send_command - variables: - cmd: string - then: - - lambda: "id(nspanel_id).send_custom_command(cmd.c_str());" - - # Service to pusblish to mqtt used for refreshin the panel - - action: publish_to_recv_topic - variables: - cmd: string - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: !lambda "return cmd;" - - # Service to send a command wake the screen - - action: wake - then: - - lambda: 'id(nspanel_id).send_custom_command("wake");' - - # Service to send a command to show screensaver (some of the values are hardcoded) - - action: show_screensaver - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: '{"CustomRecv":"event,sleepReached,cardGrid"}' - # Service to navigate to screen - - action: navigate_to_page - variables: - page: string - then: - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate." + page + ",button"; - - # Service to send a command disable screensaver - - action: disable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~0");' - - # Service to send a command enabled screensaver - - action: enable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~20");' - - # Service to send a command wake the screen - - action: dim_0_to_100 - variables: - intensity: string - then: - - lambda: 'id(nspanel_id).send_custom_command("dimmode~"+intensity+"~100");' - - # Service to send a command To show the screen of a specific like - - action: show_entity - variables: - entity: string - title: string - then: - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupLight~" + title + "~" + entity);' - - # Service to send a command To show the screen of a specific like - - action: notify_on_screensaver - variables: - line1: string - line2: string - then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + line1 + "~" + line2);' - - rtttl.play: "short:d=4,o=5,b=100:16e6" - - # Service to send a command To show the screen of a specific like - # interaction of the buttons are on implemented yet - action: notify_fullscreen variables: title: string description: string button1: string button2: string - time_secs: string + timeout: int + icon: string then: - # show notification screen - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupNotify");' - # set values on notification screen - # color defined as number created in binary and converted to decimal (rrrrggggbbbbaaaa) - - lambda: 'id(nspanel_id).send_custom_command("entityUpdateDetail~id~"+ title + "~65535~" + button1 +"~3840~" + button2 + "~61440~" + description + "~65535~" + time_secs);' + - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);' - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" uart: @@ -191,19 +94,69 @@ uart: rx_pin: 17 baud_rate: 115200 -mqtt: - id: mqtt_client - broker: !secret mqtt_ip - username: !secret mqtt_username - password: !secret mqtt_password - discovery: false - idf_send_async: true - reboot_timeout: 0s - nspanel_lovelace: id: nspanel_id - mqtt_recv_topic: $panel_recv_topic - mqtt_send_topic: $panel_send_topic + sleep_timeout: 10 + experimental_vertical_ui: true + locale: + language: sk + temperature_unit: celcius + screensaver: + time_id: ha_time + time_format: '%H:%M' + date_format: '%A, %d. %b. %Y' + weather: + entity_id: sensor.weather_forecast_daily + icon_color: [255, 255, 255] + entities: + - entity_id: sensor.zigbee_office_r_temperature + icon: + value: home-thermometer-outline + color: [255, 255, 255] + precision: 1 + cards: + - type: cardGrid + title: Romanko + entities: + - name: Svetlo + entity_id: light.mcu_nspanel_office_r_light + icon: wall-sconce-flat + - name: LED pásik + entity_id: light.office_r_desk_strip + icon: led-strip-variant + - entity_id: delete + - name: Monitor + entity_id: light.office_r_display_lamp + icon: monitor-star + - name: (Monitor) + entity_id: light.office_r_display_lamp_ambilight + icon: monitor-star + + - type: cardGrid + title: Brána + entities: + - name: Otvoriť + entity_id: button.mcu_gate_open + icon: gate-open + - name: Zatvoriť + entity_id: button.mcu_gate_close + icon: gate + - name: Automatizácia + entity_id: navigate.card_gate_automation + + - type: cardThermo + title: Kúrenie + thermo_entity_id: climate.bt_trv_office_r + + - type: cardEntities + title: Automatizácia + id: card_gate_automation + hidden: true + entities: + - name: Auto-otváranie + entity_id: switch.gate_auto_open + - name: Auto-zatváranie + entity_id: switch.gate_auto_close time: - platform: homeassistant @@ -211,26 +164,6 @@ time: timezone: Europe/Bratislava binary_sensor: - # - platform: gpio - # name: Left Button - # pin: - # number: 14 - # inverted: true - # on_click: - # - switch.toggle: relay_1 - - # - platform: gpio - # name: Right Button - # pin: - # number: 27 - # inverted: true - # # on_click: - # # - switch.toggle: relay_2 - # on_click: - # - homeassistant.service: - # service: light.toggle - # data: - # entity_id: light.office_r_desk_strip - platform: gpio name: Left Button pin: @@ -241,12 +174,8 @@ binary_sensor: action: light.toggle data: entity_id: light.office_r_desk_strip - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress1,navigate.cardGrid_main,button"; - # - lambda: 'id(nspanel_id).send_custom_command("event,buttonPress1,navigate.cardGrid_main,button");' - + - lambda: 'id(nspanel_id).render_default_page();' + - platform: gpio name: Right Button pin: @@ -254,11 +183,7 @@ binary_sensor: inverted: true on_click: - light.toggle: light_1 - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; - # - lambda: 'id(nspanel_id).send_custom_command("event,buttonPress2,navigate.cardGrid_main,button");' + - lambda: 'id(nspanel_id).render_default_page();' output: - platform: ledc @@ -281,7 +206,6 @@ light: channel_colors: GRB pin: 23 num_leds: 3 - # rmt_channel: 0 chipset: SK6812 effects: - pulse: @@ -298,16 +222,8 @@ light: id: light_1 output: relay_1 restore_mode: RESTORE_DEFAULT_OFF -# # - platform: binary -# # name: Relay 2 -# # output: relay_2 switch: - # - platform: gpio - # name: Light - # id: relay_1 - # pin: - # number: 22 - platform: gpio # name: Relay 2 id: relay_2 @@ -339,28 +255,27 @@ sensor: pin: 38 update_interval: 5min attenuation: 12db + - platform: resistance id: resistance_sensor sensor: ntc_source configuration: DOWNSTREAM resistor: 11.2kOhm + - platform: ntc + name: Temperature id: temperature sensor: resistance_sensor calibration: b_constant: 3950 reference_temperature: 22°C reference_resistance: 10kOhm - name: Temperature - - platform: template - id: room_temperature_id -# esp32_ble_tracker: - -# text_sensor: -# - platform: ble_scanner -# name: BLE Scanner - -# esp32_ble_beacon: -# type: iBeacon -# uuid: '6d68252f-2e6f-b5b9-965f-43c0a3713880' +text_sensor: + - platform: homeassistant + id: name_day + entity_id: sensor.nameday_sk + on_value: + - lambda: |- + id(nspanel_id).set_time_format("%H:%M~" + x); + id(nspanel_id).update_time(); diff --git a/mcu-nspanel-patio.yaml b/mcu-nspanel-patio.yaml index 990b04f..5f5f959 100644 --- a/mcu-nspanel-patio.yaml +++ b/mcu-nspanel-patio.yaml @@ -4,9 +4,6 @@ substitutions: name: Patio NSPanel area: Living Room & Kitchen comment: ${area}, Patio | NSPanel - panel_recv_topic: "tele/${device}/RESULT" - panel_send_topic: "cmnd/${device}/CustomSend" - tft_url: !secret tft_url esphome: name: mcu-${device} @@ -18,6 +15,8 @@ esphome: - switch.turn_off: screen_power - delay: 1s - switch.turn_on: screen_power + - delay: 2s + - lambda: 'id(nspanel_id).set_display_dim(5, 80);' esp32: variant: esp32 @@ -31,15 +30,17 @@ esp32: external_components: - source: type: git - url: https://github.com/sairon/esphome-nspanel-lovelace-ui - ref: dev + url: https://github.com/randybb/esphome-nspanel-lovelace-native + ref: devices + refresh: 0s components: [nspanel_lovelace] packages: common: !include common/common.yaml api: - # https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h + homeassistant_services: true + homeassistant_states: true actions: - action: play_rtttl variables: @@ -54,110 +55,20 @@ api: message: string song: string then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + heading + "~" + message);' + - lambda: 'id(nspanel_id).notify_on_screensaver(heading, message, 10000);' - rtttl.play: rtttl: !lambda 'return song;' - - delay: 10s - - lambda: 'id(nspanel_id).send_custom_command("notify~~");' - - action: update_tft - then: - - lambda: |- - id(nspanel_id).upload_tft("${tft_url}"); - - - action: upload_tft - variables: - url: string - then: - - lambda: |- - id(nspanel_id).upload_tft(url); - - # Service to send a command directly to the display. Useful for testing - - action: send_command - variables: - cmd: string - then: - - lambda: "id(nspanel_id).send_custom_command(cmd.c_str());" - - # Service to pusblish to mqtt used for refreshin the panel - - action: publish_to_recv_topic - variables: - cmd: string - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: !lambda "return cmd;" - - # Service to send a command wake the screen - - action: wake - then: - - lambda: 'id(nspanel_id).send_custom_command("wake");' - - # Service to send a command to show screensaver (some of the values are hardcoded) - - action: show_screensaver - then: - - mqtt.publish: - topic: $panel_recv_topic - payload: '{"CustomRecv":"event,sleepReached,cardGrid"}' - # Service to navigate to screen - - action: navigate_to_page - variables: - page: string - then: - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate." + page + ",button"; - - # Service to send a command disable screensaver - - action: disable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~0");' - - # Service to send a command enabled screensaver - - action: enable_screensaver - then: - - lambda: 'id(nspanel_id).send_custom_command("timeout~20");' - - # Service to send a command wake the screen - - action: dim_0_to_100 - variables: - intensity: string - then: - - lambda: 'id(nspanel_id).send_custom_command("dimmode~"+intensity+"~100");' - - # Service to send a command To show the screen of a specific like - - action: show_entity - variables: - entity: string - title: string - then: - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupLight~" + title + "~" + entity);' - - # Service to send a command To show the screen of a specific like - - action: notify_on_screensaver - variables: - line1: string - line2: string - then: - - lambda: 'id(nspanel_id).send_custom_command("notify~" + line1 + "~" + line2);' - - rtttl.play: "short:d=4,o=5,b=100:16e6" - - # Service to send a command To show the screen of a specific like - # interaction of the buttons are on implemented yet - action: notify_fullscreen variables: title: string description: string button1: string button2: string - time_secs: string + timeout: int + icon: string then: - # show notification screen - - lambda: 'id(nspanel_id).send_custom_command("pageType~popupNotify");' - # set values on notification screen - # color defined as number created in binary and converted to decimal (rrrrggggbbbbaaaa) - - lambda: 'id(nspanel_id).send_custom_command("entityUpdateDetail~id~"+ title + "~65535~" + button1 +"~3840~" + button2 + "~61440~" + description + "~65535~" + time_secs);' + - lambda: 'id(nspanel_id).notify_on_screensaver(title, description, timeout);' - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" uart: @@ -166,19 +77,142 @@ uart: rx_pin: 17 baud_rate: 115200 -mqtt: - id: mqtt_client - broker: !secret mqtt_ip - username: !secret mqtt_username - password: !secret mqtt_password - discovery: false - idf_send_async: true - reboot_timeout: 0s - nspanel_lovelace: id: nspanel_id - mqtt_recv_topic: $panel_recv_topic - mqtt_send_topic: $panel_send_topic + sleep_timeout: 10 + experimental_vertical_ui: true + locale: + language: sk + temperature_unit: celcius + screensaver: + time_id: ha_time + time_format: '%H:%M' + date_format: '%A, %d. %b. %Y' + weather: + entity_id: sensor.weather_forecast_daily + icon_color: [255, 255, 255] + entities: + - entity_id: sensor.zigbee_living_room_kitchen_temperature + icon: + value: home-thermometer-outline + color: [255, 255, 255] + precision: 1 + cards: + - type: cardGrid + title: Kuchyňa / Obývačka + entities: + - name: Kuchyňa / Obývačka + entity_id: light.kitchen + icon: ceiling-light + - name: Stôl + entity_id: light.dining_table + icon: ceiling-light + - name: Gauč + entity_id: light.living_room + icon: ceiling-light + - name: TV + entity_id: light.mcu_tv_light_strip + icon: led-strip-variant + - name: (Stôl) + entity_id: light.dining_table_ambilight + icon: ceiling-light-multiple-outline + - name: (Gauč) + entity_id: light.living_room_ambilight + icon: ceiling-light-multiple-outline + + - type: cardGrid + title: Kuchyňa + entities: + - name: Linka + entity_id: light.worktop_lights + icon: countertop + - name: Sporák + entity_id: light.mcu_kitchen_stove + icon: stove + + - type: cardGrid + title: Von + entities: + - name: Terasa + entity_id: light.patio_lights + icon: lightbulb-group + - name: Terasa + entity_id: switch.mcu_patio_relay + icon: power-socket-fr + - name: Vzadu + entity_id: switch.mcu_nspanel_patio_outside_light_back + icon: light-flood-down + - name: Z. domček + entity_id: switch.mcu_shed_light + icon: wall-sconce-flat + # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' + - name: Z. domček + entity_id: switch.mcu_shed_socket + icon: power-socket-fr + # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' + - name: Záhrada + entity_id: switch.mcu_shed_garden_light + icon: light-flood-down + # state_template: '{{ is_state("binary_sensor.shed_status", "off") }}' + + - type: cardGrid + title: Závlaha + entities: + - name: A1 + entity_id: switch.mcu_well_irrigation_valve_a1 + icon: valve + - name: A2 + entity_id: switch.mcu_well_irrigation_valve_a2 + icon: valve + - name: A3 + entity_id: switch.mcu_well_irrigation_valve_a3 + icon: valve + - name: A4 + entity_id: switch.mcu_well_irrigation_valve_a4 + icon: valve + - name: A5 + entity_id: switch.mcu_well_irrigation_valve_a5 + icon: valve + - name: Automatizácia + entity_id: navigate.card_irrigation_automation + + - type: cardGrid + title: Brána + entities: + - name: Otvoriť + entity_id: button.mcu_gate_open + icon: gate-open + - name: Zatvoriť + entity_id: button.mcu_gate_close + icon: gate + - name: Automatizácia + entity_id: navigate.card_gate_automation + + - type: cardThermo + title: Kúrenie + thermo_entity_id: climate.bt_trv_living_room_kitchen + + - type: cardEntities + title: Automatizácia + id: card_gate_automation + hidden: true + entities: + - name: Auto-otváranie + entity_id: switch.gate_auto_open + - name: Auto-zatváranie + entity_id: switch.gate_auto_close + + - type: cardEntities + title: Automatizácia + id: card_irrigation_automation + hidden: true + entities: + - name: Ráno + entity_id: automation.irrigation_morning + - name: Terasa + entity_id: automation.irrigation_patio + - name: Rast trávy + entity_id: automation.irrigation_grow_grass time: - platform: homeassistant @@ -193,10 +227,9 @@ binary_sensor: inverted: true on_click: - switch.toggle: relay_1 - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; + - lambda: 'id(nspanel_id).render_default_page();' + - lambda: 'id(nspanel_id).render_next_page();' + - lambda: 'id(nspanel_id).render_next_page();' - platform: gpio name: Right Button @@ -212,10 +245,9 @@ binary_sensor: action: light.toggle data: entity_id: light.patio_lights - - mqtt.publish_json: - topic: $panel_recv_topic - payload: |- - root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button"; + - lambda: 'id(nspanel_id).render_default_page();' + - lambda: 'id(nspanel_id).render_next_page();' + - lambda: 'id(nspanel_id).render_next_page();' else: - switch.toggle: relay_2 @@ -267,13 +299,19 @@ sensor: resistor: 11.2kOhm - platform: ntc + name: Living Room Temperature id: temperature sensor: resistance_sensor calibration: b_constant: 3950 reference_temperature: 25°C reference_resistance: 10kOhm - name: Living Room Temperature - - platform: template - id: room_temperature_id +text_sensor: + - platform: homeassistant + id: name_day + entity_id: sensor.nameday_sk + on_value: + - lambda: |- + id(nspanel_id).set_time_format("%H:%M~" + x); + id(nspanel_id).update_time();