Skip to content

Commit

Permalink
Add support for fauxmo devices to be discovered by HomeAssistant
Browse files Browse the repository at this point in the history
Makes two changes needed for HomeAssistant to discover and manage
fauxmo devices:

* HomeAssistant relies on pywemo for device discovery. The
  pywemo.discover_devices() function sends an ssdp probe of the string
  "urn:Belkin:service:basicevent:1". This change causes fauxmo to respond to
  that probe so that pywemo.discover_devices will find fauxmo devices.

* As mentioned in #88,
  HomeAssistant uses the serial number returned by a "real" Wemo to
  disambiguate devices, if more than one device shares an IP
  address. This changes causes fauxmo to respond to a setup message
  with the serial number, so that multiple fauxmo devices will be seen
  from HomeAssistant.
  • Loading branch information
howdypierce committed Jan 8, 2024
1 parent a53cec9 commit 2f3023e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/fauxmo/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def handle_setup(self) -> None:
"<manufacturer>Belkin International Inc.</manufacturer>"
"<modelName>Emulated Socket</modelName>"
"<modelNumber>3.1415</modelNumber>"
f"<serialNumber>{self.serial}</serialNumber>"
f"<UDN>uuid:Socket-1_0-{self.serial}</UDN>"
"<serviceList>"
"<service>"
Expand Down Expand Up @@ -362,6 +363,7 @@ def datagram_received(

discover_patterns = [
"ST: urn:Belkin:device:**",
"ST: urn:Belkin:service:basicevent:1",
"ST: upnp:rootdevice",
"ST: ssdp:all",
]
Expand Down

0 comments on commit 2f3023e

Please sign in to comment.