Skip to content

Commit

Permalink
Add sonoff-s20 template and wifi_signal status diagnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
untergeek committed Oct 30, 2024
1 parent 152c329 commit c4611f8
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
44 changes: 44 additions & 0 deletions template/sonoff-s20.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
# We track the project name and version here in the template
packages:
main: !include
file: ../esphome.yaml
vars:
project_name: untergeek.sonoff-s20
project_version: 1.0.0
chip: !include
file: ../esp8266.yaml
vars:
board: esp01_1m
sync: !include ../time.yaml
togl: !include ../restart_switch.yaml
logs: !include ../logging.yaml
sgnl: !include ../wifi_signal.yaml

substitutions:
device_id: relay
icon: mdi:power-socket-us

binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: Button
on_press:
- switch.toggle: ${device_id}
- platform: status
name: Status

switch:
- platform: gpio
name: Switch
pin: GPIO12
id: ${device_id}
restore_mode: ${restore}

status_led:
pin:
number: GPIO13
inverted: true
16 changes: 16 additions & 0 deletions wifi_signal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
sensor:
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "WiFi Signal dB"
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"

- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_signal_db
name: "WiFi Signal Percent"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "Signal %"
entity_category: "diagnostic"
device_class: ""

0 comments on commit c4611f8

Please sign in to comment.