mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Revise beacon name. Add debug.
This commit is contained in:
parent
09ef2e1b8c
commit
5a7e380396
@ -52,6 +52,8 @@ def setup_scanner(hass, config, see):
|
|||||||
|
|
||||||
# Block updates if we're in a region
|
# Block updates if we're in a region
|
||||||
with LOCK:
|
with LOCK:
|
||||||
|
_LOGGER.error("REGIONS_ENTERED %s",REGIONS_ENTERED)
|
||||||
|
_LOGGER.error("MOBILE_BEACONS_ACTIVE %s",MOBILE_BEACONS_ACTIVE)
|
||||||
if REGIONS_ENTERED[dev_id]:
|
if REGIONS_ENTERED[dev_id]:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"location update ignored - inside region %s",
|
"location update ignored - inside region %s",
|
||||||
@ -75,6 +77,10 @@ def setup_scanner(hass, config, see):
|
|||||||
'Unable to parse payload as JSON: %s', payload)
|
'Unable to parse payload as JSON: %s', payload)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
_LOGGER.error("REGIONS_ENTERED %s",REGIONS_ENTERED)
|
||||||
|
_LOGGER.error("MOBILE_BEACONS_ACTIVE %s",MOBILE_BEACONS_ACTIVE)
|
||||||
|
|
||||||
|
|
||||||
if not isinstance(data, dict) or data.get('_type') != 'transition':
|
if not isinstance(data, dict) or data.get('_type') != 'transition':
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -93,7 +99,6 @@ def setup_scanner(hass, config, see):
|
|||||||
if data['t'] == 'b':
|
if data['t'] == 'b':
|
||||||
# Not a HA zone, and a beacon so assume mobile
|
# Not a HA zone, and a beacon so assume mobile
|
||||||
MOBILE_BEACONS_ACTIVE[dev_id].append(location)
|
MOBILE_BEACONS_ACTIVE[dev_id].append(location)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Normal region
|
# Normal region
|
||||||
kwargs['location_name'] = location
|
kwargs['location_name'] = location
|
||||||
@ -118,10 +123,10 @@ def setup_scanner(hass, config, see):
|
|||||||
zone = hass.states.get("zone.{}".format(new_region))
|
zone = hass.states.get("zone.{}".format(new_region))
|
||||||
kwargs['location_name'] = new_region
|
kwargs['location_name'] = new_region
|
||||||
_set_gps_from_zone(kwargs, zone)
|
_set_gps_from_zone(kwargs, zone)
|
||||||
_LOGGER.info("Exit from %s to %s", location, new_region)
|
_LOGGER.info("Exit from to %s", new_region)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
_LOGGER.info("Exit from %s to GPS", location)
|
_LOGGER.info("Exit from to GPS")
|
||||||
|
|
||||||
see(**kwargs)
|
see(**kwargs)
|
||||||
see_beacons(dev_id, kwargs)
|
see_beacons(dev_id, kwargs)
|
||||||
@ -140,8 +145,8 @@ def setup_scanner(hass, config, see):
|
|||||||
""" Set active beacons to the current location """
|
""" Set active beacons to the current location """
|
||||||
|
|
||||||
for beacon in MOBILE_BEACONS_ACTIVE[dev_id]:
|
for beacon in MOBILE_BEACONS_ACTIVE[dev_id]:
|
||||||
kwargs['dev_id'] = beacon
|
kwargs['dev_id'] = "{}_{}".format(BEACON_DEV_ID, beacon)
|
||||||
kwargs['host_name'] = BEACON_DEV_ID
|
kwargs['host_name'] = beacon
|
||||||
see(**kwargs)
|
see(**kwargs)
|
||||||
|
|
||||||
mqtt.subscribe(hass, LOCATION_TOPIC, owntracks_location_update, 1)
|
mqtt.subscribe(hass, LOCATION_TOPIC, owntracks_location_update, 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user