Skip to content

Commit

Permalink
Merge pull request #12 from athom-tech/main
Browse files Browse the repository at this point in the history
sycn
  • Loading branch information
tarontop authored Jul 14, 2023
2 parents 4f70577 + 2df6c3e commit 92576cb
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 46 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- cb02
- ls-4p-3wire
- ls-4p-4wire
- presence-sensor
esphome:
- latest
- beta
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- cb02
- ls-4p-3wire
- ls-4p-4wire
- presence-sensor
steps:
- name: Checkout source
uses: actions/checkout@v3.2.0
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ If you are prompted that there is not enough space, you should upgrade `ESP8266_

# Migrating to Tasmota

- Select firmware upgrade, upload `tasmota.bin.gz` and click Update, Please don't choose tasmota.bin!!!
- Select firmware upgrade, upload `tasmota.bin.gz` and click Update, ***Please don't choose `tasmota.bin`***
- Download Tasmota firmware here http://ota.tasmota.com/tasmota/release/tasmota.bin.gz

# Migrating from Tasmota

- First execute `SetOption78 1` in the console of Tasmota
- Select firmware upgrade, upload `tasmota-minimal.bin.gz` and click start upgrade
- Select the firmware upgrade again, upload the firmware of ESPHome and click to start upgrade
- Download ESPHome firmware here https://github.com/athom-tech/athom-configs/actions

# Device List
device|picture|file name|notice
Expand All @@ -38,6 +37,6 @@ Athom_High_Power_RGBW_Light_Strip_Controller|<img src="/images/Athom_RGBW_Contro
Athom_High_Power_Addressable_Light_Strip_Controller|<img src="/images/Athom_4Pin_Controller.png" width="50%" height="20%">|athom-ls-4p-3wire.yaml
Athom_Mini_Switch|<img src="/images/Athom_Mini_Relay.png" width="50%" height="20%">|athom-mini-switch.yaml
Athom_CB02_Switch|<img src="/images/Athom_CB02.png" width="50%" height="20%">|athom-cb02.yaml
Athom_Presence_Sensor|<img src="/images/Athom_Presence_Sensor.png" width="50%" height="40%">|athom-presence-sensor.yaml
Athom_Garage_Door_Opener|<img src="/images/Athom_Garage_Door_Opener.png" width="50%" height="20%">|athom-garage-door.yaml
Athom_Plug|<img src="/images/Athom_EU_Plug.png" width="50%" height="20%">|athom-smart-plug.yaml|<h4>Discontinued</h4>
- Download ESPHome firmware here https://github.com/athom-tech/athom-configs/actions
Athom_Plug|<img src="/images/Athom_EU_Plug.png" width="50%" height="20%"><img src="/images/Athom_UK_Plug.png" width="50%" height="20%">|athom-smart-plug.yaml|<h4>Discontinued</h4>
53 changes: 25 additions & 28 deletions athom-presence-sensor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ switch:
internal: true
entity_category: config
optimistic: true
restore_state: true
restore_state: false
turn_on_action:
- uart.write: "sensorStart\r\n"
turn_off_action:
Expand All @@ -158,8 +158,8 @@ switch:

number:
- platform: template
name: mmWave detection distance #Value range: 1.9 ~ 12m Default: 6
id: Detection_Distance
name: Farthest Detection #Value range: 1.9 ~ 12m Default: 6
id: Farthest_Detection
entity_category: config
min_value: 1.9
max_value: 12
Expand All @@ -173,16 +173,16 @@ number:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda
std::string ranges = "setRange 1.8 " + to_string(id(Detection_Distance).state) + "\r\n";
return std::vector<unsigned char>(ranges.begin(), ranges.end());
std::string ranges = "setRange 1.8 " + str_sprintf("%.1f",id(Farthest_Detection).state) + "\r\n";
return std::vector<uint8_t>(ranges.begin(), ranges.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor


- platform: template
name: mmWave maintain sensitivity #Value range: 0 ~ 9 Default Maintain sensitivity: 7 Default Trigger sensitivity: 5
name: Maintain Sensitivity #Value range: 0 ~ 9 Default Maintain sensitivity: 7 Default Trigger sensitivity: 5
id: Maintain_Sensitivity
entity_category: config
min_value: 0
Expand All @@ -196,16 +196,16 @@ number:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda
std::string ranges = "setSensitivity " + to_string(id(Maintain_Sensitivity).state) + " " + to_string(id(Trigger_Sensitivity).state) + "\r\n";
return std::vector<unsigned char>(ranges.begin(), ranges.end());
std::string sensitivitys = "setSensitivity " + str_sprintf("%.0f",id(Maintain_Sensitivity).state) + " " + str_sprintf("%.0f",id(Trigger_Sensitivity).state) + "\r\n";
return std::vector<uint8_t>(sensitivitys.begin(), sensitivitys.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor


- platform: template
name: mmWave tigger sensitivity #Value range: 0 ~ 9 Default Maintain sensitivity: 7 Default Trigger sensitivity: 5
name: Trigger Sensitivity #Value range: 0 ~ 9 Default Maintain sensitivity: 7 Default Trigger sensitivity: 5
id: Trigger_Sensitivity
entity_category: config
min_value: 0
Expand All @@ -219,17 +219,17 @@ number:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda
std::string ranges = "setSensitivity " + to_string(id(Maintain_Sensitivity).state) + " " + to_string(id(Trigger_Sensitivity).state) + "\r\n";
return std::vector<unsigned char>(ranges.begin(), ranges.end());
std::string sensitivityss = "setSensitivity " + str_sprintf("%.0f",id(Maintain_Sensitivity).state) + " " + str_sprintf("%.0f",id(Trigger_Sensitivity).state) + "\r\n";
return std::vector<uint8_t>(sensitivityss.begin(), sensitivityss.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor


- platform: template
name: mmWave confirmation delay #Confirmation delay Value range: 0 ~ 100 default 0.050 seconds.
id: confirmation_delay
name: Detection Delay #Confirmation delay Value range: 0 ~ 100 default 0.050 seconds.
id: Detection_Delay
entity_category: config
min_value: 0.1
max_value: 60
Expand All @@ -243,16 +243,16 @@ number:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda |-
std::string mss = "setLatency " + to_string(id(confirmation_delay).state) + " " + to_string(id(disappear_delay).state) + "\r\n";
return std::vector<unsigned char>(mss.begin(), mss.end());
std::string detections = "setLatency " + str_sprintf("%.1f",id(Detection_Delay).state) + " " + str_sprintf("%.0f",id(Fading_Time).state) + "\r\n";
return std::vector<uint8_t>(detections.begin(),detections.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor

- platform: template
name: mmWave disappear delay #Fade-out delay Value range: 0.5 ~ 1500, default 15 seconds.
id: disappear_delay
name: Fading Time #Fade-out delay Value range: 0.5 ~ 1500, default 15 seconds.
id: Fading_Time
entity_category: config
min_value: 1
max_value: 300
Expand All @@ -266,17 +266,17 @@ number:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda |-
std::string mss = "setLatency " + to_string(id(confirmation_delay).state) + " " + to_string(id(disappear_delay).state) + "\r\n";
return std::vector<unsigned char>(mss.begin(), mss.end());
std::string fadings = "setLatency " + str_sprintf("%.1f",id(Detection_Delay).state) + " " + str_sprintf("%.0f",id(Fading_Time).state) + "\r\n";
return std::vector<uint8_t>(fadings.begin(), fadings.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor


- platform: template
name: mmWave inhibit
id: SetInhibit
- platform: template
name: Blockade Time #Configure block time Value range: 1 ~ 255, default 1 seconds.
id: Blockade_Time
entity_category: config
min_value: 1
max_value: 255
Expand All @@ -290,18 +290,14 @@ number:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda
std::string ranges = "setInhibit " + to_string(id(SetInhibit).state) + "\r\n";
return std::vector<unsigned char>(ranges.begin(), ranges.end());
std::string blockades = "setInhibit " + str_sprintf("%.0f",x) + "\r\n";
return std::vector<uint8_t>(blockades.begin(), blockades.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor

button:
- platform: safe_mode
name: "Safe Mode"
internal: false

- platform: factory_reset
name: Restart with Factory Default Settings
id: Reset
Expand Down Expand Up @@ -352,3 +348,4 @@ text_sensor:
time:
- platform: sntp
id: my_time

33 changes: 19 additions & 14 deletions athom-smart-plug-v2.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
substitutions:
device_name: "athom-smart-plug-v2"
project_name: "Athom Technology.Smart Plug V2"
friendly_name: "Athom Smart Plug V2"
project_name: "athom.smart-plug-v2"
project_version: "1.1"
relay_restore_mode: RESTORE_DEFAULT_OFF

esphome:
name: "${device_name}"
friendly_name: ""
name_add_mac_suffix: true
project:
name: "${project_name}"
Expand Down Expand Up @@ -52,14 +52,14 @@ globals:

binary_sensor:
- platform: status
name: "Status"
name: "${friendly_name} Status"

- platform: gpio
pin:
number: 5
mode: INPUT_PULLUP
inverted: true
name: "Power Button"
name: "${friendly_name} Power Button"
disabled_by_default: true
on_multi_click:
- timing:
Expand All @@ -74,27 +74,27 @@ binary_sensor:

sensor:
- platform: uptime
name: "Uptime Sensor"
name: "${friendly_name} Uptime Sensor"

- platform: cse7766
update_interval: 10s
current:
name: "Current"
name: "${friendly_name} Current"
filters:
- lambda: if (x < 0.060) return 0.0; else return x; #For the chip will report less than 3w power when no load is connected


voltage:
name: "Voltage"
name: "${friendly_name} Voltage"
power:
name: "Power"
name: "${friendly_name} Power"
id: power_sensor
filters:
- lambda: if (x < 3.0) return 0.0; else return x; #For the chip will report less than 3w power when no load is connected


energy:
name: "Energy"
name: "${friendly_name} Energy"
id: energy
unit_of_measurement: kWh
filters:
Expand All @@ -109,7 +109,7 @@ sensor:
previous_energy_value = current_energy_value;
- platform: template
name: "Total Energy"
name: "${friendly_name} Total Energy"
unit_of_measurement: kWh
device_class: "energy"
state_class: "total_increasing"
Expand All @@ -120,7 +120,7 @@ sensor:
update_interval: 10s

- platform: total_daily_energy
name: "Total Daily Energy"
name: "${friendly_name} Total Daily Energy"
restore: true
power_id: power_sensor
unit_of_measurement: kWh
Expand All @@ -131,23 +131,28 @@ sensor:

button:
- platform: factory_reset
name: "Reset"
name: "Restart with Factory Default Settings"
id: Reset

- platform: safe_mode
name: "Safe Mode"
internal: false

- platform: safe_mode
name: "Safe Mode"
internal: false

switch:
- platform: gpio
name: "Plug V2"
name: "${friendly_name}"

pin: GPIO12
id: relay
restore_mode: ${relay_restore_mode}

light:
- platform: status_led
name: "Status LED"
name: "${friendly_name} Status LED"
id: blue_led
disabled_by_default: true
pin:
Expand Down
Binary file added images/Athom_Presence_Sensor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 92576cb

Please sign in to comment.