Skip to content

Commit

Permalink
Add Pico W Compatibility (#6)
Browse files Browse the repository at this point in the history
* fix uint16_t output

* add pico-w diagram

* add pico-w picture

* add pico-w installed

* add pico yaml example

* update README

* update README

* update pico diagram
  • Loading branch information
ad3m3r5 authored Nov 28, 2023
1 parent 6967223 commit ef6972a
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ An ESPHome component for the Winix C545 air purifier.
## Requirements
- ESP32
- ESP8266 may work but lacks a free [hardware UART](https://esphome.io/components/uart.html#hardware-uarts).
- A [Raspberry Pi Pico W](docs/example_pico-w.yaml) has also been used successfully.
- ESPHome 2023.10 or above
- Older version may function but have not been tested.
- Older versions may function but have not been tested.
- A bi-directional logic level shifter.
- Pictured here is the Adafruit TXB0104 Bi-Directional Level Shifter.
- Winix C545 Air Purifier
Expand Down
2 changes: 1 addition & 1 deletion components/winix_c545/winix_c545.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void WinixC545Component::publish_state_() {

void WinixC545Component::parse_aws_sentence_(char *sentence) {
uint16_t api_code = 0;
if (sscanf(sentence, "AWS_SEND=A%3d", &api_code) != 1) {
if (sscanf(sentence, "AWS_SEND=A%3hu", &api_code) != 1) {
ESP_LOGE(TAG, "Failed to extract API code from sentence: %s", sentence);
return;
}
Expand Down
72 changes: 72 additions & 0 deletions docs/example_pico-w.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
esphome:
name: pico-w-c545
friendly_name: pico-w-c545

rp2040:
board: rpipicow
framework:
# Required until https://github.com/platformio/platform-raspberrypi/pull/36 is merged
platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git

# Enable Home Assistant API
api:
encryption:
key: "<key>"

ota:
password: "<password>"

wifi:
ssid: !secret <ssid_secret>
password: !secret <password_secret>

# Enable fallback hotspot in case wifi connection fails
ap:
ssid: "Pico-W-C545"
password: !secret <fallback_secret>

external_components:
# Pull from Github
- source: github://mill1000/esphome-winix-c545@main
components: [winix_c545]

# Enable logging
logger:
level: DEBUG
hardware_uart: UART0

uart:
tx_pin: 8 #(UART1 TX)
rx_pin: 9 #(UART1 RX)
baud_rate: 115200

winix_c545:

fan:
- platform: winix_c545
name: Winix C545 Air Purifier

sensor:
- platform: winix_c545
filter_age:
name: Filter Age
filter_lifetime:
name: Filter Lifetime
aqi:
name: AQI
light:
name: Light Intensity

text_sensor:
- platform: winix_c545
aqi_indicator:
name: AQI Indicator

switch:
- platform: winix_c545
plasmawave:
name: Plasmawave
auto:
name: Auto
sleep:
name: Sleep
Binary file added docs/winix_c545_pico-w_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/winix_c545_pico-w_final.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/winix_c545_pico-w_installed.jpeg
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 ef6972a

Please sign in to comment.