From 65533b7dc4c70bc86068ba0e61e78519be070f17 Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Fri, 16 Aug 2024 14:29:38 +0300 Subject: [PATCH] Move svitlobot_8266.yaml to https://github.com/andrewjswan/svitlobot --- svitlobot_8266.yaml | 205 -------------------------------------------- 1 file changed, 205 deletions(-) delete mode 100644 svitlobot_8266.yaml diff --git a/svitlobot_8266.yaml b/svitlobot_8266.yaml deleted file mode 100644 index 71e2b5a..0000000 --- a/svitlobot_8266.yaml +++ /dev/null @@ -1,205 +0,0 @@ -substitutions: - name: "esp-svitlobot" - friendly_name: "Svitlo Bot" - project_name: "ajs.svitlobot" - project_version: "3.5.7" - comment: "ESPHome Svitlo Bot (8266)" - -esphome: - name: "${name}" - name_add_mac_suffix: true - comment: $comment - build_path: ./.build/$name - project: - name: "${project_name}" - version: "${project_version}" - -dashboard_import: - package_import_url: github://andrewjswan/esphome-config/svitlobot_8266.yaml@main - -esp8266: -# board: esp01_1m -# board: d1_mini - board: nodemcuv2 - restore_from_flash: true - -api: - reboot_timeout: 0s - -ota: - - platform: esphome - -logger: - level: INFO - -mdns: - disabled: false - -web_server: - port: 80 - log: false - version: 3 - -wifi: - ap: {} # This spawns an AP with the device name and mac address with no password. - -captive_portal: - -http_request: - useragent: "esphome/${name} (${project_version})" - verify_ssl: false - timeout: 10s - -globals: - - id: send_quality - type: int - restore_value: no - initial_value: '-1' - - - id: session - type: bool - restore_value: no - initial_value: 'false' - -script: - - id: send_state - then: - - if: - condition: - and: - - wifi.connected: - - lambda: 'return id(my_key).has_state();' - then: - - globals.set: - id: session - value: 'true' - - http_request.get: - url: !lambda |- - return ((std::string) "http://api.svitlobot.in.ua/channelPing?channel_key=" + id(my_key).state).c_str(); - on_response: - then: - - lambda: id(set_state)->execute(response->status_code, ""); - - globals.set: - id: session - value: 'false' - - if: - condition: - lambda: 'return id(session);' - then: - - script.execute: - id: set_state - code: -1 - response: "" - - component.update: quality - mode: queued - - - id: set_state - parameters: - code: int - response: string - then: - - lambda: |- - if (code == 200) - { - ESP_LOGD("SvitloBot", "Send status - success"); - id(send_status).publish_state(true); - id(send_quality) = id(send_quality) < 0 ? 100 : std::min(100, ++id(send_quality)); - } - else - { - if (code > 0) - { - ESP_LOGE("SvitloBot", "Send status - not success with response code: %d", code); - } - id(send_status).publish_state(false); - id(send_quality) = id(send_quality) < 0 ? 0 : std::max(0, --id(send_quality)); - } - mode: queued - -interval: - - interval: 1min - then: - - script.execute: send_state - -text: - - platform: template - name: "${friendly_name} Key" - id: my_key - optimistic: true - min_length: 0 - max_length: 15 - mode: text - restore_value: true - icon: mdi:key-chain-variant - entity_category: config - disabled_by_default: true - -binary_sensor: - - platform: template - name: "${friendly_name} Status" - id: send_status - icon: mdi:lan-connect - -sensor: - - platform: template - name: "${friendly_name} Delivery Quality" - id: quality - lambda: |- - if (!id(my_key).has_state() || id(send_quality) < 0) - { - return NAN; - } - return id(send_quality); - accuracy_decimals: 0 - unit_of_measurement: "%" - icon: mdi:wan - state_class: measurement - on_value_range: - - below: 90.0 - then: - - button.press: Restart - - - platform: uptime - name: "${friendly_name} Uptime" - entity_category: diagnostic - - - platform: wifi_signal - name: "${friendly_name} WiFi Signal" - entity_category: diagnostic - icon: mdi:signal - -button: - - platform: restart - name: "${friendly_name} Restart" - id: Restart - entity_category: diagnostic - icon: mdi:restart - - - platform: factory_reset - name: "${friendly_name} Restart with Factory Default Settings" - id: Reset - entity_category: diagnostic - disabled_by_default: true - -text_sensor: - - platform: version - name: ${friendly_name} ESPHome Version - hide_timestamp: true - entity_category: diagnostic - - - platform: wifi_info - ip_address: - name: "${friendly_name} IP Address" - disabled_by_default: true - entity_category: diagnostic - icon: mdi:ip - ssid: - name: "${friendly_name} Connected SSID" - disabled_by_default: true - entity_category: diagnostic - icon: mdi:access-point-network - mac_address: - name: "${friendly_name} Mac Address" - disabled_by_default: true - entity_category: diagnostic - icon: mdi:console-network