-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Add CCL Electronics integration #130281
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
base: dev
Are you sure you want to change the base?
Add CCL Electronics integration #130281
Conversation
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.
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.
Need to only PR one platform at a time. |
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.
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.
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.
entry.runtime_data = CCLDevice(entry.data["passkey"]) | ||
|
||
CCLServer.add_copy(entry.runtime_data) | ||
await CCLServer.run() |
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.
you are launching your own webserver here which is not something we want. There is a built in webhook
component that can be used to allow push style HTTP callbacks, take a look at tedee
for how those are registered. Also, is there any way you can push the instance details to CCL, instead of the user having to go to the app to configure that manually?
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.
Thanks for the advice. It is now changed to listen for requests using webhook
api.
Here is the test command I input to the zsh terminal in dev container (about half of them are binary sensors which are not included in this PR):
curl localhost:8123/api/webhook/c2507495 -X POST -H 'Content-Type: application/json' -d '{"serial_no": "1061616322","mac_address": "48:31:B7:06:D5:59","model":"HA100","fw_ver":"v1.00","datetime":"2024-12-26+02:47:46","abar":1014.1,"rbar":1012.9,"t1dew":16.1,"t1feels":22.9,"t1chill":22.9,"inhum":63,"intem":23.0,"t1solrad":0,"t1hum":66,"t1tem":22.9,"t1rainra":0,"t1raindy":0,"t1rainhr":0,"t1rainmth":0,"t1rainwy":0,"t1rainyr":0,"t1uvi":0,"t1wdir":276,"t1wgust":0,"t1ws":0,"t1ws10mav":0,"inbat":1,"t1bat":0,"t234c1cn":0,"t234c2cn":0,"t234c3cn":0,"t234c4cn":0,"t234c5cn":0,"t234c6cn":0,"t234c7cn":0,"t11cn":0,"t10cn":0,"t9cn":0,"t6c1cn":0,"t6c2cn":0,"t6c3cn":0,"t6c4cn":0,"t6c5cn":0,"t6c6cn":0,"t6c7cn":0,"t5lscn":0,"t1cn":1,"t8cn":0,"api_ver":"v1.00"}'
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
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.
There are still a couple of comments not addressed
Co-authored-by: Joost Lekkerkerker <[email protected]>
Co-authored-by: Joost Lekkerkerker <[email protected]>
Co-authored-by: Joost Lekkerkerker <[email protected]>
Co-authored-by: Joost Lekkerkerker <[email protected]>
Co-authored-by: Joost Lekkerkerker <[email protected]>
@joostlek Is there any improvement I could make? Since our customers have been waiting for a long time. Sorry for bothering. |
Yea so I was discussing this PR with @zweckj and we kinda come to the conclusion that the current setup could work in the end, but with how it works now, it's very complex and I kinda think that this is the moment to push back and look how we can improve this so we can both have a maintainable integration with is also easily extendable. Currently some things are vague, like the library has a few too much tasks. Why should the library care about what sensors or binary sensors it creates? In theory the library should just process and return data, and HA should create the right entities from that. |
Thank you, moved that feature out from the library. Now the integration will be the one to check if a sensor is binary. |
test-before-configure: | ||
status: exempt | ||
comment: | | ||
The integration only receives and reads data from devices, no connection is needed. | ||
test-before-setup: | ||
status: exempt | ||
comment: | | ||
The integration only receives and reads data from devices, no connection is needed. |
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.
I'm not quite happy with that tbh. How would we know a user did not make a mistake when entering the things in the app? Isn't the app pushing something immediately after first setup at least?
log-when-unavailable: | ||
status: exempt | ||
comment: | | ||
The integration has no initiative access to the device. |
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.
or rather than in the entities, maybe we raise UpdateFailed
from the coordinator if we didn't receive an update for more than 5 minutes
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.
The integration now tests if data is pushed with async_config_entry_first_refresh()
. I also tried to set the coordinator update interval to 10 mins to raise UpdateFailed
on time, but somehow polling is not working. _async_update_data()
is only triggered on set-up and never again even manually, which I have no idea at all.
CCLSensorTypes.UVI: SensorEntityDescription( | ||
key="UVI", | ||
state_class=SensorStateClass.MEASUREMENT, | ||
translation_key="uvi", |
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.
still valid
Proposed change
Adds the CCL Electronics integration, allowing local weather stations with expandable modules to push sensor data.
Link to library: https://github.com/CCL-Electronics-Ltd/aioccl
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: