-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Handle binary coils with non default mappings in nibe heatpump #148354
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
Conversation
| 'friendly_name': 'F1255 EB101 Installed', | ||
| }), | ||
| 'context': <ANY>, | ||
| 'entity_id': 'binary_sensor.eb101_installed_49239', |
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.
what a strange entity id
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 many strange one: https://github.com/yozik04/nibe/blob/master/nibe/data/f1155_f1255.json eb101 is a type of asscessory. The number is the ID of the data in nibe databases.
Since we have no way on entities to show what their source unique identifies are in gui (to map to offical documentations) it kinda need to go somewhere.
| async def test_turn_on( | ||
| hass: HomeAssistant, | ||
| mock_connection: AsyncMock, | ||
| model: Model, | ||
| entity_id: str, | ||
| address: int, | ||
| state: Any, | ||
| coils: dict[int, Any], | ||
| ) -> None: | ||
| """Test setting of value.""" | ||
| coils[address] = state | ||
|
|
||
| await async_add_model(hass, model) | ||
|
|
||
| await hass.async_block_till_done() | ||
| assert hass.states.get(entity_id) | ||
|
|
||
| # Write value | ||
| await hass.services.async_call( | ||
| PLATFORM_DOMAIN, | ||
| SERVICE_TURN_ON, | ||
| {ATTR_ENTITY_ID: entity_id}, | ||
| blocking=True, | ||
| ) | ||
|
|
||
| await hass.async_block_till_done() | ||
|
|
||
| # Verify written | ||
| args = mock_connection.write_coil.call_args | ||
| assert args | ||
| coil = args.args[0] | ||
| assert isinstance(coil, CoilData) | ||
| assert coil.coil.address == address | ||
| assert coil.raw_value == 1 | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| ("model", "address", "entity_id", "state"), | ||
| [ | ||
| (Model.F1255, 48043, "switch.holiday_activated_48043", "INACTIVE"), | ||
| (Model.F1255, 48071, "switch.flm_1_accessory_48071", "ON"), | ||
| ], | ||
| ) | ||
| @pytest.mark.usefixtures("entity_registry_enabled_by_default") | ||
| async def test_turn_off( |
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.
If you feel fancy, you could also parametrize these
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.
Well. i would have to parametrize the service call. Feels ugly.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
029d2af to
783d81a
Compare
783d81a to
baf691e
Compare
Proposed change
Handle the case of binary sensors and switches not using default mapping off "ON", "OFF".
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: