-
-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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 support to the new Broadlink RM Mini 3 and RM4 Series #32523
Conversation
Sync the fork to the original repository
Sync the fork to the original repository
Sync the fork
I was unable to test because my device stopped working after updating Home Assistant. While I was solving the problem for others, someone created a problem for me. That's how life works. |
Hey there @Danielhiversen, mind taking a look at this pull request as its been labeled with a integration ( |
Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>
Should this be done for |
@ghedo Yes. |
@felipediel please update switch.py as well as @ghedo suggested :) |
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 made as few changes as possible just to keep things going. But I think we need to discuss another way to initialize the devices. The user should not be obligated to know the device type. A HELLO_REQUEST (broadlink.discover) would be the best option, as the device sends its type in the response. As soon as we're done here, I'll open a new issue to discuss this option. For now, letting the user choose the type will do the trick.
With this last commit, PyTest started reporting an AssertionError in the homeassistant.components.withings.common.WithingsDataManager class. But I did not make any changes to this module. Something is stinking in the the tests for this class. Could it be related to the time zone? I can undo the last commit if necessary, but I really wish I didn't have to, because it integrates the new devices into the sensor platform. I can't really see anything wrong with my code. The problem seems to be somewhere else that I haven't touched, can someone help me understand what's going on? @ghedo @springstan @Danielhiversen Do you have any idea what is causing this error? |
I tested the same file on the dev branch. Command
Outputdata_manager = <homeassistant.components.withings.common.WithingsDataManager object at 0x7f6fee8b3390>
async def test_data_manager_update_sleep_date_range(
data_manager: WithingsDataManager,
) -> None:
"""Test method."""
patch_time_zone = patch(
"homeassistant.util.dt.DEFAULT_TIME_ZONE",
new=dt.get_time_zone("America/Los_Angeles"),
)
with patch_time_zone:
update_start_time = dt.now()
await data_manager.update_sleep()
call_args = data_manager.api.sleep_get.call_args_list[0][1]
startdate = call_args.get("startdate")
enddate = call_args.get("enddate")
> assert startdate.tzname() == "PST"
E AssertionError: assert 'PDT' == 'PST'
E - PDT
E + PST
tests/components/withings/test_common.py:129: AssertionError Same assertion error, even without my code. Definitely not something I should be worrying about here. But someone should be worrying about elsewhere, because this error is preventing people to contribute. |
It is fixed #32602 |
We shouldn't merge until the new features have been tested. I'll mark this as draft. Ping me when testing is done. |
@MartinHjelmare The sensors have already been tested at the library level. I'm having trouble finding users with these sensors to test my implementation in Home Assistant. But I don't see what could go wrong. The interfaces are the same. Can't we merge anyway? Users are getting impatient for this update. |
We don't accept untested features. There should either be (unit) tests or live tests should be made. |
FWIW, I tested both The model I have doesn't work at all with the current home-assistant release, so it would be great if these improvements could reach an official release so I wouldn't need to patch files manually every time there is a new home-assistant release. |
Tested |
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.
@MartinHjelmare It will be difficult to find someone to test the sensor platform with RM 4 devices in the short term. How about we look at the tests we have so far?
@MartinHjelmare Everything was tested, but some tests were done separately. No problem, right? Edit: Check this out. People are using the code without any problems. But they are being tortured with technical implementation details. They want their devices to work natively with Home Assistant. We should merge this PR as soon as possible. |
@felipediel Amazon will deliver the sensor cable to me today. |
Ok, I think we need one more test. Can anyone confirm if broadlink.learn and broadlink.send are working with RM Mini 3 0x5f36 in this latest update? @sbeff Could you test sensor platform? |
I have tested this PR with RM4 mini now. Everything (Learn, send, temperature and humidity) work as expected. |
@felipediel I followed the steps above, but I see this error from the logs:
I double checked the MAC and the IP. The device works from the Broadlink iPhone app. This is my current configuration:
|
You don't have to configure the device in the app, this will prevent local connections. Simone |
Thanks @chemelli74, now everything started working properly. |
@felipediel with your new instructions I got your changes finally running. Tested with RM Mini 3 (0x5f36) and it works perfectly - remote learn & use as switch... great work. Thanks a lot! |
@MartinHjelmare All tests complete. Ready to be merged. |
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.
Good!
Codecov is flaky. |
Thanks to everyone who contributed promptly to these final tests! |
sorry deleted. |
Hello Do we know when this PR will be included in an update ? It's frustrating to know that the code is ready but not being able to use it ! Thanks |
yes. see 0.109beta release note. |
Proposed change
This PR adds support to the new RM Mini 3 (0x5f36 - Red Bean / New Black Bean) and the entire RM4 series (RM4 Mini, RM4 Pro, RM4c Mini, RM4c Pro). These devices require special headers for communication. I recently added a new class to the library in order to support these devices.
So the proposed change here is to allow the user to select the correct device type so he can control the device with Home Assistant.
Type of change
Example entry for
configuration.yaml
:Example 1: Set up Broadlink RM Mini 3 Red Bean as a remote
Example 2: Set up Broadlink RM4 Mini as a switch
Example 3: Set up Broadlink RM4 Pro as a sensor
Additional information
Checklist
black --fast 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
..coveragerc
.The integration reached or maintains the following Integration Quality Scale: