diff --git a/433transmitter.yaml b/433transmitter.yaml index e3e4312..4ba9594 100644 --- a/433transmitter.yaml +++ b/433transmitter.yaml @@ -25,4 +25,3 @@ remote_receiver: # filter: 250us # idle: 4ms # buffer_size: 2kb - \ No newline at end of file diff --git a/console-fan.yaml b/console-fan.yaml index d3addaf..fa3050c 100644 --- a/console-fan.yaml +++ b/console-fan.yaml @@ -3,6 +3,14 @@ substitutions: esphome: name: console-fan-v2 + # includes: + # - pid_simulator.h + +custom_component: + - lambda: |- + auto *my_component = new esphome::pid::PIDSimulator(); + App.register_component(my_component); + return {my_component}; globals: - id: dhttemp @@ -12,7 +20,7 @@ globals: ######################### # ESP32 AND NETWORK SETUP - + esp32: board: nodemcu-32s framework: @@ -180,7 +188,9 @@ text_sensor: id: uptime_human icon: mdi:clock-start + sensor: + # Send WiFi signal strength & uptime to HA - platform: wifi_signal name: $friendly_name WiFi Strength diff --git a/ct-clamp.yaml b/ct-clamp.yaml new file mode 100644 index 0000000..4563090 --- /dev/null +++ b/ct-clamp.yaml @@ -0,0 +1,25 @@ +substitutions: + friendly_name: "CT clamp" + friendly_id: "ctclamp" + +packages: + device_base: !include device_base_esp32.yaml + +sensor: + - platform: ct_clamp + sensor: adc_sensor + name: "Measured Current" + id: current + sample_duration: 600ms + update_interval: 3000ms + filters: + - calibrate_linear: + - 0.012 -> 0 + - 0.025 -> 1.0 + + - platform: adc + pin: GPIO32 + id: adc_sensor + attenuation: 11db + # update_interval: never + update_interval: 3000ms \ No newline at end of file diff --git a/device_base_8266_esp07.yaml b/device_base_8266_esp07.yaml new file mode 100644 index 0000000..e4cec76 --- /dev/null +++ b/device_base_8266_esp07.yaml @@ -0,0 +1,16 @@ +esphome: + name: $friendly_id + +esp8266: + board: esp07 + + # board: nodemcuv2 + # platform = espressif8266 + + restore_from_flash: true + framework: + version: recommended + + + +logger: \ No newline at end of file diff --git a/device_base_8266_nodemcu.yaml b/device_base_8266_nodemcu.yaml index 0421500..9e664c1 100644 --- a/device_base_8266_nodemcu.yaml +++ b/device_base_8266_nodemcu.yaml @@ -1,6 +1,14 @@ +esphome: + name: $friendly_id + esp8266: board: nodemcuv2 + + # board: nodemcuv2 + # platform = espressif8266 + restore_from_flash: true framework: version: recommended - \ No newline at end of file + +logger: \ No newline at end of file diff --git a/device_base_esp32_nonetwork.yaml b/device_base_esp32_nonetwork.yaml index 5ea2681..505555a 100644 --- a/device_base_esp32_nonetwork.yaml +++ b/device_base_esp32_nonetwork.yaml @@ -1,70 +1,71 @@ esphome: name: $friendly_name platform: ESP32 - board: esp32dev + board: nodemcu-32s -wifi: - ssid: !secret wifi_ssid - password: !secret wifi_password +# wifi: +# ssid: !secret wifi_ssid +# password: !secret wifi_password logger: -api: -ota: -captive_portal: -switch: - - platform: restart - id: restart1 - name: $friendly_name ESP32 Restart +# api: +# ota: +# captive_portal: -time: -- platform: homeassistant - on_time: - # Every morning at 12:30am - - seconds: 0 - minutes: 30 - hours: 0 - then: - - switch.turn_on: restart1 +# switch: +# - platform: restart +# id: restart1 +# name: $friendly_name ESP32 Restart + +# time: +# - platform: homeassistant +# on_time: +# # Every morning at 12:30am +# - seconds: 0 +# minutes: 30 +# hours: 0 +# then: +# - switch.turn_on: restart1 -text_sensor: - # Send IP Address - - platform: wifi_info - ip_address: - name: "$friendly_name IP Address" +# text_sensor: +# # Send IP Address +# - platform: wifi_info +# ip_address: +# name: "$friendly_name IP Address" - # Send Uptime in raw seconds - - platform: template - name: $friendly_name Uptime - id: uptime_human - icon: mdi:clock-start +# # Send Uptime in raw seconds +# - platform: template +# name: $friendly_name Uptime +# id: uptime_human +# icon: mdi:clock-start -# Sensors that the ESPhome unit is capable of reporting -sensor: -- platform: wifi_signal - name: "$friendly_name WiFi Signal" - update_interval: 10min +# # Sensors that the ESPhome unit is capable of reporting +# sensor: +# - platform: wifi_signal +# name: "$friendly_name WiFi Signal" +# update_interval: 10min -- platform: uptime - internal: true - id: uptime_sensor - update_interval: 10min - on_raw_value: - then: - - text_sensor.template.publish: - id: uptime_human - # Custom C++ code to generate the result - 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(); \ No newline at end of file +# - platform: uptime +# internal: true +# id: uptime_sensor +# update_interval: 10min +# on_raw_value: +# then: +# - text_sensor.template.publish: +# id: uptime_human +# # Custom C++ code to generate the result +# 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(); \ No newline at end of file diff --git a/empty-esp32.yaml b/empty-esp32.yaml new file mode 100644 index 0000000..b8ad6f8 --- /dev/null +++ b/empty-esp32.yaml @@ -0,0 +1,6 @@ +substitutions: + friendly_name: "Test" + friendly_id: "test" + +packages: + device_base: !include device_base_esp32.yaml diff --git a/fumeextractor.yaml b/fumeextractor.yaml new file mode 100644 index 0000000..0939d93 --- /dev/null +++ b/fumeextractor.yaml @@ -0,0 +1,51 @@ +substitutions: + friendly_name: fumeextractor + friendly_id: fumeextractor + +packages: + # device_base: !include device_base_esp32_nonetwork.yaml + device_base: !include device_base_8266_nodemcu.yaml + + # ESP32 +# sensor: +# - platform: adc +# name: "fanpot" +# pin: GPIO2 +# accuracy_decimals: 2 +# update_interval: 100ms +# attenuation: auto +# filters: +# - calibrate_linear: +# - 0.075 -> 0.0 +# - 3.148 -> 3.3 +# - delta: 0.01 + +output: + - platform: esp8266_pwm + pin: D0 + id: fan + frequency: 25kHz + # inverted: false + # min_power: 0.01 + # max_power: 0.75 + +sensor: + - platform: adc + name: "fanpot" + id: fanpot + pin: A0 + raw: true + accuracy_decimals: 1 + update_interval: 100ms + # attenuation: auto + filters: + - calibrate_linear: + - 0 -> 0.0 + - 1024 -> 1000 + - delta: 10 + - multiply: 0.001 + on_value: + then: + - output.set_level: + id: fan + level: !lambda return id(fanpot).state; \ No newline at end of file diff --git a/garage-door.yaml b/garage-door.yaml index e373711..ace21a0 100644 --- a/garage-door.yaml +++ b/garage-door.yaml @@ -5,6 +5,14 @@ substitutions: packages: device_base: !include device_base_esp32.yaml +# Sensors: closed = magnetic, open = no presence. +# Top Sensor (measures door closed) +# Bottom Sensor (measures door is open) +# Top (closed) sensor is closed, DOOR IS CLOSED DOWN +# Bottom (open) sensor is closed, DOOR HAS OPENED UP +# Both sensors are open, DOOR IS MOVING +# Both sensors are closed, BUG, rare, they're both in contact. + cover: - platform: template name: "Garage Door v2" @@ -23,15 +31,15 @@ cover: stop_action: - switch.turn_on: garage_door_relay - optimistic: true - assumed_state: true + optimistic: false + assumed_state: false lambda: |- - if (id(garage_open_sensor).state) { + if (!id(garage_open_sensor).state) { return COVER_OPEN; } - else if (id(garage_closed_sensor).state) { + else if (!id(garage_closed_sensor).state) { return COVER_CLOSED; } return 1; @@ -52,22 +60,30 @@ switch: - delay: 1000ms - switch.turn_off: garage_door_relay + +# Sensors: closed = magnetic, open = no presence. +# Top Sensor (measures door closed) +# Bottom Sensor (measures door is open) +# Top (closed) sensor is closed, DOOR IS CLOSED DOWN +# Bottom (open) sensor is closed, DOOR HAS OPENED UP +# Both sensors are open, DOOR IS MOVING +# Both sensors are closed, BUG, rare, they're both in contact. + # Define Hall Effect Sensors binary_sensor: - platform: gpio - name: "Garage Door Open Hall Sensor (Top)" + name: "Garage Door Open (Bottom) Hall Sensor" id: garage_open_sensor device_class: garage_door - internal: true + #internal: true pin: - number: GPIO33 - inverted: true + number: GPIO32 mode: pullup: true input: true filters: - delayed_off: 500ms - on_press: + on_release: then: - cover.template.publish: id: garage_door_v2 @@ -76,22 +92,23 @@ binary_sensor: return COVER_OPEN; - platform: gpio - name: "Garage Door Closed Hall Sensor (Bottom)" + name: "Garage Door Closed (Top) Hall Sensor" id: garage_closed_sensor - internal: true + device_class: garage_door + #internal: true pin: - number: GPIO32 - inverted: true + number: GPIO33 mode: pullup: true input: true filters: - delayed_off: 500ms - on_press: + on_release: then: - cover.template.publish: id: garage_door_v2 state: !lambda |- id(garage_door_v2).current_operation = COVER_OPERATION_IDLE; return COVER_CLOSED; + diff --git a/pmsx003.yaml b/pmsx003.yaml index d975f17..da49b06 100644 --- a/pmsx003.yaml +++ b/pmsx003.yaml @@ -1,5 +1,6 @@ substitutions: friendly_name: pmsx003 + friendly_id: pmsx003 packages: device_base: !include device_base_esp32.yaml