cleaned for new home
This commit is contained in:
32
esphome/archive/display2.yaml
Normal file
32
esphome/archive/display2.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
esphome:
|
||||
name: display2
|
||||
friendly_name: display2
|
||||
|
||||
esp32:
|
||||
board: esp32-s3-devkitc-1
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
encryption:
|
||||
key: "oYzH7FkN0cDSL7aTynztxyc1fiHIgbvxu9hvprJ1M8M="
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
password: "0a47dce7c6c30dcab46c0dff9d5b09e1"
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "Display2 Fallback Hotspot"
|
||||
password: "i4FclugUojhf"
|
||||
|
||||
captive_portal:
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
substitutions:
|
||||
device_name: "badkamerradfan"
|
||||
friendly_name: "badkamerradfan"
|
||||
comment: "esp32-c3"
|
||||
location: "badkamer"
|
||||
comment: "esp32-c3 - BTproxy"
|
||||
location: "Badkamer"
|
||||
api_password: !secret badkamerradfan_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
substitutions:
|
||||
device_name: "btproxykeuken"
|
||||
friendly_name: "BT_proxy_keuken"
|
||||
comment: "ESP32-c3 proxy"
|
||||
comment: "ESP32-c3 BTproxy"
|
||||
location: "keuken"
|
||||
board: "esp32-c3-devkitm-1"
|
||||
framework: arduino
|
||||
framework: esp-idf
|
||||
api_password: !secret bt_proxy_keuken_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
|
||||
@@ -11,18 +11,18 @@ substitutions:
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret stepper_ip
|
||||
update_interval: 30s
|
||||
pin_mot_rst: GPIO26
|
||||
pin_mot_slp: GPIO33
|
||||
pin_mot_dir: GPIO38
|
||||
pin_mot_stp: GPIO34
|
||||
pin_mot_rst: GPIO13
|
||||
pin_mot_slp: GPIO16
|
||||
pin_mot_dir: GPIO18
|
||||
pin_mot_stp: GPIO17
|
||||
pin_mot_en: GPIO21
|
||||
pin_hall_dir: GPIO39
|
||||
pin_hall_stp: GPIO40
|
||||
pin_hall_dir: GPIO34
|
||||
pin_hall_stp: GPIO33
|
||||
pin_sda: GPIO15
|
||||
pin_scl: GPIO14
|
||||
pin_led1: GPIO45
|
||||
pin_led1: GPIO38
|
||||
num_leds: "1"
|
||||
chipset: ws2812
|
||||
chipset: sk6812
|
||||
blinds_name: speelkamer
|
||||
|
||||
packages:
|
||||
@@ -30,7 +30,7 @@ packages:
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
#leds: !include templates/light_rgbw_rmt.yaml
|
||||
leds: !include templates/light_rgbw_rmt.yaml
|
||||
i2c: !include interfaces/i2c_a.yaml
|
||||
bme: !include sensors/bme280.yaml
|
||||
light: !include sensors/light_tsl2591.yaml
|
||||
@@ -58,6 +58,10 @@ esphome:
|
||||
- number.set:
|
||||
id: calibration_max
|
||||
value: !lambda "return id(calibration_max_global);"
|
||||
- number.set:
|
||||
id: calibration_min
|
||||
value: !lambda "return id(calibration_min_global);"
|
||||
- lambda: id(motor_hal).publish_state(id(hall_pos_global));
|
||||
|
||||
globals:
|
||||
- id: hall_pos_global
|
||||
@@ -76,6 +80,10 @@ globals:
|
||||
type: int
|
||||
restore_value: True
|
||||
initial_value: '250'
|
||||
- id: calibration_min_global
|
||||
type: int
|
||||
restore_value: True
|
||||
initial_value: '-250'
|
||||
|
||||
number:
|
||||
- platform: template
|
||||
@@ -106,7 +114,7 @@ number:
|
||||
- logger.log: "endstop open stored"
|
||||
- platform: template
|
||||
id: calibration_max
|
||||
min_value: 0
|
||||
min_value: -1000
|
||||
max_value: 1000
|
||||
step: 1
|
||||
name: calibration max
|
||||
@@ -117,6 +125,20 @@ number:
|
||||
id: calibration_max_global
|
||||
value: !lambda "return x;"
|
||||
- logger.log: "calirbation max stored"
|
||||
- platform: template
|
||||
id: calibration_min
|
||||
min_value: -1000
|
||||
max_value: 1000
|
||||
step: 1
|
||||
name: calibration min
|
||||
optimistic: true
|
||||
on_value:
|
||||
then:
|
||||
- globals.set:
|
||||
id: calibration_min_global
|
||||
value: !lambda "return x;"
|
||||
- logger.log: "calirbation min stored"
|
||||
|
||||
|
||||
- platform: template
|
||||
name: Stepper Control
|
||||
@@ -167,6 +189,12 @@ binary_sensor:
|
||||
id(hall_pos_global) = motorvalue;
|
||||
ESP_LOGD("on sensor", "motor hall: %d", motorvalue);
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
pin: ${pin_mot_rst}
|
||||
id: stepper_reset
|
||||
name: "stepper reset"
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
|
||||
stepper:
|
||||
- platform: a4988
|
||||
@@ -180,33 +208,92 @@ stepper:
|
||||
|
||||
|
||||
button:
|
||||
# - platform: template
|
||||
# id: Calibrate_blinds
|
||||
# name: Calibrate blinds
|
||||
# on_press:
|
||||
# # reset all params
|
||||
# - globals.set:
|
||||
# id: hall_pos_global
|
||||
# value: "0"
|
||||
# - logger.log:
|
||||
# format: "hal pos set to 0 (hal pos = %i)"
|
||||
# args: [id(hall_pos_global)]
|
||||
# #tell stepper that he is in the middle
|
||||
# - stepper.report_position:
|
||||
# id: stepper_motor
|
||||
# position: !lambda "return uint32_t(id(calibration_max));"
|
||||
# - logger.log:
|
||||
# format: "stepper pos set to 0 (stepper pos = %i)"
|
||||
# args: [id(stepper_motor).current_position]
|
||||
# # It's best to call set_target directly after report_position, so that the stepper doesn't move
|
||||
# - stepper.set_target:
|
||||
# id: stepper_motor
|
||||
# target: !lambda "return uint32_t(id(calibration_max));"
|
||||
# #calibrate closed_endstop
|
||||
# - stepper.set_target:
|
||||
# id: stepper_motor
|
||||
# target: 0
|
||||
# - while:
|
||||
# condition:
|
||||
# lambda: 'return id(hall_pos_global) > -10;'
|
||||
# then:
|
||||
# - logger.log:
|
||||
# format: "hal pos = %i; stepper pos = %i"
|
||||
# args: [id(hall_pos_global), id(stepper_motor).current_position]
|
||||
- platform: template
|
||||
id: Calibrate_blinds
|
||||
name: Calibrate blinds
|
||||
id: steppermax
|
||||
name: stepper Max
|
||||
on_press:
|
||||
# reset all params
|
||||
- globals.set:
|
||||
id: hall_pos_global
|
||||
value: "0"
|
||||
#tell stepper that he is in the middle
|
||||
- stepper.report_position:
|
||||
id: stepper_motor
|
||||
position: !lambda "return uint32_t(id(calibration_max));"
|
||||
# It's best to call set_target directly after report_position, so that the stepper doesn't move
|
||||
- stepper.set_target:
|
||||
id: stepper_motor
|
||||
target: !lambda "return uint32_t(id(calibration_max));"
|
||||
#calibrate closed_endstop
|
||||
target: !lambda "return uint32_t(id(calibration_max).state);"
|
||||
- platform: template
|
||||
id: stepperreset
|
||||
name: stepper reset
|
||||
on_press:
|
||||
- stepper.report_position:
|
||||
id: stepper_motor
|
||||
position: 0
|
||||
- stepper.set_target:
|
||||
id: stepper_motor
|
||||
target: 0
|
||||
- platform: template
|
||||
id: steppermin
|
||||
name: stepper Min
|
||||
on_press:
|
||||
- stepper.set_target:
|
||||
id: stepper_motor
|
||||
target: !lambda "return uint32_t(id(calibration_min).state);"
|
||||
- platform: template
|
||||
id: getstepperpos
|
||||
name: Stepper Getpos
|
||||
on_press:
|
||||
- logger.log:
|
||||
format: "hal pos = %i; stepper cur pos = %i; stepper target pos = %i"
|
||||
args: [id(hall_pos_global), id(stepper_motor).current_position, id(stepper_motor).target_position]
|
||||
- platform: template
|
||||
id: hallreset
|
||||
name: Hall Reset
|
||||
on_press:
|
||||
- globals.set:
|
||||
id: hall_pos_global
|
||||
value: "0"
|
||||
- lambda: id(motor_hal).publish_state(id(hall_pos_global));
|
||||
- platform: template
|
||||
id: runtohalmin
|
||||
name: Run to hall min
|
||||
on_press:
|
||||
- while:
|
||||
condition:
|
||||
lambda: 'return id(hall_pos_global) > -10;'
|
||||
then:
|
||||
- stepper.set_target:
|
||||
id: stepper_motor
|
||||
target: !lambda 'return id(stepper_motor).current_position + 10;'
|
||||
- logger.log:
|
||||
format: "hal pos = %i; stepper pos = %i"
|
||||
args: [id(hall_pos_global), id(stepper_motor).current_position]
|
||||
format: "hal pos = %i; stepper cur pos = %i; stepper target pos = %i"
|
||||
args: [id(hall_pos_global), id(stepper_motor).current_position, id(stepper_motor).target_position]
|
||||
|
||||
|
||||
|
||||
@@ -242,12 +329,12 @@ button:
|
||||
# id: ${blinds_name}
|
||||
# state: OPEN
|
||||
# current_operation: IDLE
|
||||
close_action:
|
||||
then:
|
||||
- logger.log: "Closing"
|
||||
- stepper.set_target: # Send stepper to 0
|
||||
id: stepper_motor
|
||||
target: '0'
|
||||
# close_action:
|
||||
# then:
|
||||
# - logger.log: "Closing"
|
||||
# - stepper.set_target: # Send stepper to 0
|
||||
# id: stepper_motor
|
||||
# target: '0'
|
||||
# - while:
|
||||
# condition:
|
||||
# lambda: 'return id(stepper_motor).current_position > 0;'
|
||||
38
esphome/cfg_offline/aqs_ikea_co2.yaml
Normal file
38
esphome/cfg_offline/aqs_ikea_co2.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
substitutions:
|
||||
device_name: "esp32-c3-aqs-ikea-co2"
|
||||
friendly_name: "AQS-ikea-co2"
|
||||
comment: "esp32, pm, co2, display, BTproxy"
|
||||
location: "zolder"
|
||||
board: "esp32-c3-devkitm-1"
|
||||
framework: esp-idf
|
||||
api_password: !secret air_quality_zolder_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret aqs_ikea_co2_ip
|
||||
update_interval: 1s
|
||||
pin_status: GPIO8
|
||||
pin_sda: GPIO6
|
||||
pin_scl: GPIO7
|
||||
#pin_led1: GPIO10
|
||||
|
||||
#chipset: WS2812
|
||||
#num_leds: "1"
|
||||
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32-gen.yaml
|
||||
i2c: !include interfaces/i2c_a.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
#status: !include templates/status.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
#bt_proxy: !include common/bluetooth.yaml
|
||||
#leds: !include templates/light_rgbw_rmt.yaml
|
||||
|
||||
|
||||
#sensors
|
||||
co2: !include sensors/scd30.yaml
|
||||
tvoc: !include sensors/sgp30.yaml
|
||||
@@ -1,7 +1,7 @@
|
||||
substitutions:
|
||||
device_name: "esp32-s2-aqs-ikea"
|
||||
friendly_name: "AQS-zolder"
|
||||
comment: "esp32, pm, co2, display, btprox"
|
||||
comment: "esp32, pm, co2, display, BTproxy"
|
||||
location: "zolder"
|
||||
api_password: !secret air_quality_zolder_api
|
||||
ota_password: !secret ota_password
|
||||
@@ -21,7 +21,7 @@ substitutions:
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32_wroom_arduino.yaml
|
||||
i2c: !include interfaces/i2c_a_slow.yaml
|
||||
i2c: !include interfaces/i2c_a.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
status: !include templates/status.yaml
|
||||
@@ -29,7 +29,6 @@ packages:
|
||||
bt_proxy: !include common/bluetooth.yaml
|
||||
|
||||
#sensors
|
||||
#mmwave: !include sensors/ld2420.yaml
|
||||
pms: !include sensors/pm1006.yaml
|
||||
co2: !include sensors/scd30.yaml
|
||||
tvoc: !include sensors/sgp30.yaml
|
||||
@@ -1,10 +1,10 @@
|
||||
substitutions:
|
||||
device_name: "btproxyhal"
|
||||
friendly_name: "BT_proxy_hal"
|
||||
comment: "ESP32-c3 proxy"
|
||||
comment: "ESP32-c3 BTproxy"
|
||||
location: "hal"
|
||||
board: "esp32-c3-devkitm-1"
|
||||
framework: arduino
|
||||
framework: esp-idf
|
||||
api_password: !secret bt_proxy_hal_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
@@ -22,7 +22,7 @@ packages:
|
||||
board: !include boards/esp32-gen.yaml
|
||||
connection: !include common/wifi_btprox.yaml
|
||||
device_base: !include common/common.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
logger: !include templates/nologger.yaml
|
||||
#status: !include templates/status.yaml
|
||||
btproxy: !include templates/bt_proxy.yaml
|
||||
#bme: !include sensors/bme280.yaml
|
||||
26
esphome/cfg_offline/bt-proxy-slaapkamer-iw.yaml
Normal file
26
esphome/cfg_offline/bt-proxy-slaapkamer-iw.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
substitutions:
|
||||
device_name: "btproxyslaapkameriw"
|
||||
friendly_name: "BT_proxy_slaaplamer_iw"
|
||||
comment: "ESP32-c3 BTproxy"
|
||||
location: "Slaapkamer Tim"
|
||||
board: "esp32-c3-devkitm-1"
|
||||
framework: esp-idf
|
||||
api_password: !secret bt_proxy_slaapkamer_iw_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret bt_proxy_slaapkamer_iw_ip
|
||||
pin_status: GPIO8
|
||||
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32-gen.yaml
|
||||
connection: !include common/wifi_btprox.yaml
|
||||
device_base: !include common/common.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
btproxy: !include templates/bt_proxy.yaml
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
substitutions:
|
||||
device_name: "btproxyspeelkamer"
|
||||
friendly_name: "BT_proxy_speelkamer"
|
||||
comment: "ESP32-c3 proxy"
|
||||
comment: "ESP32-c3 BTproxy"
|
||||
location: "speelkamer"
|
||||
board: "esp32-c3-devkitm-1"
|
||||
framework: arduino
|
||||
framework: esp-idf
|
||||
api_password: !secret bt_proxy_speelkamer_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
@@ -1,10 +1,10 @@
|
||||
substitutions:
|
||||
device_name: "btproxywoonkamer"
|
||||
friendly_name: "BT_proxy_woonkamer"
|
||||
comment: "ESP32-c3 proxy"
|
||||
comment: "ESP32-c3 BTproxy"
|
||||
location: "woonkamer"
|
||||
board: "esp32-c3-devkitm-1"
|
||||
framework: arduino
|
||||
framework: esp-idf
|
||||
|
||||
api_password: !secret bt_proxy_woonkamer_api
|
||||
ota_password: !secret ota_password
|
||||
@@ -1,7 +1,7 @@
|
||||
substitutions:
|
||||
device_name: "btproxyzolder"
|
||||
friendly_name: "BT_proxy_zolder"
|
||||
comment: "ESP32-c3 proxy"
|
||||
comment: "ESP32-c3 BTproxy"
|
||||
location: "zolder"
|
||||
board: "esp32-c3-devkitm-1"
|
||||
#framework: esp-idf
|
||||
17
esphome/cfg_offline/ep-lite-zolder.yaml
Normal file
17
esphome/cfg_offline/ep-lite-zolder.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
substitutions:
|
||||
name: everything-presence-lite-20946c
|
||||
friendly_name: Everything Presence Lite 20946c
|
||||
packages:
|
||||
EverythingSmartTechnology.Everything_Presence_Lite: github://everythingsmarthome/everything-presence-lite/everything-presence-lite-ha.yaml@main
|
||||
esphome:
|
||||
name: ${name}
|
||||
name_add_mac_suffix: false
|
||||
friendly_name: ${friendly_name}
|
||||
api:
|
||||
encryption:
|
||||
key: 0ZAfs0jaWqKlNuTPEiPYj5vgi1eA0GPZU1xYtJAEdAM=
|
||||
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
55
esphome/cfg_offline/ep1-woonkamer.yaml
Executable file
55
esphome/cfg_offline/ep1-woonkamer.yaml
Executable file
@@ -0,0 +1,55 @@
|
||||
substitutions:
|
||||
name: ${device_name}
|
||||
device_name: "ep1_woonkamer"
|
||||
location: "woonkamer"
|
||||
comment: "esp32, mmwave, pir, BTproxy"
|
||||
friendly_name: "ep1_woonkamer"
|
||||
project_name: "Everything Smart Technology.Everything Presence One"
|
||||
project_version: "1.1.3"
|
||||
temperature_offset: "-3"
|
||||
humidity_offset: "5"
|
||||
temperature_update_interval: "60s"
|
||||
illuminance_update_interval: "30s"
|
||||
pir_delay_off: "10s"
|
||||
occupancy_delay_off: "15s"
|
||||
hidden_ssid: "false"
|
||||
factory_reset_disabled: "true"
|
||||
uart_target_output_disabled: "true"
|
||||
uart_presence_output_disabled: "true"
|
||||
api_password: !secret ep1_woonkamer_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret ep1_woonkamer_ip
|
||||
pin_sda: GPIO26
|
||||
pin_scl: GPIO25
|
||||
pin_status: GPIO32
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32_wroom_arduino.yaml
|
||||
device_base: !include common/common.yaml
|
||||
device_version: !include common/ep_one-sen0395-stable.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
i2c: !include interfaces/i2c_a.yaml
|
||||
bt_proxy: !include common/bluetooth.yaml
|
||||
sen0395_base: !include sensors/sen0395_base.yaml
|
||||
|
||||
wifi:
|
||||
on_connect:
|
||||
- switch.turn_on: mmwave_sensor
|
||||
|
||||
esp32_improv:
|
||||
authorizer: none
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://everythingsmarthome/everything-presence-one/everything-presence-one-ble.yaml@main
|
||||
import_full_config: false
|
||||
|
||||
esphome:
|
||||
project:
|
||||
name: "${project_name}"
|
||||
version: "${project_version}"
|
||||
|
||||
@@ -2,7 +2,7 @@ substitutions:
|
||||
name: ${device_name}
|
||||
device_name: "ep1-zolder"
|
||||
location: "Zolder"
|
||||
comment: "esp32, mmwave, pir"
|
||||
comment: "esp32, mmwave, pir, BTproxy"
|
||||
friendly_name: "ep1-zolder"
|
||||
project_name: "Everything Smart Technology.Everything Presence One"
|
||||
project_version: "1.1.3"
|
||||
@@ -33,7 +33,8 @@ packages:
|
||||
connection: !include common/wifi.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
i2c: !include interfaces/i2c_a.yaml
|
||||
bluetooth: !include common/bluetooth.yaml
|
||||
bt_proxy: !include common/bluetooth.yaml
|
||||
|
||||
|
||||
improv_serial:
|
||||
|
||||
28
esphome/cfg_offline/halloween-ghost01.yaml
Normal file
28
esphome/cfg_offline/halloween-ghost01.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
substitutions:
|
||||
device_name: "halloween-ghost01"
|
||||
friendly_name: "halloween-ghost01"
|
||||
comment: "esp32c3, RGBled"
|
||||
location: "Woonkamer"
|
||||
board: "esp32-c3-devkitm-1"
|
||||
framework: arduino
|
||||
api_password: !secret halloween_ghost01_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret halloween_ghost01_ip
|
||||
pin_led1: GPIO10
|
||||
num_leds: "1"
|
||||
chipset: WS2812
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32-gen.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
device_base: !include common/common.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
leds: !include templates/light_rgbw_rmt.yaml
|
||||
bt_proxy: !include common/bluetooth.yaml
|
||||
|
||||
17
esphome/cfg_offline/home-assistant-voice-095f77.yaml
Normal file
17
esphome/cfg_offline/home-assistant-voice-095f77.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
substitutions:
|
||||
name: home-assistant-voice-095f77
|
||||
friendly_name: Home Assistant Voice 095f77
|
||||
packages:
|
||||
Nabu Casa.Home Assistant Voice PE: github://esphome/home-assistant-voice-pe/home-assistant-voice.yaml
|
||||
esphome:
|
||||
name: ${name}
|
||||
name_add_mac_suffix: false
|
||||
friendly_name: ${friendly_name}
|
||||
api:
|
||||
encryption:
|
||||
key: kfc7zAySq+LlWF4rdeDEwv7pXqcxIeCCkQE5yCWhi9s=
|
||||
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
@@ -14,8 +14,8 @@ substitutions:
|
||||
pin_relay: GPIO14
|
||||
pin_button: GPIO1
|
||||
pin_status: GPIO13
|
||||
pin_cf: GPIO05
|
||||
pin_cf1: GPIO04
|
||||
pin_cf: GPIO04
|
||||
pin_cf1: GPIO05
|
||||
pin_sel: GPIO12
|
||||
|
||||
|
||||
@@ -52,21 +52,23 @@ switch:
|
||||
sensor:
|
||||
- platform: hlw8012
|
||||
model: BL0937 # note that the model must be specified to use special calculation parameters
|
||||
current_resistor: 0.001 # adjust it according to the actual resistor value on board
|
||||
voltage_divider: 2012 # (2008.1K)/998 = 2004, adjust it according to the actual resistor values on board
|
||||
current_resistor: 0.0010613489336676262 # adjust it according to the actual resistor value on board
|
||||
voltage_divider: 1407.7685950413224 # (2008.1K)/998 = 2004, adjust it according to the actual resistor values on board
|
||||
sel_pin:
|
||||
number: ${pin_sel}
|
||||
inverted: true # the logic of BL0937 is opposite from HLW8012
|
||||
cf_pin: ${pin_cf}
|
||||
cf1_pin: ${pin_cf1}
|
||||
current:
|
||||
name: '${device_name} Current'
|
||||
name: 'Current'
|
||||
filters:
|
||||
- multiply: 0.7162477466468644
|
||||
voltage:
|
||||
name: '${device_name} Voltage'
|
||||
name: 'Voltage'
|
||||
power:
|
||||
name: '${device_name} Power'
|
||||
name: 'Power'
|
||||
energy:
|
||||
name: '${device_name} Energy'
|
||||
name: 'Energy'
|
||||
# convert to kWh
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
42
esphome/cfg_old/zemismart-curtain_old.yaml
Executable file
42
esphome/cfg_old/zemismart-curtain_old.yaml
Executable file
@@ -0,0 +1,42 @@
|
||||
substitutions:
|
||||
device_name: "zemismart-curtain"
|
||||
friendly_name: "zemismart curtain"
|
||||
comment: "esp8266 tuya mcu curtain"
|
||||
location: "overloop"
|
||||
api_password: !secret zemismart_curtain
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret zemismart_curtain_ip
|
||||
pin_curtain_rx: GPIO13
|
||||
pin_curtain_tx: GPIO15
|
||||
|
||||
|
||||
packages:
|
||||
board: !include boards/esp01.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
logger: !include templates/nologger.yaml
|
||||
|
||||
uart:
|
||||
- !include interfaces/uart_tywe1s.yaml
|
||||
|
||||
esphome:
|
||||
includes:
|
||||
- include/bcm500ds.h
|
||||
|
||||
cover:
|
||||
- platform: custom
|
||||
lambda: |-
|
||||
auto curtain = new CustomCurtain();
|
||||
App.register_component(curtain);
|
||||
return {curtain};
|
||||
covers:
|
||||
- name: Curtain
|
||||
device_class: curtain
|
||||
|
||||
custom_component:
|
||||
- lambda: |-
|
||||
return { new CustomAPI() };
|
||||
@@ -14,7 +14,7 @@ substitutions:
|
||||
pin_led1: GPIO3
|
||||
pin_led2: GPIO4
|
||||
pin_led3: GPIO1
|
||||
ledc_freq: "1220Hz"
|
||||
ledc_freq: "25000Hz"
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32-C3.yaml
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
substitutions:
|
||||
device_name: "kersthuis-01"
|
||||
friendly_name: "kersthuis-01"
|
||||
friendly_name: "kersthuis-01_staircase"
|
||||
comment: "esp32-c3"
|
||||
location: "woonkamer"
|
||||
api_password: !secret kersthuis-01_api
|
||||
@@ -17,37 +17,28 @@ packages:
|
||||
board: !include boards/esp32-C3.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
# status: !include templates/status.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
|
||||
#led packages
|
||||
ledje1: !include
|
||||
file: templates/LedWithEffects.yaml
|
||||
vars:
|
||||
entityID: led_lights
|
||||
entityName: "led string 1"
|
||||
pin_led: ${pin_led1}
|
||||
|
||||
light:
|
||||
- platform: monochromatic
|
||||
id: led_lights
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
output: leds
|
||||
name: "led string 1"
|
||||
effects:
|
||||
- flicker:
|
||||
name: "Flicker"
|
||||
alpha: 95%
|
||||
intensity: 1.5%
|
||||
|
||||
output:
|
||||
- platform: ledc
|
||||
pin: ${pin_led1}
|
||||
id: leds
|
||||
|
||||
# binary_sensor:
|
||||
# - platform: gpio
|
||||
# name: "Button"
|
||||
# pin: ${pin_button}
|
||||
# filters:
|
||||
# - delayed_on: 20ms
|
||||
# on_click:
|
||||
# min_length: 50ms
|
||||
# max_length: 1000ms
|
||||
# then:
|
||||
# - light.toggle:
|
||||
# id: led_lights
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
name: "Button"
|
||||
pin: ${pin_button}
|
||||
filters:
|
||||
- delayed_on: 20ms
|
||||
on_click:
|
||||
min_length: 50ms
|
||||
max_length: 1000ms
|
||||
then:
|
||||
- light.toggle:
|
||||
id: led_lights
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
substitutions:
|
||||
device_name: "kersthuis-02"
|
||||
friendly_name: "kersthuis-02"
|
||||
comment: "esp32-c3"
|
||||
friendly_name: "kersthuis-02_peperkoekman"
|
||||
comment: "esp32-c3: SK6812"
|
||||
location: "woonkamer"
|
||||
api_password: !secret kersthuis-02_api
|
||||
ip: !secret kersthuis-02_ip
|
||||
@@ -11,6 +11,8 @@ substitutions:
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
chipset: SK6812
|
||||
num_leds: "3"
|
||||
pin_led1: GPIO3
|
||||
|
||||
|
||||
@@ -20,21 +22,22 @@ packages:
|
||||
connection: !include common/wifi.yaml
|
||||
# status: !include templates/status.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
leds: !include templates/light_rgbw_rmt.yaml
|
||||
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
rmt_channel: 0
|
||||
is_rgbw: true
|
||||
id: led_lights
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
name: "kersthuisje2"
|
||||
chipset: SK6812
|
||||
rgb_order: GRB
|
||||
num_leds: 1
|
||||
pin: ${pin_led1}
|
||||
effects:
|
||||
- flicker:
|
||||
name: "Flicker"
|
||||
alpha: 95%
|
||||
intensity: 1.5%
|
||||
# light:
|
||||
# - platform: esp32_rmt_led_strip
|
||||
# rmt_channel: 0
|
||||
# is_rgbw: true
|
||||
# id: led_lights
|
||||
# restore_mode: RESTORE_DEFAULT_ON
|
||||
# name: "kersthuisje2"
|
||||
# chipset: SK6812
|
||||
# rgb_order: GRB
|
||||
# num_leds: 1
|
||||
# pin: ${pin_led1}
|
||||
# effects:
|
||||
# - flicker:
|
||||
# name: "Flicker"
|
||||
# alpha: 95%
|
||||
# intensity: 1.5%
|
||||
|
||||
|
||||
@@ -19,72 +19,27 @@ packages:
|
||||
board: !include boards/esp32-C3.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
# status: !include templates/status.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
|
||||
light:
|
||||
- platform: monochromatic
|
||||
id: led_light1
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
output: led1
|
||||
name: led_light1
|
||||
effects:
|
||||
- flicker:
|
||||
name: "Flicker"
|
||||
alpha: 95%
|
||||
intensity: 1.5%
|
||||
on_turn_on:
|
||||
- light.turn_on:
|
||||
id: led_light1
|
||||
effect: flicker
|
||||
brightness: 75%
|
||||
|
||||
- platform: monochromatic
|
||||
id: led_light2
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
output: led2
|
||||
name: led_light2
|
||||
effects:
|
||||
- flicker:
|
||||
name: "Flicker"
|
||||
alpha: 95%
|
||||
intensity: 1.5%
|
||||
on_turn_on:
|
||||
- light.turn_on:
|
||||
id: led_light2
|
||||
effect: flicker
|
||||
brightness: 75%
|
||||
|
||||
|
||||
- platform: monochromatic
|
||||
id: led_light3
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
output: led3
|
||||
name: led_light3
|
||||
effects:
|
||||
- flicker:
|
||||
name: "Flicker"
|
||||
alpha: 95%
|
||||
intensity: 1.5%
|
||||
on_turn_on:
|
||||
- light.turn_on:
|
||||
id: led_light3
|
||||
effect: flicker
|
||||
brightness: 75%
|
||||
|
||||
output:
|
||||
- platform: ledc
|
||||
pin: ${pin_led1}
|
||||
id: led1
|
||||
|
||||
- platform: ledc
|
||||
pin: ${pin_led2}
|
||||
id: led2
|
||||
|
||||
- platform: ledc
|
||||
pin: ${pin_led3}
|
||||
id: led3
|
||||
|
||||
#led packages
|
||||
ledje1: !include
|
||||
file: templates/LedWithEffects.yaml
|
||||
vars:
|
||||
entityID: led_light1
|
||||
entityName: "led_light1"
|
||||
pin_led: ${pin_led1}
|
||||
ledje2: !include
|
||||
file: templates/LedWithEffects.yaml
|
||||
vars:
|
||||
entityID: led_light2
|
||||
entityName: "led_light2"
|
||||
pin_led: ${pin_led2}
|
||||
ledje3: !include
|
||||
file: templates/LedWithEffects.yaml
|
||||
vars:
|
||||
entityID: led_light3
|
||||
entityName: "led_light2"
|
||||
pin_led: ${pin_led3}
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
|
||||
@@ -1,30 +1,9 @@
|
||||
---
|
||||
# esp32_ble_tracker:
|
||||
# scan_parameters:
|
||||
# interval: 1100ms # default 320ms
|
||||
# window: 1100ms # default 30ms
|
||||
# active: true
|
||||
|
||||
|
||||
esp32_ble_tracker:
|
||||
scan_parameters:
|
||||
interval: 1100ms
|
||||
window: 1100ms
|
||||
active: true
|
||||
|
||||
bluetooth_proxy:
|
||||
active: true
|
||||
#cache_services: true #needs idf
|
||||
|
||||
# binary_sensor:
|
||||
# - platform: ble_presence
|
||||
# mac_address: C8:B8:49:1F:07:7C
|
||||
# name: "BLE tracker 1"
|
||||
|
||||
# sensor:
|
||||
# - platform: ble_rssi
|
||||
# mac_address: C8:B8:49:1F:07:7C
|
||||
# name: "BLE tracker 1"
|
||||
|
||||
# text_sensor:
|
||||
# - platform: ble_scanner
|
||||
# name: "BLE Devices Scanner"
|
||||
|
||||
@@ -7,3 +7,9 @@ esphome:
|
||||
button:
|
||||
- platform: restart
|
||||
name: 'Restart'
|
||||
id: restart_internal
|
||||
- platform: safe_mode
|
||||
internal: false
|
||||
name: Safe mode
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
251
esphome/common/ep_one-sen0395-stable.yaml
Normal file
251
esphome/common/ep_one-sen0395-stable.yaml
Normal file
@@ -0,0 +1,251 @@
|
||||
uart:
|
||||
id: uart_bus
|
||||
tx_pin: GPIO13
|
||||
rx_pin: GPIO14
|
||||
baud_rate: 115200
|
||||
debug:
|
||||
direction: BOTH
|
||||
dummy_receiver: true
|
||||
after:
|
||||
delimiter: "\n"
|
||||
sequence:
|
||||
- lambda: UARTDebug::log_string(direction, bytes);
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
name: mmWave
|
||||
id: mmwave
|
||||
device_class: occupancy
|
||||
pin:
|
||||
number: GPIO15
|
||||
mode: INPUT_PULLDOWN
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: 33
|
||||
mode: INPUT_PULLDOWN
|
||||
name: PIR
|
||||
id: pir_motion_sensor
|
||||
device_class: motion
|
||||
filters:
|
||||
- delayed_off: !lambda 'return id(pir_off_latency).state * 1000.0;'
|
||||
- platform: template
|
||||
name: Occupancy
|
||||
id: occupancy
|
||||
device_class: occupancy
|
||||
filters:
|
||||
- delayed_off: !lambda 'return id(occupancy_off_latency).state * 1000.0;'
|
||||
on_state:
|
||||
- lambda: 'id(illuminance_sensor).update();'
|
||||
lambda: |-
|
||||
if ( id(mmwave).state or id(pir_motion_sensor).state) {
|
||||
return true;
|
||||
}
|
||||
else if (id(mmwave).state == 0 and id(pir_motion_sensor).state == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return id(occupancy).state;
|
||||
}
|
||||
|
||||
number:
|
||||
- platform: template
|
||||
id: mmwave_distance
|
||||
name: mmWave distance
|
||||
icon: mdi:arrow-left-right
|
||||
entity_category: config
|
||||
min_value: 0
|
||||
max_value: 800
|
||||
initial_value: 315
|
||||
optimistic: true
|
||||
step: 15
|
||||
restore_value: true
|
||||
unit_of_measurement: cm
|
||||
mode: slider
|
||||
set_action:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: !lambda int cm = (int)ceil(x / 15.0);
|
||||
std::string cms = "detRangeCfg -1 0 " + to_string(cm);
|
||||
return std::vector<unsigned char>(cms.begin(), cms.end());
|
||||
- delay: 1s
|
||||
- uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
|
||||
- delay: 1s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
- platform: template
|
||||
name: Occupancy off latency
|
||||
icon: mdi:clock-end
|
||||
entity_category: config
|
||||
id: occupancy_off_latency
|
||||
min_value: 1
|
||||
max_value: 600
|
||||
initial_value: 15
|
||||
optimistic: true
|
||||
step: 5
|
||||
restore_value: true
|
||||
unit_of_measurement: seconds
|
||||
mode: slider
|
||||
|
||||
- platform: template
|
||||
name: PIR off latency
|
||||
icon: mdi:clock-end
|
||||
entity_category: config
|
||||
id: pir_off_latency
|
||||
min_value: 1
|
||||
max_value: 120
|
||||
initial_value: 10
|
||||
optimistic: true
|
||||
step: 1
|
||||
restore_value: true
|
||||
unit_of_measurement: seconds
|
||||
mode: slider
|
||||
|
||||
- platform: template
|
||||
name: "Temperature Offset"
|
||||
id: temperature_offset_ui
|
||||
unit_of_measurement: "°C"
|
||||
min_value: -20
|
||||
max_value: 20
|
||||
step: 0.1
|
||||
mode: box
|
||||
update_interval: never
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: 0
|
||||
icon: "mdi:thermometer"
|
||||
entity_category: config
|
||||
on_value:
|
||||
- lambda: 'id(shtc3_sensor).update();'
|
||||
- platform: template
|
||||
name: "Humidity Offset"
|
||||
id: humidity_offset_ui
|
||||
unit_of_measurement: "%"
|
||||
min_value: -50
|
||||
max_value: 50
|
||||
step: 0.1
|
||||
mode: box
|
||||
update_interval: never
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: 0
|
||||
icon: "mdi:water-percent"
|
||||
entity_category: config
|
||||
on_value:
|
||||
- lambda: 'id(shtc3_sensor).update();'
|
||||
- platform: template
|
||||
name: "Illuminance Offset"
|
||||
id: illuminance_offset_ui
|
||||
unit_of_measurement: "lx"
|
||||
min_value: -50
|
||||
max_value: 50
|
||||
step: 1
|
||||
mode: box
|
||||
update_interval: never
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: 0
|
||||
icon: "mdi:brightness-5"
|
||||
entity_category: config
|
||||
on_value:
|
||||
- lambda: 'id(illuminance_sensor).update();'
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: UART target output
|
||||
id: uart_target_output
|
||||
entity_category: config
|
||||
internal: ${uart_target_output_disabled}
|
||||
optimistic: true
|
||||
assumed_state: false
|
||||
turn_on_action:
|
||||
- logger.log: "UART Target Output On"
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: "setUartOutput 2 1 1 1"
|
||||
- delay: 1s
|
||||
- uart.write: "saveConfig"
|
||||
- delay: 3s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
turn_off_action:
|
||||
- logger.log: "UART Presence Output Off"
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: "setUartOutput 2 0"
|
||||
- delay: 1s
|
||||
- uart.write: "saveConfig"
|
||||
- delay: 3s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
|
||||
|
||||
light:
|
||||
- platform: status_led
|
||||
name: ESP32 status LED
|
||||
pin: GPIO32
|
||||
entity_category: config
|
||||
disabled_by_default: False
|
||||
|
||||
sensor:
|
||||
- platform: shtcx
|
||||
id: "shtc3_sensor"
|
||||
i2c_id: bus_a
|
||||
temperature:
|
||||
name: Temperature
|
||||
id: temperature_sensor
|
||||
filters:
|
||||
- offset: ${temperature_offset}
|
||||
- lambda: "return x + id(temperature_offset_ui).state;"
|
||||
humidity:
|
||||
name: Humidity
|
||||
id: humidity_sensor
|
||||
filters:
|
||||
- offset: ${humidity_offset}
|
||||
- lambda: "return x + id(humidity_offset_ui).state;"
|
||||
address: 0x70
|
||||
update_interval: ${temperature_update_interval}
|
||||
- platform: bh1750
|
||||
name: Illuminance
|
||||
id: illuminance_sensor
|
||||
i2c_id: bus_a
|
||||
address: 0x23
|
||||
update_interval: ${illuminance_update_interval}
|
||||
filters:
|
||||
- calibrate_linear:
|
||||
method: exact
|
||||
datapoints:
|
||||
- 0.3 -> 0.3
|
||||
- 0.9 -> 1.7
|
||||
- 1.2 -> 3.6
|
||||
- 3.2 -> 6.9
|
||||
- 5.1 -> 10.2
|
||||
- 6.8 -> 27.1
|
||||
- 7.0 -> 13.5
|
||||
- 7.4 -> 28.2
|
||||
- 8.7 -> 21.7
|
||||
- 8.9 -> 17.1
|
||||
- 10.9 -> 20.4
|
||||
- 12.8 -> 23.5
|
||||
- 14.5 -> 31.2
|
||||
- 14.9 -> 26.7
|
||||
- 16.8 -> 41.1
|
||||
- 16.9 -> 30.2
|
||||
- 18.8 -> 33.4
|
||||
- 19.1 -> 35.8
|
||||
- 20.7 -> 37.0
|
||||
- 24.3 -> 60.3
|
||||
- 26.1 -> 68.6
|
||||
- 26.7 -> 83.8
|
||||
- 30.2 -> 75.9
|
||||
- 32.6 -> 80.3
|
||||
- 34.6 -> 83.2
|
||||
- 40.4 -> 99.9
|
||||
- 48.0 -> 183.7
|
||||
- 48.3 -> 119.2
|
||||
- 55.5 -> 141.3
|
||||
- 55.8 -> 137.9
|
||||
- 63.8 -> 157.6
|
||||
- 71.5 -> 176.9
|
||||
- 79.8 -> 197.1
|
||||
- 84.3 -> 205.7
|
||||
- lambda: "return x + id(illuminance_offset_ui).state;"
|
||||
- clamp:
|
||||
min_value: 0
|
||||
|
||||
@@ -10,15 +10,18 @@ ota:
|
||||
password: ${ota_password}
|
||||
|
||||
wifi:
|
||||
ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
fast_connect: True
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
networks:
|
||||
- ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
- ssid: ${wifi_ssid2}
|
||||
password: ${wifi_password2}
|
||||
|
||||
#use_address: 192.168.2.235 #when changing fixed IP
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
|
||||
@@ -10,16 +10,18 @@ ota:
|
||||
password: ${ota_password}
|
||||
|
||||
wifi:
|
||||
ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
fast_connect: True
|
||||
output_power: "8.5"
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
networks:
|
||||
- ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
- ssid: ${wifi_ssid2}
|
||||
password: ${wifi_password2}
|
||||
|
||||
#use_address: 192.168.2.235 #when changing fixed IP
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
|
||||
@@ -10,15 +10,18 @@ ota:
|
||||
password: ${ota_password}
|
||||
|
||||
wifi:
|
||||
ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
fast_connect: True
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
networks:
|
||||
- ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
- ssid: ${wifi_ssid2}
|
||||
password: ${wifi_password2}
|
||||
|
||||
# use_address: 192.168.2.63 #when changing fixed IP
|
||||
|
||||
ap:
|
||||
|
||||
@@ -8,13 +8,17 @@ ota:
|
||||
password: ${ota_password}
|
||||
|
||||
wifi:
|
||||
ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
networks:
|
||||
- ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
- ssid: ${wifi_ssid2}
|
||||
password: ${wifi_password2}
|
||||
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
|
||||
@@ -8,15 +8,18 @@ ota:
|
||||
password: ${ota_password}
|
||||
|
||||
wifi:
|
||||
ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
fast_connect: True
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
networks:
|
||||
- ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
- ssid: ${wifi_ssid2}
|
||||
password: ${wifi_password2}
|
||||
|
||||
# use_address: 192.168.2.63 #when changing fixed IP
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
|
||||
@@ -17,15 +17,18 @@ ota:
|
||||
platform: esphome
|
||||
|
||||
wifi:
|
||||
ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
fast_connect: True
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
networks:
|
||||
- ssid: ${wifi_ssid}
|
||||
password: ${wifi_password}
|
||||
manual_ip:
|
||||
static_ip: ${ip}
|
||||
gateway: ${gateway}
|
||||
subnet: ${subnet}
|
||||
dns1: 192.169.2.15
|
||||
dns2: 1.1.1.1
|
||||
- ssid: ${wifi_ssid2}
|
||||
password: ${wifi_password2}
|
||||
|
||||
# use_address: 192.168.2.63 #when changing fixed IP
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
|
||||
7
esphome/components/tuya_cover/README.md
Normal file
7
esphome/components/tuya_cover/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
```yaml
|
||||
# example configuration:
|
||||
|
||||
cover:
|
||||
platform: tuya_cover
|
||||
name: Tuya cover
|
||||
```
|
||||
0
esphome/components/tuya_cover/__init__.py
Normal file
0
esphome/components/tuya_cover/__init__.py
Normal file
200
esphome/components/tuya_cover/bcm500ds.cpp
Normal file
200
esphome/components/tuya_cover/bcm500ds.cpp
Normal file
@@ -0,0 +1,200 @@
|
||||
#include "bcm500ds.h"
|
||||
|
||||
|
||||
namespace esphome {
|
||||
namespace tuya_cover {
|
||||
|
||||
|
||||
// // Forward declarations
|
||||
// bool read_command();
|
||||
// void write_command(TUYACOVERCommandType command, const uint8_t *value, uint16_t length);
|
||||
// uint8_t checksum();
|
||||
|
||||
/*
|
||||
* Attempt to read an entire command from the serial UART into the command struct.
|
||||
* Will fail early if unable to find the two-byte header in the current
|
||||
* data stream. If the header is found, it will contine to read the complete
|
||||
* TLV+checksum sequence off the port. If the entire sequence can be read
|
||||
* and the checksum is valid, it will return true.
|
||||
*/
|
||||
bool bcm500ds::read_command()
|
||||
{
|
||||
// Shift bytes through until we find a valid header
|
||||
bool valid_header = false;
|
||||
while (Serial.available() >= 1)
|
||||
{
|
||||
uart_buffer_[0] = uart_buffer_[1];
|
||||
uart_buffer_[1] = Serial.read();
|
||||
command_.header = (uart_buffer_[0] << 8) + uart_buffer_[1];
|
||||
if (command_.header == TUYA_COVER_HEADER)
|
||||
{
|
||||
valid_header = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Read the next 4 bytes (Version, Command, Data length)
|
||||
// Read n bytes (Data length)
|
||||
// Read the checksum byte
|
||||
if (valid_header)
|
||||
{
|
||||
Serial.readBytes(uart_buffer_ + TUYA_COVER_HEADER_LEN, TUYA_COVER_BUFFER_LEN - TUYA_COVER_HEADER_LEN);
|
||||
command_.version = uart_buffer_[2];
|
||||
command_.command = uart_buffer_[3];
|
||||
command_.length = (uart_buffer_[4] << 8) + uart_buffer_[5];
|
||||
ESP_LOGV(TAG, "RX: Header = 0x%04X, Version = 0x%02X, Command = 0x%02X, Data length = 0x%04X", command_.header, command_.version, command_.command, command_.length);
|
||||
|
||||
if (command_.length < TUYA_COVER_MAX_LEN)
|
||||
{
|
||||
Serial.readBytes(command_.value, command_.length);
|
||||
ESP_LOGV(TAG, "RX_RAW:");
|
||||
for (size_t i = 0; i < command_.length; i++)
|
||||
{
|
||||
ESP_LOGV(TAG, "%02d: 0x%02X", i, command_.value[i]);
|
||||
}
|
||||
while (Serial.available() == 0) // Dirty
|
||||
{
|
||||
//Wait
|
||||
}
|
||||
command_.checksum = Serial.read();
|
||||
|
||||
ESP_LOGV(TAG, "RX_CHK: 0x%02X", command_.checksum);
|
||||
uint8_t calc_checksum = checksum();
|
||||
if (calc_checksum == command_.checksum)
|
||||
{
|
||||
// Clear buffer contents to start with beginning of next command
|
||||
memset(uart_buffer_, 0, TUYA_COVER_BUFFER_LEN);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(uart_buffer_, 0, TUYA_COVER_BUFFER_LEN);
|
||||
ESP_LOGE(TAG, "Checksum error: Read = 0x%02X != Calculated = 0x%02X", command_.checksum, calc_checksum);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(uart_buffer_, 0, TUYA_COVER_BUFFER_LEN);
|
||||
ESP_LOGE(TAG, "Command length exceeds limit: %d >= %d", command_.length, TUYA_COVER_MAX_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
// Do not clear buffer to allow for resume in case of reading partway through header RX
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store the given type, value, and length into the command struct and send
|
||||
* it out the serial port. Automatically calculates the checksum as well.
|
||||
*/
|
||||
void bcm500ds::write_command(TUYACOVERCommandType command, const uint8_t *value, uint16_t length)
|
||||
{
|
||||
// Copy params into command struct
|
||||
command_.header = TUYA_COVER_HEADER;
|
||||
command_.version = TUYA_COVER_VERSION;
|
||||
command_.command = command;
|
||||
command_.length = length;
|
||||
ESP_LOGV(TAG, "TX: Header = 0x%04X, Version = 0x%02X, Command = 0x%02X, Data length = 0x%04X", command_.header, command_.version, command_.command, command_.length);
|
||||
memcpy(&command_.value, value, length);
|
||||
ESP_LOGV(TAG, "TX_RAW");
|
||||
for (size_t i = 0; i < command_.length; i++)
|
||||
{
|
||||
ESP_LOGV(TAG, "%02d: 0x%02X", i, command_.value[i]);
|
||||
}
|
||||
// Copy struct values into buffer, converting longs to big-endian
|
||||
uart_buffer_[0] = command_.header >> 8;
|
||||
uart_buffer_[1] = command_.header & 0xFF;
|
||||
uart_buffer_[2] = command_.version;
|
||||
uart_buffer_[3] = command_.command;
|
||||
uart_buffer_[4] = command_.length >> 8;
|
||||
uart_buffer_[5] = command_.length & 0xFF;
|
||||
command_.checksum = checksum();
|
||||
ESP_LOGV(TAG, "TX_CHK: 0x%02X", command_.checksum);
|
||||
// Send buffer out via UART
|
||||
Serial.write(uart_buffer_, TUYA_COVER_BUFFER_LEN);
|
||||
Serial.write(command_.value, command_.length);
|
||||
Serial.write(command_.checksum);
|
||||
// Clear buffer contents to avoid re-reading our own payload
|
||||
memset(uart_buffer_, 0, TUYA_COVER_BUFFER_LEN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate checksum from current UART buffer (header+type+length) plus command value.
|
||||
*/
|
||||
uint8_t bcm500ds::checksum()
|
||||
{
|
||||
uint8_t checksum = 0;
|
||||
for (size_t i = 0; i < TUYA_COVER_BUFFER_LEN; i++)
|
||||
{
|
||||
checksum += uart_buffer_[i];
|
||||
}
|
||||
for (size_t i = 0; i < command_.length; i++)
|
||||
{
|
||||
checksum += command_.value[i];
|
||||
}
|
||||
return checksum;
|
||||
}
|
||||
|
||||
void bcm500ds::setup()
|
||||
{
|
||||
write_command(TUYA_COVER_QUERY_STATUS, 0, 0);
|
||||
}
|
||||
|
||||
void bcm500ds::loop()
|
||||
{
|
||||
unsigned long currentHeartbeatMillis = millis();
|
||||
if (currentHeartbeatMillis - previousHeartbeatMillis >= HEARTBEAT_INTERVAL_MS)
|
||||
{
|
||||
previousHeartbeatMillis += HEARTBEAT_INTERVAL_MS;
|
||||
ESP_LOGI(TAG, "TUYA_COVER_COMMAND = HEARTBEAT");
|
||||
write_command(TUYA_COVER_HEARTBEAT, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void bcm500ds::command_close()
|
||||
{
|
||||
ESP_LOGI(TAG, "TUYA_COVER_COMMAND = CLOSE");
|
||||
write_command(TUYA_COVER_COMMAND, tuya_cover_close, sizeof(tuya_cover_close));
|
||||
}
|
||||
|
||||
void bcm500ds::command_open()
|
||||
{
|
||||
ESP_LOGI(TAG, "TUYA_COVER_COMMAND = OPEN");
|
||||
write_command(TUYA_COVER_COMMAND, tuya_cover_open, sizeof(tuya_cover_open));
|
||||
}
|
||||
|
||||
void bcm500ds::command_gotoPos(uint8_t pos)
|
||||
{
|
||||
tuya_cover_pos[7] = pos;
|
||||
ESP_LOGI(TAG, "TUYA_COVER_COMMAND = POS = %d%%", pos);
|
||||
write_command(TUYA_COVER_COMMAND, tuya_cover_pos, sizeof(tuya_cover_pos));
|
||||
}
|
||||
|
||||
void bcm500ds::command_stop()
|
||||
{
|
||||
write_command(TUYA_COVER_COMMAND, tuya_cover_stop, sizeof(tuya_cover_stop));
|
||||
}
|
||||
|
||||
uint8_t bcm500ds::query_pos()
|
||||
{
|
||||
return (1-((command_.value[7]) / 100.0f));
|
||||
}
|
||||
|
||||
uint8_t bcm500ds::query_value(uint8_t index)
|
||||
{
|
||||
if(index <= TUYA_COVER_MAX_LEN)
|
||||
{
|
||||
return command_.value[index];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t bcm500ds::query_cmd()
|
||||
{
|
||||
return command_.command;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace tuya_cover
|
||||
} // namespace esphome
|
||||
108
esphome/components/tuya_cover/bcm500ds.h
Normal file
108
esphome/components/tuya_cover/bcm500ds.h
Normal file
@@ -0,0 +1,108 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome.h"
|
||||
namespace esphome {
|
||||
namespace tuya_cover {
|
||||
|
||||
// protocol
|
||||
#define TUYA_COVER_MAX_LEN 640 // Max length of message value
|
||||
// #define TUYA_COVER_MAX_LEN 256 // Max length of message value
|
||||
#define TUYA_COVER_BUFFER_LEN 6 // Length of serial buffer for header + type + length
|
||||
#define TUYA_COVER_HEADER_LEN 2 // Length of fixed header
|
||||
#define TUYA_COVER_MSG_LEN 5
|
||||
|
||||
// enable/disable reversed motor direction
|
||||
// Normal = header (55AA) + (00060005) + 050100010011 "(55AA00060005050100010011)
|
||||
// Reversed = header (55AA) + (00060005) + 050100010112 "(55AA00060005050100010112)"
|
||||
#define TUYA_COVER_DISABLE_REVERSING { 0x69, 0x01, 0x00, 0x01, 0x00 } //dpid = 105, type = bool, len = 1, value = disable
|
||||
#define TUYA_COVER_ENABLE_REVERSING { 0x69, 0x01, 0x00, 0x01, 0x01 } //dpid = 105, type = bool, len = 1, value = enable
|
||||
// Curtain commands
|
||||
// Open = header (55AA) + (00060005) + 6604000100 "(55aa000600056604000100)"
|
||||
// Close = header (55AA) + (00060005) + 6604000101 "(55aa000600056604000101)"
|
||||
// Stop = header (55AA) + (00060005) + 6604000102 "(55AA000600056604000102)"
|
||||
#define TUYA_COVER_OPEN { 0x66, 0x04, 0x00, 0x01, 0x00 } //dpid = 101, type = enum, len = 1, value = OPEN
|
||||
#define TUYA_COVER_CLOSE { 0x66, 0x04, 0x00, 0x01, 0x01 } //dpid = 101, type = enum, len = 1, value = CLOSE
|
||||
#define TUYA_COVER_STOP { 0x66, 0x04, 0x00, 0x01, 0x02 } //dpid = 101, type = enum, len = 1, value = STOP
|
||||
|
||||
#define TUYA_COVER_SET_POSITION { 0x65, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 } //"65020004000000" //dpid = 2, type = value, len = 4, value = 0x000000 + 1 byte (0x00-0x64)
|
||||
struct TUYACOVERCommand
|
||||
{
|
||||
uint16_t header;
|
||||
uint8_t version;
|
||||
uint8_t command;
|
||||
uint16_t length;
|
||||
uint8_t value[TUYA_COVER_MAX_LEN];
|
||||
uint8_t checksum;
|
||||
};
|
||||
|
||||
struct TUYACOVERMessage
|
||||
{
|
||||
uint8_t dpid;
|
||||
uint8_t type;
|
||||
uint16_t len;
|
||||
uint8_t value[TUYA_COVER_MAX_LEN - 4]; //Subtract dpid, type, len
|
||||
};
|
||||
|
||||
class bcm500ds {
|
||||
public:
|
||||
const uint16_t TUYA_COVER_HEADER = 0x55AA;
|
||||
//static const uint16_t TUYA_COVER_VERSION = 0x03;
|
||||
const uint8_t TUYA_COVER_VERSION = 0x00;
|
||||
|
||||
const uint8_t tuya_cover_enable_reversing[TUYA_COVER_MSG_LEN]; // = TUYA_COVER_ENABLE_REVERSING;
|
||||
const uint8_t tuya_cover_disable_reversing[TUYA_COVER_MSG_LEN];// = TUYA_COVER_DISABLE_REVERSING;
|
||||
const uint8_t tuya_cover_open[TUYA_COVER_MSG_LEN];// = TUYA_COVER_OPEN;
|
||||
const uint8_t tuya_cover_close[TUYA_COVER_MSG_LEN];// = TUYA_COVER_CLOSE;
|
||||
const uint8_t tuya_cover_stop[TUYA_COVER_MSG_LEN];// = TUYA_COVER_STOP;
|
||||
uint8_t tuya_cover_pos[8] = TUYA_COVER_SET_POSITION;
|
||||
|
||||
#define HEARTBEAT_INTERVAL_MS 10000
|
||||
unsigned long previousHeartbeatMillis = 0;
|
||||
// Variables
|
||||
TUYACOVERCommand command_{TUYA_COVER_HEADER, TUYA_COVER_VERSION, 0, 0, {}, 0};
|
||||
uint8_t uart_buffer_[TUYA_COVER_BUFFER_LEN]{0};
|
||||
|
||||
const char *TAG = "tuya_cover.cover";
|
||||
|
||||
enum TUYACOVERCommandType
|
||||
{
|
||||
TUYA_COVER_HEARTBEAT = 0x00,
|
||||
TUYA_COVER_COMMAND = 0x06,
|
||||
TUYA_COVER_RESPONSE = 0x07,
|
||||
TUYA_COVER_QUERY_STATUS = 0x08
|
||||
};
|
||||
|
||||
enum TUYACOVERdpidType
|
||||
{
|
||||
TUYA_COVER_DPID_POSITION= 0x65,
|
||||
TUYA_COVER_DPID_DIRECTION = 0x64,
|
||||
TUYA_COVER_DPID_UNKNOWN = 0x67,
|
||||
TUYA_COVER_DPID_ERROR = 0x6E
|
||||
};
|
||||
|
||||
bool read_command();
|
||||
void write_command(TUYACOVERCommandType command, const uint8_t *value, uint16_t length);
|
||||
uint8_t checksum();
|
||||
|
||||
bcm500ds(): tuya_cover_enable_reversing TUYA_COVER_ENABLE_REVERSING,
|
||||
tuya_cover_disable_reversing TUYA_COVER_DISABLE_REVERSING,
|
||||
tuya_cover_open TUYA_COVER_OPEN,
|
||||
tuya_cover_close TUYA_COVER_CLOSE,
|
||||
tuya_cover_stop TUYA_COVER_STOP
|
||||
{}
|
||||
|
||||
void loop();
|
||||
void setup();
|
||||
bool read(){return read_command();}
|
||||
void command_close();
|
||||
void command_open();
|
||||
void command_gotoPos(uint8_t pos);
|
||||
void command_stop();
|
||||
uint8_t query_pos();
|
||||
uint8_t query_value(uint8_t index);
|
||||
uint8_t query_cmd();
|
||||
|
||||
};
|
||||
|
||||
} //namespace tuya_cover
|
||||
} //namespace esphome
|
||||
17
esphome/components/tuya_cover/cover.py
Normal file
17
esphome/components/tuya_cover/cover.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import cover
|
||||
from esphome.const import CONF_ID
|
||||
|
||||
tuya_cover_ns = cg.esphome_ns.namespace("tuya_cover")
|
||||
TuyaCover = tuya_cover_ns.class_("tuyaCover", cover.Cover, cg.Component)
|
||||
|
||||
CONFIG_SCHEMA = cover.COVER_SCHEMA.extend(
|
||||
{cv.GenerateID(): cv.declare_id(TuyaCover)}
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
await cg.register_component(var, config)
|
||||
await cover.register_cover(var, config)
|
||||
94
esphome/components/tuya_cover/tuya_cover.cpp
Normal file
94
esphome/components/tuya_cover/tuya_cover.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
#include "esphome/core/log.h"
|
||||
#include "tuya_cover.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace tuya_cover {
|
||||
|
||||
bcm500ds driver;
|
||||
|
||||
static const char *TAG = "tuya_cover.cover";
|
||||
|
||||
void tuyaCover::setup() {
|
||||
ESP_LOGI(TAG, "TUYA_COVER_COMMAND = QUERY_STATUS");
|
||||
driver.setup();
|
||||
}
|
||||
|
||||
void tuyaCover::loop() {
|
||||
|
||||
driver.loop();
|
||||
|
||||
bool have_message = driver.read();
|
||||
|
||||
if(have_message && driver.query_cmd() == bcm500ds::TUYA_COVER_HEARTBEAT)
|
||||
{
|
||||
ESP_LOGI(TAG, "TUYA_COVER_RESPONSE = %s", (driver.query_value(0) == 0) ? "FIRST_HEARTBEAT" : "HEARTBEAT");
|
||||
}
|
||||
else if (have_message && driver.query_cmd() == bcm500ds::TUYA_COVER_RESPONSE)
|
||||
{
|
||||
switch (driver.query_value(0))
|
||||
{
|
||||
case bcm500ds::TUYA_COVER_DPID_POSITION:
|
||||
ESP_LOGI(TAG, "TUYA_COVER_DPID_POSITION = %d%%", driver.query_value(7));
|
||||
this->position = driver.query_pos();
|
||||
this->publish_state();
|
||||
break;
|
||||
case bcm500ds::TUYA_COVER_DPID_DIRECTION:
|
||||
ESP_LOGI(TAG, "TUYA_COVER_DPID_DIRECTION = 0x%02X", driver.query_value(4));
|
||||
break;
|
||||
case bcm500ds::TUYA_COVER_DPID_UNKNOWN:
|
||||
ESP_LOGI(TAG, "TUYA_COVER_DPID_UNKNOWN ENUM = 0x%02X", driver.query_value(4));
|
||||
break;
|
||||
case bcm500ds::TUYA_COVER_DPID_ERROR:
|
||||
ESP_LOGI(TAG, "TUYA_COVER_DPID_ERROR BITMAP = 0x%02X", driver.query_value(4));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tuyaCover::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Tuya cover");
|
||||
}
|
||||
|
||||
cover::CoverTraits tuyaCover::get_traits() {
|
||||
auto traits = cover::CoverTraits();
|
||||
traits.set_is_assumed_state(false);
|
||||
traits.set_supports_position(false);
|
||||
traits.set_supports_tilt(false);
|
||||
|
||||
return traits;
|
||||
}
|
||||
|
||||
void tuyaCover::control(const cover::CoverCall &call) {
|
||||
if (call.get_position().has_value())
|
||||
{
|
||||
// Write pos (range 0-1) to cover
|
||||
// Cover pos (range 0x00-0x64) (closed - open)
|
||||
uint8_t pos = (100-(*call.get_position() * 100));
|
||||
ESP_LOGV(TAG, "POS = %d", pos);
|
||||
|
||||
switch (pos)
|
||||
{
|
||||
case 0:
|
||||
driver.command_close();
|
||||
break;
|
||||
case 100:
|
||||
driver.command_open();
|
||||
break;
|
||||
default:
|
||||
driver.command_gotoPos(pos);
|
||||
break;
|
||||
}
|
||||
// publish_state only when position is confirmed in loop()
|
||||
}
|
||||
if (call.get_stop())
|
||||
{
|
||||
// User requested cover stop
|
||||
driver.command_stop();
|
||||
ESP_LOGI(TAG, "TUYA_COVER_COMMAND = STOP");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace tuya_cover
|
||||
} // namespace esphome
|
||||
25
esphome/components/tuya_cover/tuya_cover.h
Normal file
25
esphome/components/tuya_cover/tuya_cover.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/cover/cover.h"
|
||||
#include "bcm500ds.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace tuya_cover {
|
||||
|
||||
class tuyaCover : public cover::Cover, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
void dump_config() override;
|
||||
cover::CoverTraits get_traits() override;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
void control(const cover::CoverCall &call) override;
|
||||
};
|
||||
|
||||
|
||||
} // namespace tuya_cover
|
||||
} // namespace esphome
|
||||
@@ -7,12 +7,21 @@ substitutions:
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
wifi_ssid2: !secret wifi_ssid2
|
||||
wifi_password2: !secret wifi_password2
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret eink_display_ip
|
||||
#pins
|
||||
pin_spi_clk: GPIO7
|
||||
pin_spi_mosi: GPIO9
|
||||
pin_ep_cs: GPIO2
|
||||
pin_ep_dc: GPIO4
|
||||
pin_ep_busy: GPIO3
|
||||
pin_ep_reset: GPIO1
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32_wroom_arduino.yaml
|
||||
board: !include boards/esp32-S3.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi_nosens.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
@@ -22,6 +31,7 @@ packages:
|
||||
esphome:
|
||||
includes:
|
||||
- include/epaper75.h
|
||||
- include/text_utils.h
|
||||
|
||||
external_components:
|
||||
# - source:
|
||||
@@ -116,7 +126,14 @@ font:
|
||||
- file: 'fonts/GothamRnd-Book.ttf'
|
||||
id: font_weekday
|
||||
size: 30
|
||||
glyphs: ['a', 'd', 'e','F', 'h', 'i','M', 'n', 'o', 'r', 's','S', 't','T', 'u', 'W', 'y']
|
||||
glyphs: &default-glyphs
|
||||
['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
|
||||
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
|
||||
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z','|', '/']
|
||||
|
||||
- file: 'fonts/GothamRnd-Book.ttf'
|
||||
id: font_day
|
||||
size: 65
|
||||
@@ -194,6 +211,7 @@ sensor:
|
||||
- !include { file: sensors/homeassistant.yaml, vars: { id: travel_euretco_time, entity_id: sensor.e_ink_display_data }}
|
||||
|
||||
|
||||
|
||||
- platform: wifi_signal
|
||||
id: sensor_wifi_signal
|
||||
name: "${device_name} WiFi"
|
||||
@@ -225,6 +243,7 @@ sensor:
|
||||
lambda: 'return id(recorded_display_refresh);'
|
||||
unit_of_measurement: "refreshes"
|
||||
|
||||
|
||||
text_sensor:
|
||||
# - platform: homeassistant
|
||||
# entity_id: weather.forecast_home
|
||||
@@ -244,6 +263,8 @@ text_sensor:
|
||||
- !include { file: sensors/homeassistant.yaml, vars: { id: travel_Best_name, entity_id: sensor.e_ink_display_data }}
|
||||
- !include { file: sensors/homeassistant.yaml, vars: { id: travel_ASML_name, entity_id: sensor.e_ink_display_data }}
|
||||
- !include { file: sensors/homeassistant.yaml, vars: { id: travel_euretco_name, entity_id: sensor.e_ink_display_data }}
|
||||
- !include { file: sensors/homeassistant.yaml, vars: { id: day_full, entity_id: sensor.e_ink_display_data }}
|
||||
- !include { file: sensors/homeassistant.yaml, vars: { id: datum, entity_id: sensor.e_ink_display_data }}
|
||||
|
||||
# Sunrise
|
||||
- platform: sun
|
||||
@@ -301,19 +322,19 @@ color:
|
||||
|
||||
# Pins for Waveshare ePaper ESP Board
|
||||
spi:
|
||||
clk_pin: GPIO13
|
||||
mosi_pin: GPIO14
|
||||
clk_pin: ${pin_spi_clk}
|
||||
mosi_pin: ${pin_spi_mosi}
|
||||
|
||||
|
||||
# Now render everything on the ePaper screen.
|
||||
display:
|
||||
- platform: waveshare_epaper
|
||||
cs_pin: GPIO27
|
||||
dc_pin: GPIO16
|
||||
cs_pin: ${pin_ep_cs}
|
||||
dc_pin: ${pin_ep_dc}
|
||||
busy_pin:
|
||||
number: 25
|
||||
number: ${pin_ep_busy}
|
||||
inverted: True
|
||||
reset_pin: GPIO26
|
||||
reset_pin: ${pin_ep_reset}
|
||||
reset_duration: 2ms
|
||||
model: 7.50in-bv2-rb
|
||||
#model: 7.50in-bV2
|
||||
@@ -327,25 +348,20 @@ display:
|
||||
#define x_pad 10 // border padding
|
||||
#define y_pad 10 // border padding
|
||||
|
||||
int wifi_x_a = xres-x_pad;
|
||||
int wifi_y_a = yres-y_pad+2;
|
||||
// int wifi_x_a = xres-x_pad;
|
||||
// int wifi_y_a = yres-y_pad+2;
|
||||
// Fill background in black.
|
||||
it.fill(COLOR_OFF);
|
||||
|
||||
// clock section
|
||||
int clk_yoffset = 50;
|
||||
int clk_xoffset = 310;
|
||||
int clk_xoffset = 50;
|
||||
|
||||
// Print full weekday name
|
||||
it.strftime(clk_xoffset, clk_yoffset, id(font_weekday), TextAlign::TOP_RIGHT, "%A", id(esptime).now());
|
||||
|
||||
// Print time in HH:MM format 335
|
||||
// it.strftime(clk_xoffset, clk_yoffset+105, id(font_time), TextAlign::BASELINE_RIGHT, "%H:%M", id(esptime).now());
|
||||
it.printf(clk_xoffset, clk_yoffset, id(font_weekday), TextAlign::TOP_LEFT, "%s", id(day_full).state.c_str());
|
||||
int day_size = GetTextWidth(&it, id(font_weekday), "%s", id(day_full).state.c_str());
|
||||
it.printf(clk_xoffset + day_size+10, clk_yoffset, id(font_weekday), TextAlign::TOP_LEFT, "%s", id(datum).state.c_str());
|
||||
|
||||
// Print day of the month
|
||||
it.strftime(clk_xoffset+100, clk_yoffset, id(font_day), TextAlign::TOP_RIGHT, "%d", id(esptime).now());
|
||||
// Print abbreviated month name
|
||||
it.strftime(clk_xoffset+100, clk_yoffset+105, id(font_month), TextAlign::BASELINE_RIGHT, "%b", id(esptime).now());
|
||||
|
||||
int sry_offset = 200; //sunrise/set y-offset
|
||||
// Print sunrise
|
||||
it.printf(60, sry_offset, id(font_mdi_medium), COLOR_RED, TextAlign::CENTER_RIGHT, "\U000F059C");
|
||||
@@ -394,21 +410,23 @@ display:
|
||||
|
||||
it.line(30, forecast_yoffset+102, 420, forecast_yoffset+102);
|
||||
|
||||
// //afstand
|
||||
int drvtime_yoffset = forecast_yoffset+132;
|
||||
int drvtime_xoffset = 40;
|
||||
it.printf(drvtime_xoffset, drvtime_yoffset, id(font_mdi_medium), COLOR_RED, TextAlign::TOP_CENTER, "%s", weather_icon_map["car"].c_str());
|
||||
// int drvtime_xoffset = 40;
|
||||
// it.printf(drvtime_xoffset, drvtime_yoffset, id(font_mdi_medium), COLOR_RED, TextAlign::TOP_CENTER, "%s", weather_icon_map["car"].c_str());
|
||||
|
||||
it.printf(drvtime_xoffset+90, drvtime_yoffset, id(font_small_bold), TextAlign::TOP_CENTER, "%s", id(travel_Best_name).state.c_str());
|
||||
it.printf(drvtime_xoffset+90, drvtime_yoffset+30, id(font_small_bold), TextAlign::TOP_CENTER, "%2.0f min", id(travel_Best_time).state);
|
||||
// it.printf(drvtime_xoffset+90, drvtime_yoffset, id(font_small_bold), TextAlign::TOP_CENTER, "%s", id(travel_Best_name).state.c_str());
|
||||
// it.printf(drvtime_xoffset+90, drvtime_yoffset+30, id(font_small_bold), TextAlign::TOP_CENTER, "%2.0f min", id(travel_Best_time).state);
|
||||
|
||||
it.printf(drvtime_xoffset+210, drvtime_yoffset, id(font_small_bold), TextAlign::TOP_CENTER, "%s", id(travel_ASML_name).state.c_str());
|
||||
it.printf(drvtime_xoffset+210, drvtime_yoffset+30, id(font_small_bold), TextAlign::TOP_CENTER, "%2.0f min", id(travel_ASML_time).state);
|
||||
// it.printf(drvtime_xoffset+210, drvtime_yoffset, id(font_small_bold), TextAlign::TOP_CENTER, "%s", id(travel_ASML_name).state.c_str());
|
||||
// it.printf(drvtime_xoffset+210, drvtime_yoffset+30, id(font_small_bold), TextAlign::TOP_CENTER, "%2.0f min", id(travel_ASML_time).state);
|
||||
|
||||
it.printf(drvtime_xoffset+330, drvtime_yoffset, id(font_small_bold), TextAlign::TOP_CENTER, "%s", id(travel_euretco_name).state.c_str());
|
||||
it.printf(drvtime_xoffset+330, drvtime_yoffset+30, id(font_small_bold), TextAlign::TOP_CENTER, "%2.0f min", id(travel_euretco_time).state);
|
||||
// it.printf(drvtime_xoffset+330, drvtime_yoffset, id(font_small_bold), TextAlign::TOP_CENTER, "%s", id(travel_euretco_name).state.c_str());
|
||||
// it.printf(drvtime_xoffset+330, drvtime_yoffset+30, id(font_small_bold), TextAlign::TOP_CENTER, "%2.0f min", id(travel_euretco_time).state);
|
||||
|
||||
it.line(30, drvtime_yoffset+60, 420, drvtime_yoffset+60);
|
||||
// it.line(30, drvtime_yoffset+60, 420, drvtime_yoffset+60);
|
||||
|
||||
// afval
|
||||
int waste_yoffset = drvtime_yoffset+90;
|
||||
int waste_xoffset = 60;
|
||||
it.printf(waste_xoffset, waste_yoffset, id(font_mdi_medium), COLOR_RED, TextAlign::TOP_CENTER, "%s", weather_icon_map["trash"].c_str());
|
||||
|
||||
@@ -1,591 +0,0 @@
|
||||
substitutions:
|
||||
name: ${device_name}
|
||||
device_name: "ep1_woonkamer"
|
||||
location: "woonkamer"
|
||||
comment: "esp32, mmwave, pir"
|
||||
friendly_name: "ep1_woonkamer"
|
||||
project_name: "Everything Smart Technology.Everything Presence One"
|
||||
project_version: "1.1.3"
|
||||
temperature_offset: "-3"
|
||||
humidity_offset: "5"
|
||||
temperature_update_interval: "60s"
|
||||
illuminance_update_interval: "30s"
|
||||
pir_delay_off: "10s"
|
||||
occupancy_delay_off: "15s"
|
||||
hidden_ssid: "false"
|
||||
factory_reset_disabled: "true"
|
||||
uart_target_output_disabled: "true"
|
||||
uart_presence_output_disabled: "true"
|
||||
api_password: !secret ep1_woonkamer_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret ep1_woonkamer_ip
|
||||
pin_sda: GPIO26
|
||||
pin_scl: GPIO25
|
||||
pin_status: GPIO32
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32_wroom_arduino.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
i2c: !include interfaces/i2c_a.yaml
|
||||
bluetooth: !include common/bluetooth.yaml
|
||||
bt_proxy: !include common/bluetooth.yaml
|
||||
|
||||
improv_serial:
|
||||
|
||||
esp32_improv:
|
||||
authorizer: none
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://everythingsmarthome/presence-one/everything-presence-one.yaml@main
|
||||
import_full_config: false
|
||||
|
||||
esphome:
|
||||
project:
|
||||
name: "${project_name}"
|
||||
version: "${project_version}"
|
||||
includes:
|
||||
- include/SEN0395_distance.h
|
||||
|
||||
light:
|
||||
- platform: status_led
|
||||
name: ESP32 status LED
|
||||
pin: ${pin_status}
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
- platform: binary
|
||||
name: mmWave LED
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
output: mmwave_led_output
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
|
||||
|
||||
output:
|
||||
- platform: template
|
||||
id: mmwave_led_output
|
||||
type: binary
|
||||
write_action:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- if:
|
||||
condition:
|
||||
lambda: !lambda return state;
|
||||
then:
|
||||
- uart.write: "setLedMode 1 0"
|
||||
else:
|
||||
- uart.write: "setLedMode 1 1"
|
||||
- delay: 1s
|
||||
- uart.write: "saveConfig"
|
||||
- delay: 3s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
|
||||
i2c:
|
||||
sda: 26
|
||||
scl: 25
|
||||
scan: true
|
||||
|
||||
sensor:
|
||||
- platform: shtcx
|
||||
id: "shtc3_sensor"
|
||||
temperature:
|
||||
name: Temperature
|
||||
id: temperature_sensor
|
||||
filters:
|
||||
- offset: ${temperature_offset}
|
||||
- lambda: "return x + id(temperature_offset_ui).state;"
|
||||
humidity:
|
||||
name: Humidity
|
||||
id: humidity_sensor
|
||||
filters:
|
||||
- offset: ${humidity_offset}
|
||||
- lambda: "return x + id(humidity_offset_ui).state;"
|
||||
address: 0x70
|
||||
update_interval: ${temperature_update_interval}
|
||||
- platform: bh1750
|
||||
name: Illuminance
|
||||
id: illuminance_sensor
|
||||
address: 0x23
|
||||
update_interval: ${illuminance_update_interval}
|
||||
filters:
|
||||
- lambda: "return x + id(illuminance_offset_ui).state;"
|
||||
- platform: template
|
||||
name: Target 1 Distance # Don't change
|
||||
id: target_distance_1_m
|
||||
accuracy_decimals: 2
|
||||
disabled_by_default: false
|
||||
- platform: template
|
||||
name: Target 2 Distance # Don't change
|
||||
id: target_distance_2_m
|
||||
accuracy_decimals: 2
|
||||
disabled_by_default: True
|
||||
- platform: template
|
||||
name: Target 3 Distance # Don't change
|
||||
id: target_distance_3_m
|
||||
accuracy_decimals: 2
|
||||
disabled_by_default: True
|
||||
- platform: template
|
||||
name: Target 4 Distance # Don't change
|
||||
id: target_distance_4_m
|
||||
accuracy_decimals: 2
|
||||
disabled_by_default: True
|
||||
- platform: template
|
||||
name: "Target 1 SNR" # Don't change
|
||||
disabled_by_default: True
|
||||
- platform: template
|
||||
name: "Target 2 SNR" # Don't change
|
||||
disabled_by_default: True
|
||||
- platform: template
|
||||
name: "Target 3 SNR" # Don't change
|
||||
disabled_by_default: True
|
||||
- platform: template
|
||||
name: "Target 4 SNR" # Don't change
|
||||
disabled_by_default: True
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
name: mmWave
|
||||
id: mmwave
|
||||
device_class: occupancy
|
||||
pin:
|
||||
number: GPIO15
|
||||
mode: INPUT_PULLDOWN
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: 33
|
||||
mode: INPUT_PULLDOWN
|
||||
name: PIR
|
||||
id: pir_motion_sensor
|
||||
device_class: motion
|
||||
filters:
|
||||
- delayed_off: ${pir_delay_off}
|
||||
- platform: template
|
||||
name: Occupancy
|
||||
id: occupancy
|
||||
device_class: occupancy
|
||||
filters:
|
||||
- delayed_off: ${occupancy_delay_off}
|
||||
lambda: |-
|
||||
if ( id(mmwave).state or id(pir_motion_sensor).state) {
|
||||
return true;
|
||||
}
|
||||
else if (id(mmwave).state == 0 and id(pir_motion_sensor).state == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return id(occupancy).state;
|
||||
}
|
||||
- platform: template
|
||||
name: "Target 1 Active" # Don't change
|
||||
disabled_by_default: False
|
||||
- platform: template
|
||||
name: "Target 2 Active" # Don't change
|
||||
disabled_by_default: True
|
||||
- platform: template
|
||||
name: "Target 3 Active" # Don't change
|
||||
disabled_by_default: True
|
||||
- platform: template
|
||||
name: "Target 4 Active" # Don't change
|
||||
disabled_by_default: True
|
||||
|
||||
uart:
|
||||
id: uart_bus
|
||||
tx_pin: GPIO13
|
||||
rx_pin: GPIO14
|
||||
baud_rate: 115200
|
||||
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: mmWave sensor
|
||||
id: mmwave_sensor
|
||||
disabled_by_default: True
|
||||
entity_category: config
|
||||
optimistic: true
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
turn_on_action:
|
||||
- uart.write: "sensorStart"
|
||||
- delay: 1s
|
||||
turn_off_action:
|
||||
- uart.write: "sensorStop"
|
||||
- delay: 1s
|
||||
|
||||
- platform: template
|
||||
name: UART presence output
|
||||
id: uart_presence_output
|
||||
entity_category: config
|
||||
internal: ${uart_presence_output_disabled}
|
||||
optimistic: true
|
||||
turn_on_action:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: "setUartOutput 1 1"
|
||||
- delay: 1s
|
||||
- uart.write: "saveConfig"
|
||||
- delay: 3s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
turn_off_action:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: "setUartOutput 1 0"
|
||||
- delay: 1s
|
||||
- uart.write: "saveConfig"
|
||||
- delay: 3s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
|
||||
- platform: template
|
||||
name: UART target output
|
||||
id: uart_target_output
|
||||
entity_category: config
|
||||
internal: ${uart_target_output_disabled}
|
||||
optimistic: true
|
||||
assumed_state: false
|
||||
restore_mode: ALWAYS_ON
|
||||
turn_on_action:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: "setUartOutput 2 1 1 1"
|
||||
- delay: 1s
|
||||
- uart.write: "saveConfig"
|
||||
- delay: 3s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
turn_off_action:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: "setUartOutput 2 0"
|
||||
- delay: 1s
|
||||
- uart.write: "saveConfig"
|
||||
- delay: 3s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
|
||||
number:
|
||||
- platform: template
|
||||
id: mmwave_zone_1_start
|
||||
name: mmWave Zone 1 Start
|
||||
min_value: 0
|
||||
max_value: 800
|
||||
step: 15
|
||||
initial_value: 0
|
||||
mode: slider
|
||||
unit_of_measurement: cm
|
||||
optimistic: true
|
||||
entity_category: config
|
||||
disabled_by_default: False
|
||||
icon: "mdi:arrow-left-right"
|
||||
|
||||
- platform: template
|
||||
id: mmwave_zone_1_end
|
||||
name: mmWave Zone 1 End
|
||||
min_value: 0
|
||||
max_value: 800
|
||||
step: 15
|
||||
initial_value: 315
|
||||
mode: slider
|
||||
unit_of_measurement: cm
|
||||
optimistic: true
|
||||
entity_category: config
|
||||
disabled_by_default: False
|
||||
icon: "mdi:arrow-left-right"
|
||||
|
||||
- platform: template
|
||||
id: mmwave_zone_2_start
|
||||
name: mmWave Zone 2 Start
|
||||
min_value: 0
|
||||
max_value: 800
|
||||
step: 15
|
||||
initial_value: 0
|
||||
mode: slider
|
||||
unit_of_measurement: cm
|
||||
optimistic: true
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
icon: "mdi:arrow-left-right"
|
||||
|
||||
- platform: template
|
||||
id: mmwave_zone_2_end
|
||||
name: mmWave Zone 2 End
|
||||
min_value: 0
|
||||
max_value: 800
|
||||
step: 15
|
||||
initial_value: 0
|
||||
mode: slider
|
||||
unit_of_measurement: cm
|
||||
optimistic: true
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
icon: "mdi:arrow-left-right"
|
||||
|
||||
- platform: template
|
||||
id: mmwave_zone_3_start
|
||||
name: mmWave Zone 3 Start
|
||||
min_value: 0
|
||||
max_value: 800
|
||||
step: 15
|
||||
initial_value: 0
|
||||
mode: slider
|
||||
unit_of_measurement: cm
|
||||
optimistic: true
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
icon: "mdi:arrow-left-right"
|
||||
|
||||
- platform: template
|
||||
id: mmwave_zone_3_end
|
||||
name: mmWave Zone 3 End
|
||||
min_value: 0
|
||||
max_value: 800
|
||||
step: 15
|
||||
initial_value: 0
|
||||
mode: slider
|
||||
unit_of_measurement: cm
|
||||
optimistic: true
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
icon: "mdi:arrow-left-right"
|
||||
|
||||
- platform: template
|
||||
id: mmwave_zone_4_start
|
||||
name: mmWave Zone 4 Start
|
||||
min_value: 0
|
||||
max_value: 800
|
||||
step: 15
|
||||
initial_value: 0
|
||||
mode: slider
|
||||
unit_of_measurement: cm
|
||||
optimistic: true
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
icon: "mdi:arrow-left-right"
|
||||
|
||||
- platform: template
|
||||
id: mmwave_zone_4_end
|
||||
name: mmWave Zone 4 End
|
||||
min_value: 0
|
||||
max_value: 800
|
||||
step: 15
|
||||
initial_value: 0
|
||||
mode: slider
|
||||
unit_of_measurement: cm
|
||||
optimistic: true
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
icon: "mdi:arrow-left-right"
|
||||
|
||||
- platform: template
|
||||
name: mmWave off latency
|
||||
icon: mdi:clock-end
|
||||
entity_category: config
|
||||
id: mmwave_off_latency
|
||||
min_value: 1
|
||||
max_value: 60
|
||||
initial_value: 15
|
||||
optimistic: true
|
||||
step: 1
|
||||
restore_value: true
|
||||
unit_of_measurement: seconds
|
||||
mode: slider
|
||||
set_action:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: !lambda |-
|
||||
std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state);
|
||||
return std::vector<unsigned char>(mss.begin(), mss.end());
|
||||
- delay: 1s
|
||||
- uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
|
||||
- delay: 1s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
|
||||
- platform: template
|
||||
name: mmWave on latency
|
||||
icon: mdi:clock-start
|
||||
id: mmwave_on_latency
|
||||
entity_category: config
|
||||
min_value: 0
|
||||
max_value: 60
|
||||
initial_value: 0
|
||||
optimistic: true
|
||||
step: 0.5
|
||||
restore_value: true
|
||||
unit_of_measurement: seconds
|
||||
mode: slider
|
||||
set_action:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: !lambda |-
|
||||
std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state);
|
||||
return std::vector<unsigned char>(mss.begin(), mss.end());
|
||||
- delay: 1s
|
||||
- uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
|
||||
- delay: 1s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
|
||||
- platform: template
|
||||
name: mmWave sensitivity
|
||||
icon: mdi:target-variant
|
||||
id: mmwave_sensitivity
|
||||
entity_category: config
|
||||
min_value: 0
|
||||
max_value: 9
|
||||
initial_value: 7
|
||||
optimistic: true
|
||||
step: 1
|
||||
restore_value: true
|
||||
set_action:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write:
|
||||
!lambda std::string mss = "setSensitivity " + to_string((int)x);
|
||||
return std::vector<unsigned char>(mss.begin(), mss.end());
|
||||
- delay: 1s
|
||||
- uart.write: "saveConfig"
|
||||
- delay: 1s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
|
||||
- platform: template
|
||||
name: "Temperature Offset"
|
||||
id: temperature_offset_ui
|
||||
unit_of_measurement: "°C"
|
||||
min_value: -20
|
||||
max_value: 20
|
||||
step: 0.1
|
||||
mode: box
|
||||
update_interval: never
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: 0
|
||||
icon: "mdi:thermometer"
|
||||
entity_category: config
|
||||
on_value:
|
||||
- lambda: 'id(shtc3_sensor).update();'
|
||||
- platform: template
|
||||
name: "Humidity Offset"
|
||||
id: humidity_offset_ui
|
||||
unit_of_measurement: "%"
|
||||
min_value: -50
|
||||
max_value: 50
|
||||
step: 0.1
|
||||
mode: box
|
||||
update_interval: never
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: 0
|
||||
icon: "mdi:water-percent"
|
||||
entity_category: config
|
||||
on_value:
|
||||
- lambda: 'id(shtc3_sensor).update();'
|
||||
- platform: template
|
||||
name: "Illuminance Offset"
|
||||
id: illuminance_offset_ui
|
||||
unit_of_measurement: "lx"
|
||||
min_value: -50
|
||||
max_value: 50
|
||||
step: 1
|
||||
mode: box
|
||||
update_interval: never
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: 0
|
||||
icon: "mdi:brightness-5"
|
||||
entity_category: config
|
||||
on_value:
|
||||
- lambda: 'id(illuminance_sensor).update();'
|
||||
|
||||
button:
|
||||
- platform: restart
|
||||
id: restart_internal
|
||||
entity_category: config
|
||||
internal: true
|
||||
- platform: template
|
||||
name: Restart mmWave sensor
|
||||
id: restart_mmwave
|
||||
entity_category: config
|
||||
internal: true
|
||||
on_press:
|
||||
- uart.write: "resetSystem"
|
||||
- platform: template
|
||||
name: Restart
|
||||
icon: mdi:restart
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
on_press:
|
||||
- button.press: restart_mmwave
|
||||
- button.press: restart_internal
|
||||
- platform: safe_mode
|
||||
internal: false
|
||||
name: Safe mode
|
||||
entity_category: config
|
||||
disabled_by_default: True
|
||||
- platform: template
|
||||
name: Factory reset mmWave
|
||||
icon: mdi:cog-counterclockwise
|
||||
id: factory_reset_mmwave
|
||||
internal: ${factory_reset_disabled}
|
||||
entity_category: config
|
||||
on_press:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: "resetCfg"
|
||||
- delay: 3s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
- platform: template
|
||||
name: mmWave Set Distance
|
||||
id: mmwave_set_distance
|
||||
icon: "mdi:arrow-left-right"
|
||||
entity_category: config
|
||||
on_press:
|
||||
- switch.turn_off: mmwave_sensor
|
||||
- delay: 1s
|
||||
- uart.write: !lambda
|
||||
int s1 = (int)ceil(id(mmwave_zone_1_start).state / 15.0);
|
||||
int e1 = (int)ceil(id(mmwave_zone_1_end).state / 15.0);
|
||||
int s2 = (int)ceil(id(mmwave_zone_2_start).state / 15.0);
|
||||
int e2 = (int)ceil(id(mmwave_zone_2_end).state / 15.0);
|
||||
int s3 = (int)ceil(id(mmwave_zone_3_start).state / 15.0);
|
||||
int e3 = (int)ceil(id(mmwave_zone_3_end).state / 15.0);
|
||||
int s4 = (int)ceil(id(mmwave_zone_4_start).state / 15.0);
|
||||
int e4 = (int)ceil(id(mmwave_zone_4_end).state / 15.0);
|
||||
|
||||
std::string cmd = "detRangeCfg -1";
|
||||
|
||||
if(s1 < e1) {
|
||||
cmd += " " + to_string(s1) + " " + to_string(e1);
|
||||
}
|
||||
if(s2 > e1 && s2 < e2) {
|
||||
cmd += " " + to_string(s2) + " " + to_string(e2);
|
||||
}
|
||||
if(s3 > e2 && s3 < e3) {
|
||||
cmd += " " + to_string(s3) + " " + to_string(e3);
|
||||
}
|
||||
if(s4 > e3 && s4 < e4) {
|
||||
cmd += " " + to_string(s4) + " " + to_string(e4);
|
||||
}
|
||||
|
||||
if(cmd != "detRangeCfg -1") {
|
||||
std::vector<unsigned char> cmd_vec(cmd.begin(), cmd.end());
|
||||
ESP_LOGI("set_mmwave_distance", "Sending command to sensor %s", cmd.c_str());
|
||||
id(distance_zone_status).publish_state("Successfully sent to sensor! " + cmd.substr(14));
|
||||
return cmd_vec;
|
||||
} else {
|
||||
ESP_LOGE("set_mmwave_distance", "No valid segments configured. Please adjust the sliders.");
|
||||
id(distance_zone_status).publish_state("No valid segments configured. Please adjust the sliders.");
|
||||
return std::vector<unsigned char>();
|
||||
}
|
||||
- delay: 1s
|
||||
- uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
|
||||
- delay: 1s
|
||||
- switch.turn_on: mmwave_sensor
|
||||
|
||||
text_sensor:
|
||||
- platform: template
|
||||
name: "Distance Zones Status"
|
||||
id: "distance_zone_status"
|
||||
|
||||
custom_component:
|
||||
- lambda: |-
|
||||
auto my_custom = new Sen0395Distance(id(uart_bus));
|
||||
return {my_custom};
|
||||
@@ -1,26 +1,5 @@
|
||||
#include "esphome.h"
|
||||
|
||||
// protocol
|
||||
#define TUYA_COVER_MAX_LEN 640 // Max length of message value
|
||||
// #define TUYA_COVER_MAX_LEN 256 // Max length of message value
|
||||
#define TUYA_COVER_BUFFER_LEN 6 // Length of serial buffer for header + type + length
|
||||
#define TUYA_COVER_HEADER_LEN 2 // Length of fixed header
|
||||
|
||||
// enable/disable reversed motor direction
|
||||
// Normal = header (55AA) + (00060005) + 050100010011 "(55AA00060005050100010011)
|
||||
// Reversed = header (55AA) + (00060005) + 050100010112 "(55AA00060005050100010112)"
|
||||
#define TUYA_COVER_DISABLE_REVERSING { 0x69, 0x01, 0x00, 0x01, 0x00 } //dpid = 105, type = bool, len = 1, value = disable
|
||||
#define TUYA_COVER_ENABLE_REVERSING { 0x69, 0x01, 0x00, 0x01, 0x01 } //dpid = 105, type = bool, len = 1, value = enable
|
||||
// Curtain commands
|
||||
// Open = header (55AA) + (00060005) + 6604000100 "(55aa000600056604000100)"
|
||||
// Close = header (55AA) + (00060005) + 6604000101 "(55aa000600056604000101)"
|
||||
// Stop = header (55AA) + (00060005) + 6604000102 "(55AA000600056604000102)"
|
||||
#define TUYA_COVER_OPEN { 0x66, 0x04, 0x00, 0x01, 0x00 } //dpid = 101, type = enum, len = 1, value = OPEN
|
||||
#define TUYA_COVER_CLOSE { 0x66, 0x04, 0x00, 0x01, 0x01 } //dpid = 101, type = enum, len = 1, value = CLOSE
|
||||
#define TUYA_COVER_STOP { 0x66, 0x04, 0x00, 0x01, 0x02 } //dpid = 101, type = enum, len = 1, value = STOP
|
||||
|
||||
#define TUYA_COVER_SET_POSITION { 0x65, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 } //"65020004000000" //dpid = 2, type = value, len = 4, value = 0x000000 + 1 byte (0x00-0x64)
|
||||
|
||||
static const char *TAG = "TUYACOVER";
|
||||
static const uint16_t TUYA_COVER_HEADER = 0x55AA;
|
||||
//static const uint16_t TUYA_COVER_VERSION = 0x03;
|
||||
@@ -71,7 +50,7 @@ enum TUYACOVERdpidType
|
||||
};
|
||||
|
||||
// Variables
|
||||
TUYACOVERCommand command_{TUYA_COVER_HEADER, TUYA_COVER_VERSION, 0, 0, {}, 0};
|
||||
//TUYACOVERCommand command_{TUYA_COVER_HEADER, TUYA_COVER_VERSION, 0, 0, {}, 0};
|
||||
uint8_t uart_buffer_[TUYA_COVER_BUFFER_LEN]{0};
|
||||
|
||||
// Forward declarations
|
||||
|
||||
@@ -1,6 +1,32 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
std::map<std::string, std::string> moon_icon_map
|
||||
{
|
||||
{"first_quarter", "G"},
|
||||
{"full_moon", "1"},
|
||||
{"last_quarter", "T"},
|
||||
{"new_moon", "0"},
|
||||
{"waning_crescent", "W"},
|
||||
{"waning_gibbous", "Q"},
|
||||
{"waxing_crescent", "D"},
|
||||
{"waxing_gibbous", "J"},
|
||||
|
||||
};
|
||||
|
||||
std::map<std::string, std::string> moon_description
|
||||
{
|
||||
{"first_quarter", "Eerste kwartier"},
|
||||
{"full_moon", "Volle maan"},
|
||||
{"last_quarter", "Laatste kwartier"},
|
||||
{"new_moon", "Nieuwe maan"},
|
||||
{"waning_crescent", "Afnemende halve maan"},
|
||||
{"waning_gibbous", "Afnemende maan"},
|
||||
{"waxing_crescent", "Wassende halve maan"},
|
||||
{"waxing_gibbous", "Wassende maan"},
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Map weather states to MDI characters.
|
||||
std::map<std::string, std::string> weather_icon_map
|
||||
@@ -41,64 +67,4 @@ std::map<std::string, std::string> weather_icon_map
|
||||
|
||||
|
||||
|
||||
// #define ICON_w_clear_night "\U000F0594"
|
||||
// #define ICON_w_cloudy "\U000F0590"
|
||||
// #define ICON_w_fog "\U000F0591"
|
||||
// #define ICON_w_hail "\U000F0592"
|
||||
// #define ICON_w_lightning "\U000F0593"
|
||||
// #define ICON_w_lightning_rainy "\U000F067E"
|
||||
// #define ICON_w_night_partly_cloudy "\U000F0F31"
|
||||
// #define ICON_w_partly_cloudy "\U000F0595"
|
||||
// #define ICON_w_pouring "\U000F0596"
|
||||
// #define ICON_w_rainy "\U000F0597"
|
||||
// #define ICON_w_snowy "\U000F0F36"
|
||||
// #define ICON_w_snowy_rainy "\U000F067F"
|
||||
// #define ICON_w_sunny "\U000F0599"
|
||||
// #define ICON_w_windy "\U000F059D"
|
||||
// #define ICON_w_windy_variant "\U000F059E"
|
||||
// #define ICON_w_exceptional "\U000F0F38"
|
||||
|
||||
// std::string conditionToIcon(std::string condition, bool daytime)
|
||||
// {
|
||||
// if (condition == "clear") return ICON_w_clear_night;
|
||||
// if (condition == "clear-night") return ICON_w_clear_night;
|
||||
// if (condition == "cloudy") return ICON_w_cloudy;
|
||||
// if (condition == "dust") return ICON_w_fog;
|
||||
// if (condition == "dusty") return ICON_w_fog;
|
||||
// if (condition == "fog") return ICON_w_fog;
|
||||
// if (condition == "frost") return ICON_w_snowy;
|
||||
// if (condition == "hail") return ICON_w_hail;
|
||||
// if (condition == "haze") return ICON_w_fog;
|
||||
// if (condition == "hazy") return ICON_w_fog;
|
||||
// if (condition == "heavy_shower") return ICON_w_rainy;
|
||||
// if (condition == "heavy_showers") return ICON_w_rainy;
|
||||
// if (condition == "light_rain") return ICON_w_rainy;
|
||||
// if (condition == "light_showers") return ICON_w_rainy;
|
||||
// if (condition == "light_shower") return ICON_w_rainy;
|
||||
// if (condition == "lightning") return ICON_w_lightning;
|
||||
// if (condition == "lightning-rainy") return ICON_w_lightning_rainy;
|
||||
// if (condition == "mostly_sunny") return ICON_w_sunny;
|
||||
// if (condition == "night") return ICON_w_clear_night;
|
||||
// if (condition == "partlycloudy" && !daytime) return ICON_w_night_partly_cloudy;
|
||||
// if (condition == "partlycloudy" && daytime) return ICON_w_partly_cloudy;
|
||||
// if (condition == "partly_cloudy" && !daytime) return ICON_w_night_partly_cloudy;
|
||||
// if (condition == "partly_cloudy" && daytime) return ICON_w_partly_cloudy;
|
||||
// if (condition == "pouring") return ICON_w_pouring;
|
||||
// if (condition == "rain") return ICON_w_rainy;
|
||||
// if (condition == "rainy") return ICON_w_rainy;
|
||||
// if (condition == "shower") return ICON_w_rainy;
|
||||
// if (condition == "showers") return ICON_w_rainy;
|
||||
// if (condition == "snow") return ICON_w_snowy;
|
||||
// if (condition == "snowy") return ICON_w_snowy;
|
||||
// if (condition == "snowy-rainy") return ICON_w_snowy_rainy;
|
||||
// if (condition == "storm") return ICON_w_lightning_rainy;
|
||||
// if (condition == "storms") return ICON_w_lightning_rainy;
|
||||
// if (condition == "sunny") return ICON_w_sunny;
|
||||
// if (condition == "wind") return ICON_w_windy;
|
||||
// if (condition == "windy") return ICON_w_windy;
|
||||
// if (condition == "windy-variant") return ICON_w_windy_variant;
|
||||
// if (condition == "exceptional") return ICON_w_exceptional;
|
||||
// return "";
|
||||
// }
|
||||
|
||||
|
||||
42
esphome/include/text_utils.h
Normal file
42
esphome/include/text_utils.h
Normal file
@@ -0,0 +1,42 @@
|
||||
int GetTextBounds(esphome::display::Display* it, esphome::font::Font *font, const char *buffer)
|
||||
{
|
||||
int x1 = 0; // A pointer to store the returned x coordinate of the upper left corner in.
|
||||
int y1 = 0; // A pointer to store the returned y coordinate of the upper left corner in.
|
||||
int width = 0; // A pointer to store the returned text width in.
|
||||
int height = 0; // A pointer to store the returned text height in.
|
||||
it->get_text_bounds(0, 0, buffer, font, TextAlign::TOP_LEFT, &x1, &y1, &width, &height);
|
||||
return width;
|
||||
}
|
||||
|
||||
int GetTextWidth(esphome::display::Display* it, esphome::font::Font *font, const char* formatting, const char *raw_text){
|
||||
char temp_buffer[80];
|
||||
sprintf(temp_buffer, formatting, raw_text);
|
||||
return GetTextBounds(it, font, temp_buffer);
|
||||
}
|
||||
|
||||
int GetTextWidth(esphome::display::Display* it, esphome::font::Font *font, const char* formatting){
|
||||
char temp_buffer[80];
|
||||
sprintf(temp_buffer, formatting);
|
||||
return GetTextBounds(it, font, temp_buffer);
|
||||
}
|
||||
|
||||
int GetTextWidth(esphome::display::Display* it, esphome::font::Font *font, const char* formatting, float& raw_text){
|
||||
char temp_buffer[80];
|
||||
sprintf(temp_buffer, formatting, raw_text);
|
||||
return GetTextBounds(it, font, temp_buffer);
|
||||
}
|
||||
|
||||
int GetTextWidth(esphome::display::Display* it, esphome::font::Font *font, const char* formatting, float& raw_text1, float& raw_text2){
|
||||
char temp_buffer[80];
|
||||
sprintf(temp_buffer, formatting, raw_text1, raw_text2);
|
||||
return GetTextBounds(it, font, temp_buffer);
|
||||
}
|
||||
|
||||
// Calculate the width of time format
|
||||
int GetTextWidth(esphome::display::Display* it, esphome::font::Font *font, const char* formatting, esphome::ESPTime time){
|
||||
auto c_tm = time.to_c_tm();
|
||||
size_t buffer_length = 80;
|
||||
char temp_buffer[buffer_length];
|
||||
strftime(temp_buffer, buffer_length, formatting, &c_tm);
|
||||
return GetTextBounds(it, font, temp_buffer);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ sensor:
|
||||
humidity:
|
||||
name: "Humidity"
|
||||
accuracy_decimals: 1
|
||||
temperature_offset: 1.5 °C
|
||||
temperature_offset: 0 °C
|
||||
address: 0x61
|
||||
update_interval: 5s
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ sensor:
|
||||
- platform: "tuya"
|
||||
name: "humidity"
|
||||
sensor_datapoint: 102
|
||||
unit_of_measurement: "%rh"
|
||||
unit_of_measurement: "%"
|
||||
device_class: "humidity"
|
||||
state_class: "measurement"
|
||||
accuracy_decimals: 1
|
||||
@@ -7,6 +7,8 @@ substitutions:
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
wifi_ssid2: !secret wifi_ssid2
|
||||
wifi_password2: !secret wifi_password2
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret slaaptrainer_ip
|
||||
|
||||
44
esphome/slaap-trainer_Luuk.yaml
Normal file
44
esphome/slaap-trainer_Luuk.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
substitutions:
|
||||
device_name: "slaaptrainer_luuk"
|
||||
friendly_name: "slaaptrainer Luuk"
|
||||
comment: "esp-C3, RGBled"
|
||||
api_password: !secret slaaptrainer_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
wifi_ssid2: !secret wifi_ssid2
|
||||
wifi_password2: !secret wifi_password2
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret slaaptrainer_luuk_ip
|
||||
location: "slaapkamer Luuk"
|
||||
board: "esp32-c3-devkitm-1"
|
||||
framework: esp-idf
|
||||
pin_led1: GPIO09
|
||||
num_leds: "36"
|
||||
chipset: WS2812
|
||||
is_rgbw: "false"
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32-gen.yaml
|
||||
connection: !include common/wifi.yaml
|
||||
device_base: !include common/common.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
leds: !include templates/light_rgbw_rmt.yaml
|
||||
colororange: !include color/COLOR_CSS_ORANGE
|
||||
colorgreen: !include color/COLOR_CSS_GREEN
|
||||
colorred: !include color/COLOR_CSS_RED
|
||||
|
||||
|
||||
# time:
|
||||
# - platform: sntp
|
||||
# on_time:
|
||||
# # Every morning on weekdays
|
||||
# - seconds: 0
|
||||
# minutes: 00
|
||||
# hours: 7
|
||||
# days_of_week: MON-FRI
|
||||
# then:
|
||||
# - light.turn_on: my_light
|
||||
|
||||
|
||||
21
esphome/templates/LedWithEffects.yaml
Normal file
21
esphome/templates/LedWithEffects.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
light:
|
||||
- platform: monochromatic
|
||||
id: ${entityID}
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
output: ${entityID}_out
|
||||
name: ${entityName}
|
||||
effects:
|
||||
- flicker:
|
||||
name: "Flicker"
|
||||
alpha: 95%
|
||||
intensity: 1.5%
|
||||
on_turn_on:
|
||||
- light.turn_on:
|
||||
id: led_light1
|
||||
effect: flicker
|
||||
brightness: 75%
|
||||
|
||||
output:
|
||||
- platform: ledc
|
||||
pin: ${pin_led}
|
||||
id: ${entityID}_out
|
||||
@@ -21,18 +21,6 @@ light:
|
||||
it.range(1, x) = Color(0,255,0);
|
||||
x += 1;
|
||||
}
|
||||
# - addressable_color_wipe:
|
||||
# name: "Wipe In-green"
|
||||
# colors:
|
||||
# - red: 0%
|
||||
# green: 100%
|
||||
# blue: 0%
|
||||
# num_leds: 6
|
||||
# gradient: true
|
||||
# add_led_interval: 25714ms
|
||||
# reverse: false
|
||||
|
||||
|
||||
- addressable_lambda:
|
||||
name: star-orange
|
||||
update_interval: 12ms
|
||||
@@ -45,4 +33,13 @@ light:
|
||||
if (x < it.size()) {
|
||||
it[x] = COLOR_CSS_ORANGE;
|
||||
x += 5;
|
||||
}
|
||||
}
|
||||
- random:
|
||||
name: "Random"
|
||||
transition_length: 4s
|
||||
update_interval: 5s
|
||||
- addressable_rainbow:
|
||||
name: Rainbow Effect
|
||||
speed: 100
|
||||
width: 50
|
||||
- addressable_flicker:
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
rmt_channel: 0
|
||||
is_rgbw: True
|
||||
#rmt_channel: 0
|
||||
is_rgbw: ${is_rgbw}
|
||||
id: led_lights
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
name: ${device_name}_leds
|
||||
@@ -14,4 +14,52 @@ light:
|
||||
- flicker:
|
||||
name: "Flicker"
|
||||
alpha: 95%
|
||||
intensity: 1.5%
|
||||
intensity: 1.5%
|
||||
- addressable_lambda:
|
||||
name: "Wipe In-green"
|
||||
update_interval: 25714ms
|
||||
lambda: |-
|
||||
static int x = 0;
|
||||
if (initial_run) {
|
||||
x = 0;
|
||||
it[x] = Color(0,255,0);
|
||||
}
|
||||
if (x < it.size()) {
|
||||
it.range(1, x) = Color(0,255,0);
|
||||
x += 1;
|
||||
}
|
||||
- addressable_lambda:
|
||||
name: star-orange
|
||||
update_interval: 12ms
|
||||
lambda: |-
|
||||
static int x = 0;
|
||||
if (initial_run) {
|
||||
x = 0;
|
||||
it.all() = Color::BLACK;
|
||||
}
|
||||
if (x < it.size()) {
|
||||
it[x] = COLOR_CSS_ORANGE;
|
||||
x += 5;
|
||||
}
|
||||
- addressable_lambda:
|
||||
name: star-red
|
||||
update_interval: 12ms
|
||||
lambda: |-
|
||||
static int x = 0;
|
||||
if (initial_run) {
|
||||
x = 0;
|
||||
it.all() = Color::BLACK;
|
||||
}
|
||||
if (x < it.size()) {
|
||||
it[x] = COLOR_CSS_RED;
|
||||
x += 5;
|
||||
}
|
||||
- random:
|
||||
name: "Random"
|
||||
transition_length: 4s
|
||||
update_interval: 5s
|
||||
- addressable_rainbow:
|
||||
name: Rainbow Effect
|
||||
speed: 100
|
||||
width: 50
|
||||
- addressable_flicker:
|
||||
@@ -7,5 +7,9 @@ logger:
|
||||
cover: ERROR
|
||||
switch: ERROR
|
||||
wifi: ERROR
|
||||
light: ERROR
|
||||
pulse_counter: ERROR
|
||||
remote_receiver: DEBUG
|
||||
remote_receiver: DEBUG
|
||||
binary_sensor: WARN
|
||||
on sensor: ERROR
|
||||
tsl2591: WARN
|
||||
161
esphome/uzg-poe-dr.yaml
Normal file
161
esphome/uzg-poe-dr.yaml
Normal file
@@ -0,0 +1,161 @@
|
||||
esphome:
|
||||
name: tubeszb-dual-radio-kit-cc2652
|
||||
project:
|
||||
name: tubezb.cc2652+zw
|
||||
version: "3.0"
|
||||
on_boot:
|
||||
priority: 600
|
||||
then:
|
||||
- switch.turn_on: zRST_gpio
|
||||
- delay: 15ms
|
||||
- switch.turn_off: zRST_gpio
|
||||
- lambda: |-
|
||||
id(mdns0).add_extra_service({ "_zigbee-coordinator", "_tcp", 6638, {{"radio_type", "znp"}, {"name", "TubesZB"},{"serial_number", get_mac_address()}} });
|
||||
id(mdns0).add_extra_service({ "_zwave", "_tcp", 6639, {{"version", "1.0"}, {"name", "TubesZB"},{"serial_number", get_mac_address()}} });
|
||||
esp32:
|
||||
board: esp32-poe
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
external_components:
|
||||
- source: github://oxan/esphome-stream-server
|
||||
|
||||
|
||||
#Olimex ESP32-PoE Ethernet
|
||||
ethernet:
|
||||
type: LAN8720
|
||||
mdc_pin: GPIO23
|
||||
mdio_pin: GPIO18
|
||||
clk_mode: GPIO17_OUT
|
||||
phy_addr: 0
|
||||
power_pin: GPIO5
|
||||
|
||||
# Optional manual IP
|
||||
# manual_ip:
|
||||
# static_ip: STATIC_IP
|
||||
# gateway: GATEWAY
|
||||
# subnet: SUBNET
|
||||
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
reboot_timeout: 0s
|
||||
|
||||
ota:
|
||||
platform: esphome
|
||||
|
||||
web_server:
|
||||
port: 80
|
||||
local: true
|
||||
|
||||
|
||||
script:
|
||||
- id: fw_update_mode
|
||||
then:
|
||||
- switch.turn_on: zBSL
|
||||
- delay: 1s
|
||||
- switch.turn_on: zRST_gpio
|
||||
- delay: 1s
|
||||
- switch.turn_off: zRST_gpio
|
||||
- logger.log: "Delaying ~10 seconds for cc2652p2 to settle"
|
||||
- delay: 11s
|
||||
- switch.turn_off: zBSL
|
||||
- logger.log: "Please try update with cc2538-bsl tool now"
|
||||
- logger.log: "cc-bsl usage: cc2538-bsl.py -p socket://ip-of-gw:6638 -evw firmware.hex"
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
pin: 16
|
||||
id: zRST_gpio
|
||||
inverted: no
|
||||
restore_mode: ALWAYS_OFF
|
||||
|
||||
- platform: gpio
|
||||
pin: 33
|
||||
id: z_mode
|
||||
restore_mode: ALWAYS_OFF
|
||||
name: "zigbee-uart mode"
|
||||
on_turn_on:
|
||||
then:
|
||||
- light.turn_on: usb_led
|
||||
on_turn_off:
|
||||
then:
|
||||
- light.turn_off: usb_led
|
||||
|
||||
- platform: gpio
|
||||
pin: 15
|
||||
name: "Zigbee Module Bootloader Pin"
|
||||
id: zBSL
|
||||
inverted: no
|
||||
restore_mode: ALWAYS_OFF
|
||||
disabled_by_default: false
|
||||
|
||||
output:
|
||||
- platform: gpio
|
||||
pin: GPIO12
|
||||
id: LED_USB
|
||||
|
||||
button:
|
||||
- platform: restart
|
||||
name: "Restart the ESP32 Device"
|
||||
|
||||
- platform: template
|
||||
name: "Trigger Zigbee Module Reset"
|
||||
disabled_by_default: false
|
||||
id: zRST
|
||||
on_press:
|
||||
- switch.turn_on: zRST_gpio
|
||||
- delay: 15ms
|
||||
- switch.turn_off: zRST_gpio
|
||||
|
||||
- platform: template
|
||||
name: "Trigger Zigbee Module Bootloader"
|
||||
disabled_by_default: false
|
||||
on_press:
|
||||
- script.execute: fw_update_mode
|
||||
|
||||
light:
|
||||
- platform: status_led
|
||||
name: "state"
|
||||
pin: GPIO14
|
||||
- platform: binary
|
||||
name: "usb_led"
|
||||
output: LED_USB
|
||||
id: usb_led
|
||||
|
||||
uart:
|
||||
- id: uart_bus_zb
|
||||
rx_pin: GPIO36
|
||||
tx_pin: GPIO4
|
||||
baud_rate: 115200
|
||||
# rx_buffer_size: 1024
|
||||
- id: uart_bus_zw
|
||||
rx_pin: GPIO13
|
||||
tx_pin: GPIO2
|
||||
baud_rate: 115200
|
||||
|
||||
stream_server:
|
||||
- id: zb
|
||||
uart_id: uart_bus_zb
|
||||
port: 6638 # optional, default is 6638
|
||||
# buffer_size: 1024
|
||||
- id: zw
|
||||
uart_id: uart_bus_zw
|
||||
port: 6639
|
||||
|
||||
binary_sensor:
|
||||
- platform: stream_server
|
||||
stream_server: zb
|
||||
connected:
|
||||
name: "TubesZB Zigbee Serial Connected"
|
||||
- platform: stream_server
|
||||
stream_server: zw
|
||||
connected:
|
||||
name: "TubesZB Z-Wave Serial Connected"
|
||||
|
||||
mdns:
|
||||
id: mdns0
|
||||
@@ -7,6 +7,8 @@ substitutions:
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
wifi_ssid2: !secret wifi_ssid2
|
||||
wifi_password2: !secret wifi_password2
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret zemismart_curtain_ip
|
||||
@@ -23,20 +25,18 @@ packages:
|
||||
uart:
|
||||
- !include interfaces/uart_tywe1s.yaml
|
||||
|
||||
esphome:
|
||||
includes:
|
||||
- include/bcm500ds.h
|
||||
# esphome:
|
||||
# includes:
|
||||
# - include/bcm500ds.h
|
||||
|
||||
external_components:
|
||||
- source: components
|
||||
components: [ tuya_cover ]
|
||||
|
||||
cover:
|
||||
- platform: custom
|
||||
lambda: |-
|
||||
auto curtain = new CustomCurtain();
|
||||
App.register_component(curtain);
|
||||
return {curtain};
|
||||
covers:
|
||||
- name: Curtain
|
||||
device_class: curtain
|
||||
platform: tuya_cover
|
||||
name: Tuya cover
|
||||
|
||||
custom_component:
|
||||
- lambda: |-
|
||||
return { new CustomAPI() };
|
||||
# custom_component:
|
||||
# - lambda: |-
|
||||
# return { new CustomAPI() };
|
||||
|
||||
@@ -5,8 +5,8 @@ substitutions:
|
||||
location: "hass"
|
||||
api_password: !secret zigbee_server_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
# wifi_ssid: !secret wifi_ssid
|
||||
# wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
dns1: !secret ip_dns1
|
||||
@@ -25,10 +25,8 @@ substitutions:
|
||||
|
||||
packages:
|
||||
board: !include boards/esp32_wroom_arduino.yaml
|
||||
# connection: !include common/wifi.yaml
|
||||
device_base: !include common/common.yaml
|
||||
ethernet: !include interfaces/eth_LAN8720A.yaml
|
||||
bt_proxy: !include common/bluetooth.yaml
|
||||
|
||||
ota: !include common/ota.yaml
|
||||
logger: !include templates/nologger.yaml
|
||||
@@ -39,17 +37,6 @@ external_components:
|
||||
- source: github://tube0013/esphome-stream-server-v2
|
||||
- source: github://syssi/esphome-zeroconf@main
|
||||
|
||||
# web_server:
|
||||
# port: 80
|
||||
|
||||
# switch:
|
||||
# - platform: gpio
|
||||
# pin: ${pin_efrReset}
|
||||
# id: zRST_gpio
|
||||
# inverted: yes
|
||||
# restore_mode: ALWAYS_OFF
|
||||
|
||||
|
||||
button:
|
||||
- platform: restart
|
||||
name: "Restart the Gateway"
|
||||
|
||||
Reference in New Issue
Block a user