Skip to content

Commit

Permalink
Merge pull request #9 from yoziru/custom-esphome-component
Browse files Browse the repository at this point in the history
new custom component +  m5stack IR unit + NanoC6 board
  • Loading branch information
yoziru authored Aug 4, 2024
2 parents 00e9ad3 + 4a1ce2f commit 66197b1
Show file tree
Hide file tree
Showing 21 changed files with 353 additions and 289 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
matrix:
file:
- argoclima-ir-m5stack-atoms3.yml
- argoclima-ir-m5stack-nanoc6.yml
steps:
- uses: actions/[email protected]
- name: Mock secrets.yaml from example
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
publish:
uses: ./.github/workflows/publish-common.yml
with:
files: argoclima-ir-m5stack-atoms3.yml
files: argoclima-ir-m5stack-atoms3.yml,argoclima-ir-m5stack-nanoc6.yml
name: ESPHome Argoclima IR
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.DEFAULT_GOAL := help
BOARD := m5stack-atoms3
BOARD := m5stack-atoms3-ir
PROJECT := argoclima-ir
TARGET := $(PROJECT)-$(BOARD).yml
HOST_SUFFIX := ""

compile: .esphome/build/$(PROJECT)/.pioenvs/$(PROJECT)/firmware.bin .esphome/build/$(PROJECT)/$(TARGET).touchfile ## Read the configuration and compile the binary.

.esphome/build/$(PROJECT)/$(TARGET).touchfile: .venv/touchfile $(TARGET) components/argoclima/*.* packages/*.yml boards/$(BOARD).yml ## Validate the configuration and create a binary.
.esphome/build/$(PROJECT)/$(TARGET).touchfile: .venv/touchfile $(TARGET) packages/*.yml boards/$(BOARD).yml ## Validate the configuration and create a binary.
. .venv/bin/activate; esphome compile $(TARGET)
touch .esphome/build/$(TARGET).touchfile

Expand Down
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,39 @@ It exposes a Climate controller through the [ESPHome native API](https://esphome

## Software

Supported boards:
- `m5stack-atoms3`: M5Stack AtomS3 / Lite
- `m5stack-atoms3-ir`: M5Stack AtomS3 / Lite with M5Stack IR unit (U002)
- `m5stack-nanoc6`: M5Stack NanoC6
- `m5stack-nanoc6-ir`: M5Stack NanoC6 with M5Stack IR unit (U002)

1. Copy and rename `secrets.yaml.example` to `secrets.yaml` and update it with your WiFi credentials (`wifi_ssid` and `wifi_password`).

2. Build the image with [ESPHome](https://esphome.io/guides/getting_started_command_line.html)
1. Set the `ha_room_temperature_sensor` substitution to your room temperature sensor in Home Assistant.

1. Build the image with [ESPHome](https://esphome.io/guides/getting_started_command_line.html)

```sh
make compile BOARD=m5stack-atoms3
```


1. Upload/flash the firmware to the board.

```sh
make compile
```
```sh
make upload BOARD=m5stack-atoms3
```

3. Upload/flash the firmware to the board.
1. After flashing, you can use the log command to monitor the logs from the device. The host suffix is the last part of the device name in the ESPHome dashboard (e.g. 5b2ac7).

```sh
make upload
```
```sh
make logs BOARD=m5stack-atoms3 HOST_SUFFIX=-5b2ac7
```

1. For updating your device, you can OTA update over local WiFi using the same host suffix:
```sh
make upload BOARD=m5stack-atoms3 HOST_SUFFIX=-5b2ac7
```
## Credits

- https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Argo.h
6 changes: 0 additions & 6 deletions argoclima-ir-esp32-evb.yml

This file was deleted.

13 changes: 13 additions & 0 deletions argoclima-ir-m5stack-atoms3-ir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
substitutions:
ha_room_temperature_sensor: sensor.your_ha_sensor_temperature

climate:
- id: !extend ac
receiver_id: ir_receiver

packages:
base: !include packages/base.yml
device_base: !include boards/m5stack-atoms3-ir.yml

dashboard_import:
package_import_url: github://yoziru/esphome-argoclima-ir/argoclima-ir-m5stack-atoms3-ir.yml
3 changes: 3 additions & 0 deletions argoclima-ir-m5stack-atoms3.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
substitutions:
ha_room_temperature_sensor: sensor.your_ha_sensor_temperature

packages:
base: !include packages/base.yml
device_base: !include boards/m5stack-atoms3.yml
Expand Down
13 changes: 13 additions & 0 deletions argoclima-ir-m5stack-nanoc6-ir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
substitutions:
ha_room_temperature_sensor: sensor.your_ha_sensor_temperature

climate:
- id: !extend ac
receiver_id: ir_receiver

packages:
base: !include packages/base.yml
device_base: !include boards/m5stack-nanoc6-ir.yml

dashboard_import:
package_import_url: github://yoziru/esphome-argoclima-ir/argoclima-ir-m5stack-nanoc6-ir.yml
9 changes: 9 additions & 0 deletions argoclima-ir-m5stack-nanoc6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
substitutions:
ha_room_temperature_sensor: sensor.your_ha_sensor_temperature

packages:
base: !include packages/base.yml
device_base: !include boards/m5stack-nanoc6.yml

dashboard_import:
package_import_url: github://yoziru/esphome-argoclima-ir/argoclima-ir-m5stack-nanoc6.yml
16 changes: 0 additions & 16 deletions boards/esp32-evb.yml

This file was deleted.

86 changes: 86 additions & 0 deletions boards/m5stack-atoms3-ir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
flash_size: 8MB
framework:
type: esp-idf
version: 5.3.0
platform_version: 6.8.1

external_components:
# fix: Change default carrier_frequency to valid value for ESP-IDF 5.x
- components: [remote_transmitter]
source: github://pr#7176

# Output that blinks the LED
output:
- platform: template
id: status_output
type: binary
write_action:
- if:
condition:
lambda: return (state);
then:
- light.turn_on:
id: led
brightness: 70%
red: 100%
green: 0%
blue: 0%
else:
- light.turn_off: led

light:
# Enable status LED
- platform: status_led
output: status_output
name: "Status Led"
internal: True
entity_category: diagnostic

#G35=RGB WS2812C-2020
- platform: esp32_rmt_led_strip
rgb_order: GRB
pin: 35
num_leds: 4
# RMT 0 channels will be occupied by IR
rmt_channel: 1
chipset: ws2812
id: led
name: "Led"
entity_category: diagnostic

# G41=Button
binary_sensor:
- platform: gpio
name: Button
entity_category: diagnostic
pin:
number: GPIO41
inverted: true
mode:
input: true
pullup: true
filters:
- delayed_off: 10ms

# M5Stack Mini Infrared Emitter & Receiver Unit (U002)
remote_transmitter:
carrier_duty_percent: 50%
id: "ir_transmitter"
pin:
number: GPIO2
mode:
output: true

remote_receiver:
id: ir_receiver
rmt_channel: 4
pin:
number: GPIO1
inverted: true
mode:
input: true
pullup: true
dump: pronto
9 changes: 8 additions & 1 deletion boards/m5stack-atoms3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ esp32:
variant: esp32s3
flash_size: 8MB
framework:
type: arduino
type: esp-idf
version: 5.3.0
platform_version: 6.8.1

external_components:
# fix: Change default carrier_frequency to valid value for ESP-IDF 5.x
- components: [remote_transmitter]
source: github://pr#7176

# Output that blinks the LED
output:
Expand Down
83 changes: 83 additions & 0 deletions boards/m5stack-nanoc6-ir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
esp32:
board: esp32-c6-devkitm-1
variant: esp32c6
flash_size: 4MB
framework:
type: esp-idf
version: 5.3.0
platform_version: 6.8.1
sdkconfig_options:
CONFIG_OPENTHREAD_ENABLED: n
CONFIG_ENABLE_WIFI_STATION: y
CONFIG_USE_MINIMAL_MDNS: y
CONFIG_ESPTOOLPY_FLASHSIZE_4MB: y

external_components:
# fix: Change default carrier_frequency to valid value for ESP-IDF 5.x
- components: [remote_transmitter]
source: github://pr#7176

light:
- platform: status_led
name: "Status LED"
entity_category: diagnostic
pin: GPIO7

#G20=RGB WS2812
- platform: esp32_rmt_led_strip
rgb_order: GRB
pin: GPIO20
num_leds: 4
# RMT 0 channels will be occupied by IR
rmt_channel: 1
chipset: ws2812
name: "RGB LED"
entity_category: diagnostic
power_supply: rgbpwr

power_supply:
- id: 'rgbpwr'
enable_on_boot: true
pin: GPIO19
enable_time: 10ms
keep_on_time: 10ms

#G9=Button
binary_sensor:
- platform: gpio
name: Button
entity_category: diagnostic
pin:
number: GPIO9
inverted: true
mode:
input: true
pullup: true
filters:
- delayed_off: 10ms

# M5Stack Mini Infrared Emitter & Receiver Unit (U002)
remote_transmitter:
carrier_duty_percent: 50%
id: "ir_transmitter"
pin:
number: GPIO2
mode:
output: true

remote_receiver:
id: ir_receiver
rmt_channel: 3
# Settings to optimize recognition of RF devices
tolerance: 50%
filter: 250us
idle: 4ms
pin:
number: GPIO1
inverted: true
mode:
input: true
pullup: true
dump:
- pronto
- raw
62 changes: 62 additions & 0 deletions boards/m5stack-nanoc6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
esp32:
board: esp32-c6-devkitm-1
variant: esp32c6
flash_size: 4MB
framework:
type: esp-idf
version: 5.3.0
platform_version: 6.8.1
sdkconfig_options:
CONFIG_OPENTHREAD_ENABLED: n
CONFIG_ENABLE_WIFI_STATION: y
CONFIG_USE_MINIMAL_MDNS: y
CONFIG_ESPTOOLPY_FLASHSIZE_4MB: y

external_components:
# fix: Change default carrier_frequency to valid value for ESP-IDF 5.x
- components: [remote_transmitter]
source: github://pr#7176

light:
- platform: status_led
name: "Status LED"
entity_category: diagnostic
pin: GPIO7

#G20=RGB WS2812
- platform: esp32_rmt_led_strip
rgb_order: GRB
pin: GPIO20
num_leds: 4
# RMT 0 channels will be occupied by IR
rmt_channel: 1
chipset: ws2812
name: "RGB LED"
entity_category: diagnostic
power_supply: rgbpwr

power_supply:
- id: "rgbpwr"
enable_on_boot: true
pin: GPIO19
enable_time: 10ms
keep_on_time: 10ms

#G9=Button
binary_sensor:
- platform: gpio
name: Button
entity_category: diagnostic
pin:
number: GPIO9
inverted: true
mode:
input: true
pullup: true
filters:
- delayed_off: 10ms

remote_transmitter:
carrier_duty_percent: 50%
id: "ir_transmitter"
pin: GPIO3
1 change: 0 additions & 1 deletion components/argoclima/__init__.py

This file was deleted.

Loading

0 comments on commit 66197b1

Please sign in to comment.