-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the WeiKai SPI/I2C UART/IO Expander components to esphome #5218
Conversation
That's a major addition to ESPhome!!!!!!! Bravo.... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on the component! I have it tested and working with a DFRobot module.
I have added a few recommendations mainly based off changes that I have been requested to make for my own PRs. For a couple of them, I wrote if I was unsure about them in terms of the project's bigger picture, so I may be off base on those.
It would be great to get this working without needing a dummy UART device, but I'm not sure how to go about that!
Thanks :) Good to know its working for you
From what I understand it has to be solved in UART component. Jessie is aware of the problem, but I do not think anybody I have made the changes you suggested - Thanks for your help |
Which components you tested with ? |
I've retested the updated code, and everything is still working. I hope those changes help get this PR accepted a bit faster! This will be a useful component for some of my future projects. SeByDocKy, I am testing it with the dfrobot mmwave component. I haven't explored that PR too deeply, but the WK2132 is reading the motion sensor state just fine out of the box. Here is the basic config for it:
|
Thank you for your time and help. This is my first submission so I'm not too familiar with the process. |
Ok I did the first testing with a sds011 sensor. Got a good and a bad news... i) The good one.... With the Wk2132, i can collect both sensor informations (pm2.5 & pm10)
I guess during the setup of the conponent, no check is performed if it's plugged .... must be added... Now I will check with a more complex serial component like a BMS |
I am not sure to understand what you are asking for? If you declare a component and if the component is not connected it is normal that the I²C bus returns error code 2. This is the expected behaviour to indicate your hardware is faulty and telling you where is the error. |
the "absence" detection must be done during the setup in order to not have multiple error msg during the main update().... Maybe a working around would be to change the ESPLOG verbosity level .... |
Once again, I don't understand why it's a problem to indicate that the module is not correctly connected? The debug messages were created to help users locate a fault. I don't suppose you're going to make a board where you can add or remove components during operation? |
Ok just tested with a JKBMS and unfortunaly no data are received :( (like bandid17)
Here is the log in very_verbose level: https://pastebin.com/qr2wuggk |
Concerning the sds011, even if I can collect the two sensor data, I noticed I got this warning msg
|
@SeByDocKy
This should print ...sniif writing .... when writing to the wk2132 and ...sniff reading ... when reading character from the line |
sorry I know nothing about the sds011. |
FYI here is how to interpret the wk2132 address
for example with a0 a1 = 0 0 note that acessing directly the fifo is very unusual with i²c component But if you look on the bus remember that the R/W bit is added at the end. So it becomes:
|
I've been testing this a bit more, and I am running into issues using the LD2410 component that was updated in the last release. It is trying to call some validation functions that check the UART interface is configured correctly, and this PR doesn't have them. This setup will throw errors:
In the base UART component |
I already had the exact same problem using the PMSX003. It is also complaining about a RX pin that does not exist during some sensor validation. |
This is a first prototype using a ring buffer. This is done to be ready to transfer quickly bytes one by one without need to make transactions on the i2c bus. This is a very preliminary version just to test the concept On branch wk2132-ring-b1 Changes to be committed: modified: esphome/components/wk2132/wk2132.cpp modified: esphome/components/wk2132/wk2132.h
Note that currently the ring buffer is only used for received char we might want to do that for sending On branch wk2132-ring-b1 Your branch is up to date with 'origin/wk2132-ring-b1'. Changes to be committed: modified: esphome/components/wk2132/wk2132.cpp modified: esphome/components/wk2132/wk2132.h
The branch has been reviewed, tested, and cleaned. Found more this-> missing On branch wk2132-ring-b1 Your branch is up to date with 'origin/wk2132-ring-b1'. Changes to be committed: modified: esphome/components/wk2132/wk2132.cpp modified: esphome/components/wk2132/wk2132.h
I am cannot compile anymore any of my components ???
but it does not help ?
and it fails even if I had a dummy uart? what should I do to make them working again ??? please help i am stuck 💩 |
the test did not pass with same error: https://github.com/esphome/esphome/actions/runs/8618224123/job/23620133312?pr=5218 |
Correct yes
Did you read my message where I said this?
It needs to change to be like this: wk2132_i2c:
- id: bridge_0
address: 112
test_mode: 1
uart:
- id: uart_id0 # Change this from `uart_id` to just `id`
channel: 0
baud_rate: 115200
stop_bits: 1
parity: none
- id: uart_id1 # Change this from `uart_id` to just `id`
channel: 1
baud_rate: 115200 |
Cool it woks on my test |
Sorry I did not understand what I had to change. My mistake. ;) I have modified my yamls and now it works. I have completed the tests for the wk2132_i2c and I am waiting for the results. Is there a way to test tests/components/wk2132_i2c/* locally before submitting ? cause validation process is now taking forever :( |
Hopefully all tests should be good On branch wk2132 Your branch is up to date with 'origin/wk2132'. Changes to be committed: modified: tests/components/wk2132_i2c/common.yaml modified: tests/components/wk2132_i2c/test.esp32-idf.yaml modified: tests/components/wk2132_i2c/test.esp32-s3-idf.yaml modified: tests/components/wk2132_i2c/test.esp32-s3.yaml modified: tests/components/wk2132_i2c/test.esp32.yaml new file: tests/components/wk2132_spi/common.yaml new file: tests/components/wk2132_spi/test.esp32-idf.yaml new file: tests/components/wk2132_spi/test.esp32-s3-idf.yaml new file: tests/components/wk2132_spi/test.esp32-s3.yaml new file: tests/components/wk2132_spi/test.esp32.yaml new file: tests/components/wk2168_i2c/common.yaml new file: tests/components/wk2168_i2c/test.esp32-idf.yaml new file: tests/components/wk2168_i2c/test.esp32-s3-idf.yaml new file: tests/components/wk2168_i2c/test.esp32-s3.yaml new file: tests/components/wk2168_i2c/test.esp32.yaml new file: tests/components/wk2168_spi/common.yaml new file: tests/components/wk2168_spi/test.esp32-idf.yaml new file: tests/components/wk2168_spi/test.esp32-s3-idf.yaml new file: tests/components/wk2168_spi/test.esp32-s3.yaml new file: tests/components/wk2168_spi/test.esp32.yaml new file: tests/components/wk2204_i2c/common.yaml new file: tests/components/wk2204_i2c/test.esp32-idf.yaml new file: tests/components/wk2204_i2c/test.esp32-s3-idf.yaml new file: tests/components/wk2204_i2c/test.esp32-s3.yaml new file: tests/components/wk2204_i2c/test.esp32.yaml new file: tests/components/wk2204_spi/common.yaml new file: tests/components/wk2204_spi/test.esp32-idf.yaml new file: tests/components/wk2204_spi/test.esp32-s3-idf.yaml new file: tests/components/wk2204_spi/test.esp32-s3.yaml new file: tests/components/wk2204_spi/test.esp32.yaml new file: tests/components/wk2212_i2c/common.yaml new file: tests/components/wk2212_i2c/test.esp32-idf.yaml new file: tests/components/wk2212_i2c/test.esp32-s3-idf.yaml new file: tests/components/wk2212_i2c/test.esp32-s3.yaml new file: tests/components/wk2212_i2c/test.esp32.yaml new file: tests/components/wk2212_spi/common.yaml new file: tests/components/wk2212_spi/test.esp32-idf.yaml new file: tests/components/wk2212_spi/test.esp32-s3-idf.yaml new file: tests/components/wk2212_spi/test.esp32-s3.yaml new file: tests/components/wk2212_spi/test.esp32.yaml
@jesserockz all modifications requested have been done.
Shoul be ready for final review as soon as tests finished ? |
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
@jesserockz
I think it would be nice to fix it. By the way tests/test6.yaml is broken but I did not touch it ??? |
This has been fixed in #6487 |
@@ -0,0 +1,4 @@ | |||
/* compiling with esp-idf framework requires a .cpp file for some reason ? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, I will look into this after this PR is merged
What does this implement/fix?
Add 8 new components from the WeiKai family of components:
WK2168-IQPG WK2132-ISSG WK2124-ISSG WK2204-IQNG WK2212-IQNG
These components allow to connect up to 4 UART devices and IO pins from an SPI or I²C bus
There are 11 components added to the ESPHome library:
Types of changes
Related issue or feature (if applicable): fixes
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3113
Test Environment
Example entry for
config.yaml
:Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: