|
30 | 30 |
|
31 | 31 | CONF_HOST_IP = 'host_ip'
|
32 | 32 | CONF_LISTEN_PORT = 'listen_port'
|
| 33 | +CONF_ADVERTISE_IP = 'advertise_ip' |
| 34 | +CONF_ADVERTISE_PORT = 'advertise_port' |
33 | 35 | CONF_UPNP_BIND_MULTICAST = 'upnp_bind_multicast'
|
34 | 36 | CONF_OFF_MAPS_TO_ON_DOMAINS = 'off_maps_to_on_domains'
|
35 | 37 | CONF_EXPOSE_BY_DEFAULT = 'expose_by_default'
|
|
53 | 55 | vol.Optional(CONF_HOST_IP): cv.string,
|
54 | 56 | vol.Optional(CONF_LISTEN_PORT, default=DEFAULT_LISTEN_PORT):
|
55 | 57 | vol.All(vol.Coerce(int), vol.Range(min=1, max=65535)),
|
| 58 | + vol.Optional(CONF_ADVERTISE_IP): cv.string, |
| 59 | + vol.Optional(CONF_ADVERTISE_PORT): |
| 60 | + vol.All(vol.Coerce(int), vol.Range(min=1, max=65535)), |
56 | 61 | vol.Optional(CONF_UPNP_BIND_MULTICAST): cv.boolean,
|
57 | 62 | vol.Optional(CONF_OFF_MAPS_TO_ON_DOMAINS): cv.ensure_list,
|
58 | 63 | vol.Optional(CONF_EXPOSE_BY_DEFAULT): cv.boolean,
|
@@ -92,7 +97,8 @@ def setup(hass, yaml_config):
|
92 | 97 |
|
93 | 98 | upnp_listener = UPNPResponderThread(
|
94 | 99 | config.host_ip_addr, config.listen_port,
|
95 |
| - config.upnp_bind_multicast) |
| 100 | + config.upnp_bind_multicast, config.advertise_ip, |
| 101 | + config.advertise_port) |
96 | 102 |
|
97 | 103 | @asyncio.coroutine
|
98 | 104 | def stop_emulated_hue_bridge(event):
|
@@ -169,6 +175,13 @@ def __init__(self, hass, conf):
|
169 | 175 | self.exposed_domains = conf.get(
|
170 | 176 | CONF_EXPOSED_DOMAINS, DEFAULT_EXPOSED_DOMAINS)
|
171 | 177 |
|
| 178 | + # Calculated effective advertised IP and port for network isolation |
| 179 | + self.advertise_ip = conf.get( |
| 180 | + CONF_ADVERTISE_IP) or self.host_ip_addr |
| 181 | + |
| 182 | + self.advertise_port = conf.get( |
| 183 | + CONF_ADVERTISE_PORT) or self.listen_port |
| 184 | + |
172 | 185 | def entity_id_to_number(self, entity_id):
|
173 | 186 | """Get a unique number for the entity id."""
|
174 | 187 | if self.type == TYPE_ALEXA:
|
|
0 commit comments