Add Minecraft Server Integration (#30992)
* Add Minecraft Server integration * Add unit test for config flow * Fixed some review findings and increased unit test coverage * Fixed docstrings of new test cases * Removed unnecessary debug log messages * Added unique IDs and device infos and removed duplicate name validation * Attempt to fix unit test on CI * Return state OFF instead of UNAVAILABLE in case connection to server drops * Added property decorator to server properties, even less debug messages, improved sensor dispatcher connection and other review findings fixed * Moved special property handling to sensors, fixed name confusion in sensor entity, switch to HA const for scan_interval, simplified building players list string * Improved periodic update, speeded up unit tests * Added type hints, added callback decorator to entity update callback, added const.py to unit test exclusions * Changed state sensor to binary sensor, removed empty unit test file, added constants for icons and units * Let HA handle unknown state, check for None in description and players list sensor * Removed periods at end of log messages, removed constant for default host * Updated requirements_test_pre_commit.txt, fixed codespell findings * Use localhost as default host * Removed passing hass to entities, moved log message from init, moved host lower to vol, use proper patch library, patch library instead of own code * Replaced server properties with global instance attributes, removed config option scan_interval, switch back to async_track_time_interval * Removed description and players list sensors, added players list as state attributes to online players sensor, raise OSError instead of deprecated IOError, other minor review findings fixed * Use MAC address for unique_id in case of an IP address as host, added getmac to manifest.json, added invalid_ip to strings.json, added new test cases for changes in config_flow, replace all IOError's with OSError, other review findings fixed * Removed double assignment * Call get_mac_address async safe * Handle unavailable and unknown states to reach silver quality scale, added quality scale to manifest.json
This commit is contained in:
1 parent
5483de7e25
commit
699d6ad658
14 files changed
+893
No files matched your search
@@ -0,0 +1,37 @@
|
||||
"""Constants for the Minecraft Server integration."""
|
||||
|
||||
ATTR_PLAYERS_LIST = "players_list"
|
||||
|
||||
DEFAULT_HOST = "localhost"
|
||||
DEFAULT_NAME = "Minecraft Server"
|
||||
DEFAULT_PORT = 25565
|
||||
|
||||
DOMAIN = "minecraft_server"
|
||||
|
||||
ICON_LATENCY_TIME = "mdi:signal"
|
||||
ICON_PLAYERS_MAX = "mdi:account-multiple"
|
||||
ICON_PLAYERS_ONLINE = "mdi:account-multiple"
|
||||
ICON_PROTOCOL_VERSION = "mdi:numeric"
|
||||
ICON_STATUS = "mdi:lan"
|
||||
ICON_VERSION = "mdi:numeric"
|
||||
|
||||
KEY_SERVERS = "servers"
|
||||
|
||||
MANUFACTURER = "Mojang AB"
|
||||
|
||||
NAME_LATENCY_TIME = "Latency Time"
|
||||
NAME_PLAYERS_MAX = "Players Max"
|
||||
NAME_PLAYERS_ONLINE = "Players Online"
|
||||
NAME_PROTOCOL_VERSION = "Protocol Version"
|
||||
NAME_STATUS = "Status"
|
||||
NAME_VERSION = "Version"
|
||||
|
||||
SCAN_INTERVAL = 60
|
||||
|
||||
SIGNAL_NAME_PREFIX = f"signal_{DOMAIN}"
|
||||
|
||||
UNIT_LATENCY_TIME = "ms"
|
||||
UNIT_PLAYERS_MAX = "players"
|
||||
UNIT_PLAYERS_ONLINE = "players"
|
||||
UNIT_PROTOCOL_VERSION = None
|
||||
UNIT_VERSION = None
|
||||
Reference in new issue
Block a user