Skip to content

Commit

Permalink
v2.7.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdhjd committed Dec 23, 2024
1 parent 38c90b8 commit 5ec90ad
Show file tree
Hide file tree
Showing 11 changed files with 319 additions and 104 deletions.
3 changes: 3 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to this project will be documented in this file. This project uses [semantic versioning](https://semver.org/).

## 2.7.1 (2024-12-23)
* Housekeeping and documentation updates, including a new YAML configuration for ESP32-based Ratgdo devices like Ratgdo Disco.

## 2.7.0 (2024-12-21)
* Breaking change: Since node 18 is now EOL, node 20 is now the minimum required version.
* Housekeeping.
Expand Down
1 change: 1 addition & 0 deletions docs/FeatureOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ Feature options provide a rich mechanism for tailoring your `homebridge-ratgdo`
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| `Konnected.Switch.PCW` | Add a switch accessory to control the pre-close warning feature on Konnected openers. This can be useful in automation scenarios. **(default: disabled)**.
| `Konnected.Switch.Strobe` | Add a switch accessory to control the strobe setting on Konnected openers. **(default: disabled)**.

7 changes: 3 additions & 4 deletions esphome/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
> [!CAUTION]
> * You're on your own here. I provide no support for any of the configuration files or firmware provided here. It's here as a convenience and for you to explore and customize some cosmetic aspects of HBR. Please don't open issues regarding anything on this page - I will close them without comment. You're welcome to come to the Discord and ask questions there and I'll address them as best I can.
> * You should be familiar and comfortable with the command line and modifying configuration files.
> * **These configuration files and instructions are specific to Ratgdo 2.5 series devices. They cannot be used for ESP32-based devices like Ratgdo Disco.**
> [!TIP]
> If you would like to tailor your experience a bit further, you can choose to use the [hombridge-ratgdo ESPHome YAML configuration file](https://github.com/hjdhjd/homebridge-ratgdo/blob/main/esphome/homebridge-ratgdo.yaml) and use it to create a more customized Ratgdo ESPHome firmware. Using this firmware allows you to do the following things for those using Ratgdo hardware revision 2.5 or beyond:
Expand All @@ -37,10 +36,10 @@
> There are multiple ways to install a custom Homebridge Ratgdo ESPHome firmware:
>
> * Use the ESPHome firmware I've provided here as a convenience. It is v2024.6.6 compiled with the `homebridge-ratgdo.yaml`. To install it this way:
> * If you can access the Ratgdo ESPHome webUI and can perform an OTA update, you can upload the [homebridge-ratgdo-2024.6.6.bin](https://raw.githubusercontent.com/hjdhjd/homebridge-ratgdo/main/esphome/homebridge-ratgdo-2024.6.6.bin).
> * If you can access the Ratgdo ESPHome webUI and can perform an OTA update, you can upload the [homebridge-ratgdo-2024.12.2.bin](https://raw.githubusercontent.com/hjdhjd/homebridge-ratgdo/main/esphome/homebridge-ratgdo-2024.12.2.bin) or [homebridge-ratgdo32-2024.12.2.bin](https://raw.githubusercontent.com/hjdhjd/homebridge-ratgdo/main/esphome/homebridge-ratgdo32-2024.12.2.bin), depending on which Ratgdo hardware variant you have.
> * If the Ratgdo ESPHome webUI is unavailable, you'll need to either use the [ESPHome web dashboard](https://web.esphome.io) or the ESPHome tools to install the firmware and physical access to the Ratgdo. To do this:
> * Plug your Ratgdo to the machine you're working on using a USB cable.
> * Either use the [ESPHome web dashboard](https://web.esphome.io) or install the ESPHome tools if needed (e.g. on macOS `brew install esphome`).
> * Download both the [homebridge-ratgdo-2024.6.6.bin](https://raw.githubusercontent.com/hjdhjd/homebridge-ratgdo/main/esphome/homebridge-ratgdo-2024.6.6.bin) and the [homebridge-ratgdo.yml](https://github.com/hjdhjd/homebridge-ratgdo/blob/main/esphome/homebridge-ratgdo.yaml) files.
> * Download both the [homebridge-ratgdo-2024.12.2.bin](https://raw.githubusercontent.com/hjdhjd/homebridge-ratgdo/main/esphome/homebridge-ratgdo-2024.12.2.bin) and the [homebridge-ratgdo.yaml](https://github.com/hjdhjd/homebridge-ratgdo/blob/main/esphome/homebridge-ratgdo.yaml) or the [homebridge-ratgdo32.yaml](https://github.com/hjdhjd/homebridge-ratgdo/blob/main/esphome/homebridge-ratgdo.yaml) files, depending on which Ratgdo hardware variant you have.
> * If you're using the ESPHome web dashboard, go through the steps to upload the firmware you downloaded in the previous step.
> * If you're using the ESPHome tools, run the following command: `esphome upload --file homebridge-ratgdo-2024.6.6.bin homebridge-ratgdo.yaml`.
> * If you're using the ESPHome tools, run the following command: `esphome upload --file homebridge-ratgdo-2024.12.2.bin homebridge-ratgdo.yaml` or `esphome upload --file homebridge-ratgdo32-2024.12.2.bin homebridge-ratgdo32.yaml`, depending on which Ratgdo hardware variant you have.
Binary file added esphome/homebridge-ratgdo-2024.12.2.bin
Binary file not shown.
Binary file removed esphome/homebridge-ratgdo-2024.6.6.bin
Binary file not shown.
Binary file added esphome/homebridge-ratgdo32-2024.12.2.bin
Binary file not shown.
239 changes: 239 additions & 0 deletions esphome/homebridge-ratgdo32.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
# This is a customized configuration YAML file for [homebridge-ratgdo](https://github.com/hjdhjd/homebridge-ratgdo) that deviates slightly from the
# default YAML provided by Ratgdo32 ESPHome. It is specific to those with Ratgdo ESP32 hardware revisions of v32disco or greater. For those running other
# hardware versions, you can use this as a basis for your own, but it is beyond the support I will be providing.
#
# The changes in this configuration file include:
#
# - The ability to customize the name (and friendly name) of the Ratgdo device. Though cosmetic, it can be helpful when you have multiple Ratgdo devices.
# - Uses SNTP to set the time on the Ratgdo device. Not strictly necessary, but good hygeine.
# - Allows you to configure the timezone either yourself or automatically. The timezone will be autoconfigured using the World Time API geoIP by default.
# - Set the interval to check for updates from the Ratgdo repository to every 6 hours instead of the Ratgdo default of every second.
#
# You can customize the settings to your taste in the substitutions section. On macOS, you can install this configuration file using the following
# command:
#
# NOTE: automatic timezone determination is currently not working in recent ESP32 ESPHome firmwares due to startup scripts not being run. You'll need to
# set the timezone manually.
#
# ```sh
# brew install esphome
# esphome run homebridge-ratgdo32.yaml --no-logs --device 1.2.3.4
# ```
#
# To install the ESPHome tools on macOS (assuming you use [Homebrew](https://brew.sh):
#
# ```sh
# brew install esphome
# ```
#
# For other platforms, you can search online for how to install the ESPHome tools.
---
substitutions:

# Unique name for this Ratgdo ESPHome device. Must be no more than 31 characters or 24 characters if you append the MAC address to the name below.
name: "homebridge-ratgdo"

# Append the MAC address suffix to the ESPHome device name. I leave this disabled because I use unique names for each Ratgdo device. You might prefer
# differently. If you do, it reduces the length available for the name field to 24 characters.
name_add_mac_suffix: "false"

# Friendly name that is used in the Ratgdo webUI.
friendly_name: "Homebridge Ratgdo"

# Defaults to UTC - Homebridge Ratgdo will automatically determine the timezone based on geographic IP address information.
# Otherwise, set it manually to your timezone to override automatic timezone detection. You can select a TZ identifier for your timezone from the list at
# the [Wikipedia list of timezone database names](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
#
# NOTE: automatic timezone determination is currently not working in recent ESP32 ESPHome firmwares due to startup scripts not being run. You'll need to
# set the timezone manually.
timezone: "UTC"

id_prefix: ratgdo32disco
uart_tx_pin: GPIO17
uart_rx_pin: GPIO21
input_obst_pin: GPIO4
status_door_pin: GPIO26
status_obstruction_pin: GPIO25
dry_contact_open_pin: GPIO13
dry_contact_close_pin: GPIO14
dry_contact_light_pin: GPIO27

web_server:

esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: ${name_add_mac_suffix}
project:
name: ratgdo.esphome
version: "32disco"
on_boot:
priority: -100
then:
- logger.log: "Starting timezone stuff.........."
- lambda: |-
ESP_LOGI("timezone.current", "Current timezone: %s", id(sntp_time).get_timezone().c_str());
- if:
condition:
lambda: 'return id(sntp_time).get_timezone() == "UTC";'
then:
- http_request.get:
url: "http://worldtimeapi.org/api/ip"
on_response:
then:
- lambda: |-
if(response->status_code != HTTP_CODE_OK) {
ESP_LOGE("timezone.autodetermine", "World Time API HTTP Request failed with code: %d.", response->status_code);
return;
}
parse_json(body, [](JsonObject root) -> bool {
std::string timezone = root["timezone"];
id(sntp_time).set_timezone(timezone.c_str());
ESP_LOGI("timezone.autodetermine", "Timezone set to: %s.", timezone.c_str());
return true;
});
esp32:
board: esp32dev

dashboard_import:
package_import_url: github://ratgdo/esphome-ratgdo/v32disco.yaml@main

packages:
remote_package:
url: https://github.com/ratgdo/esphome-ratgdo
ref: ratgdo32
files: [base.yaml]
refresh: 6h
# remote_package: !include
# file: base.yaml

# Enable time synchronization using SNTP.
time:
- platform: sntp
id: sntp_time
servers:
- time.apple.com
- time.cloudflare.com
timezone: ${timezone}

# Enable the HTTP Client to autoset timezone information using the World Time API.
http_request:
id: http_request_data
timeout: 15s
verify_ssl: false

api:
id: api_server

improv_serial:

wifi:
ap:

logger:

ota:

binary_sensor:
- platform: ratgdo
ratgdo_id: ${id_prefix}
id: ${id_prefix}_vehicle_detected
type: vehicle_detected
name: "Vehicle detected"
- platform: ratgdo
ratgdo_id: ${id_prefix}
id: ${id_prefix}_vehicle_arriving
type: vehicle_arriving
name: "Vehicle arriving"
- platform: ratgdo
ratgdo_id: ${id_prefix}
id: ${id_prefix}_vehicle_leaving
type: vehicle_leaving
name: "Vehicle leaving"

number:
- platform: ratgdo
id: ${id_prefix}_target_distance_measurement
type: target_distance_measurement
entity_category: config
ratgdo_id: ${id_prefix}
name: "Vehicle distance target"
mode: box
unit_of_measurement: "mm"
- platform: ratgdo
id: ${id_prefix}_closing_delay
type: closing_delay
entity_category: config
ratgdo_id: ${id_prefix}
name: "Closing Delay"
unit_of_measurement: "s"

output:
- platform: ledc
pin: GPIO33
id: ${id_prefix}_ledc
- platform: ratgdo
ratgdo_id: ${id_prefix}
id: ${id_prefix}_beeper
type: beeper
rtttl: ${id_prefix}_rtttl
song: "alert:d=8,o=5,b=120:a,p,a,p,a,p,4b,p"

rtttl:
- id: ${id_prefix}_rtttl
output: ${id_prefix}_ledc

switch:
- platform: ratgdo
ratgdo_id: ${id_prefix}
id: ${id_prefix}_led
type: led
pin: GPIO2
name: "LED"
entity_category: config
- platform: ratgdo
ratgdo_id: ${id_prefix}
id: ${id_prefix}_laser
type: led
pin: GPIO23
name: "LASER"
entity_category: config

sensor:
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 120s
- platform: ratgdo
id: ${id_prefix}_vehicle_distance_actual
type: distance
name: "Vehicle distance actual"
ratgdo_id: ${id_prefix}
unit_of_measurement: "mm"
filters:
- throttle: 1s
- filter_out: -1
- median:
window_size: 20
send_every: 5
send_first_at: 5
- platform: adc
pin: GPIO34
name: "Voltage"
attenuation: auto
update_interval: 60s
filters:
- calibrate_linear:
- 1.16 -> 5
- 2.783 -> 12
# uncomment to convert voltage scale to a % for lead acid batteries
# - 2.43 -> 0 # 10.5v = 0%
# - 2.98 -> 100 # 12.85 = 100%
# - clamp:
# min_value: 0
# max_value: 100
# unit_of_measurement: "%"
3 changes: 3 additions & 0 deletions homebridge-ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ <h5>Advanced Topics</h5>
<li>
<a target="_blank" href="https://github.com/hjdhjd/homebridge-ratgdo/blob/main/docs/MQTT.md">MQTT</a>: how to configure MQTT support.
</li>
<li>
<a target="_blank" href="https://github.com/hjdhjd/homebridge-ratgdo/tree/main/esphome">ESPHome Firmware Customization</a>: precustomized Ratgdo ESPHome firmware and configuration files. <b>This is completely unsupported and provided for convenience - you are on your own.</b>
</li>
</ul>

<h5>Support</h5>
Expand Down
Loading

0 comments on commit 5ec90ad

Please sign in to comment.