mirror of
https://github.com/home-assistant/core.git
synced 2026-03-01 14:25:31 +00:00
* squeezebox add binary sensor + coordinator
* squeezebox add connected via for media_player
* squeezebox add Player type for player
* Add more type info
* Fix linter errors
* squeezebox use our own status entity
* squeezebox rework device handling based on freedback
* Fix device creation
* squeezebox rework coordinator error handling
* Fix lint type error
* Correct spelling
* Correct spelling
* remove large comments
* insert small comment
* add translation support
* Simply sensor
* clean update function, minimise comments to the useful bits
* Fix after testing
* Update homeassistant/components/squeezebox/entity.py
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
* move data prep out of Device assign for clarity
* stop being a generic api
* Humans need to read the sensors...
* ruff format
* Humans need to read the sensors...
* Revert "ruff format"
This reverts commit 8fcb8143e7.
* ruff format
* Humans need to read the sensors...
* errors after testing
* infered
* drop context
* cutdown coordinator for the binary sensors
* add tests for binary sensors
* Fix import
* add some basic media_player tests
* Fix spelling and file headers
* Fix spelling
* remove uuid and use service device cat
* use diag device
* assert execpted value
* ruff format
* Update homeassistant/components/squeezebox/__init__.py
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
* Simplify T/F
* Fix file header
* remove redudant check
* remove player tests from this commit
* Fix formatting
* remove unused
* Fix function Type
* Fix Any to bool
* Fix browser tests
* Patch our squeebox componemt not the server in the lib
* ruff
---------
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
70 lines
1.8 KiB
Python
70 lines
1.8 KiB
Python
"""Tests for the Logitech Squeezebox integration."""
|
|
|
|
from homeassistant.components.squeezebox.const import (
|
|
DOMAIN,
|
|
STATUS_QUERY_LIBRARYNAME,
|
|
STATUS_QUERY_MAC,
|
|
STATUS_QUERY_UUID,
|
|
STATUS_QUERY_VERSION,
|
|
STATUS_SENSOR_RESCAN,
|
|
)
|
|
from homeassistant.const import CONF_HOST, CONF_PORT
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
# from homeassistant.setup import async_setup_component
|
|
from tests.common import MockConfigEntry
|
|
|
|
FAKE_IP = "42.42.42.42"
|
|
FAKE_MAC = "deadbeefdead"
|
|
FAKE_UUID = "deadbeefdeadbeefbeefdeafbeef42"
|
|
FAKE_PORT = 9000
|
|
FAKE_VERSION = "42.0"
|
|
|
|
FAKE_QUERY_RESPONSE = {
|
|
STATUS_QUERY_UUID: FAKE_UUID,
|
|
STATUS_QUERY_MAC: FAKE_MAC,
|
|
STATUS_QUERY_VERSION: FAKE_VERSION,
|
|
STATUS_SENSOR_RESCAN: 1,
|
|
STATUS_QUERY_LIBRARYNAME: "FakeLib",
|
|
"players_loop": [
|
|
{
|
|
"isplaying": 0,
|
|
"name": "SqueezeLite-HA-Addon",
|
|
"seq_no": 0,
|
|
"modelname": "SqueezeLite-HA-Addon",
|
|
"playerindex": "status",
|
|
"model": "squeezelite",
|
|
"uuid": FAKE_UUID,
|
|
"canpoweroff": 1,
|
|
"ip": "192.168.78.86:57700",
|
|
"displaytype": "none",
|
|
"playerid": "f9:23:cd:37:c5:ff",
|
|
"power": 0,
|
|
"isplayer": 1,
|
|
"connected": 1,
|
|
"firmware": "v2.0.0-1488",
|
|
}
|
|
],
|
|
"count": 1,
|
|
}
|
|
|
|
|
|
async def setup_mocked_integration(hass: HomeAssistant) -> MockConfigEntry:
|
|
"""Mock ConfigEntry in Home Assistant."""
|
|
|
|
entry = MockConfigEntry(
|
|
domain=DOMAIN,
|
|
unique_id=FAKE_UUID,
|
|
data={
|
|
CONF_HOST: FAKE_IP,
|
|
CONF_PORT: FAKE_PORT,
|
|
},
|
|
)
|
|
|
|
entry.add_to_hass(hass)
|
|
|
|
await hass.config_entries.async_setup(entry.entry_id)
|
|
await hass.async_block_till_done()
|
|
|
|
return entry
|