arcnmx / home

my $HOME 2
9 stars 2 forks source link

feat: generic / esp8266-generic / ... #38

Closed kittywitch closed 1 year ago

kittywitch commented 1 year ago

Generic ESPHome configs

arcnmx commented 1 year ago
--- confout-orig.yaml   2022-10-16 17:18:56.572039589 -0700
+++ confout-kat2.yaml   2022-10-16 17:11:54.283666432 -0700
@@ -1,6 +1,13 @@
 esphome:
   name: s31-001
-  build_path: .esphome/build/s31-001
+  build_path: ../build/s31-001
   platformio_options: {}
   includes: []
   libraries: []
@@ -15,8 +22,8 @@
   early_pin_init: true
   board_flash_mode: dout
 wifi:
-  domain: .local
-  fast_connect: false
+  domain: !secret 'local_domain'
+  fast_connect: true
   reboot_timeout: 15min
   power_save_mode: NONE
   output_power: 20.0
@@ -42,15 +49,28 @@
   update_interval: 15min
 logger:
   level: DEBUG
-  baud_rate: 0
+  baud_rate: 115200
   tx_buffer_size: 512
   deassert_rts_dtr: false
   hardware_uart: UART0
   logs: {}
   esp8266_store_log_strings_in_flash: true
+button:
+- platform: restart
+  name: S31 001 Restart
+  disabled_by_default: false
+  entity_category: config
+  device_class: restart
+text_sensor:
+- platform: template
+  name: S31 001 Uptime
+  id: uptime_human
+  icon: mdi:clock-start
+  disabled_by_default: false
+  update_interval: 60s
 binary_sensor:
 - platform: status
-  name: S31-001 WiFi Status
+  name: S31 001 Status
   disabled_by_default: false
   entity_category: diagnostic
   device_class: connectivity
@@ -65,7 +85,7 @@
       open_drain: false
       pulldown: false
     inverted: true
-  name: S31-001 Button
+  name: S31 001 Button
   on_press:
   - then:
     - switch.toggle:
@@ -73,7 +93,7 @@
   disabled_by_default: false
 sensor:
 - platform: wifi_signal
-  name: S31-001 WiFi Signal
+  name: S31 001 Signal
   update_interval: 60s
   disabled_by_default: false
   force_update: false
@@ -82,9 +102,38 @@
   device_class: signal_strength
   state_class: measurement
   entity_category: diagnostic
+- platform: uptime
+  name: S31 001 Uptime Seconds
+  id: uptime_sensor
+  update_interval: 60s
+  on_raw_value:
+  - then:
+    - text_sensor.template.publish:
+        id: uptime_human
+        state: !lambda |-
+          int seconds = round(id(uptime_sensor).raw_state);
+          int days = seconds / (24 * 3600);
+          seconds = seconds % (24 * 3600);
+          int hours = seconds / 3600;
+          seconds = seconds % 3600;
+          int minutes = seconds /  60;
+          seconds = seconds % 60;
+          return (
+            (days ? to_string(days) + "d " : "") +
+            (hours ? to_string(hours) + "h " : "") +
+            (minutes ? to_string(minutes) + "m " : "") +
+            (to_string(seconds) + "s")
+          ).c_str();
+  disabled_by_default: false
+  force_update: false
+  unit_of_measurement: s
+  icon: mdi:timer-outline
+  accuracy_decimals: 0
+  state_class: total_increasing
+  entity_category: diagnostic
 - platform: cse7766
   current:
-    name: S31-001 Current
+    name: S31 001 Current
     accuracy_decimals: 1
     disabled_by_default: false
     force_update: false
@@ -92,7 +141,7 @@
     device_class: current
     state_class: measurement
   voltage:
-    name: S31-001 Voltage
+    name: S31 001 Voltage
     accuracy_decimals: 1
     disabled_by_default: false
     force_update: false
@@ -100,7 +149,7 @@
     device_class: voltage
     state_class: measurement
   power:
-    name: S31-001 Power
+    name: S31 001 Power
     accuracy_decimals: 1
     id: s31_power
     disabled_by_default: false
@@ -110,7 +159,7 @@
     state_class: measurement
   update_interval: 60s
 - platform: total_daily_energy
-  name: S31-001 Daily Energy
+  name: S31 001 Daily Energy
   power_id: s31_power
   disabled_by_default: false
   force_update: false
@@ -138,7 +187,7 @@
   parity: NONE
 switch:
 - platform: gpio
-  name: S31-001 Relay
+  name: S31 001 Relay
   pin:
     number: 12
     mode:
arcnmx commented 1 year ago

just https://github.com/arcnmx/home/pull/38#discussion_r996526411 left I think?