Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

example: allow any str for bridge IP

zzstoatzz2ff72476b1a0
diff --git a/examples/smart_home/src/smart_home/hub.py b/examples/smart_home/src/smart_home/hub.py
index 2dcb8f610..862d12a05 100644
--- a/examples/smart_home/src/smart_home/hub.py
+++ b/examples/smart_home/src/smart_home/hub.py
@@ -16,7 +16,7 @@ def hub_status() -> str:
"""Checks the status of the main hub and connections."""
try:
bridge = Bridge(
- ip=str(settings.hue_bridge_ip),
+ ip=settings.hue_bridge_ip,
username=settings.hue_bridge_username,
save_config=False,
)
diff --git a/examples/smart_home/src/smart_home/lights/hue_utils.py b/examples/smart_home/src/smart_home/lights/hue_utils.py
index 478897203..1758f2841 100644
--- a/examples/smart_home/src/smart_home/lights/hue_utils.py
+++ b/examples/smart_home/src/smart_home/lights/hue_utils.py
@@ -10,7 +10,7 @@ def _get_bridge() -> Bridge | None:
"""Attempts to connect to the Hue bridge using settings."""
try:
return Bridge(
- ip=str(settings.hue_bridge_ip),
+ ip=settings.hue_bridge_ip,
username=settings.hue_bridge_username,
save_config=False,
)
diff --git a/examples/smart_home/src/smart_home/settings.py b/examples/smart_home/src/smart_home/settings.py
index f4f843ff9..d6b09acdd 100644
--- a/examples/smart_home/src/smart_home/settings.py
+++ b/examples/smart_home/src/smart_home/settings.py
@@ -1,11 +1,11 @@
-from pydantic import AnyHttpUrl, Field
+from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
- hue_bridge_ip: AnyHttpUrl = Field(default=...)
+ hue_bridge_ip: str = Field(default=...)
hue_bridge_username: str = Field(default=...)