Fix style issues
This commit is contained in:
parent
adfcfad488
commit
25e1432403
1 changed files with 14 additions and 11 deletions
|
@ -33,7 +33,6 @@ def setup_scanner(hass, config, see):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# TODO: What happens with HA turns off?
|
|
||||||
def _handle_get_api_locative(hass, see, handler, path_match, data):
|
def _handle_get_api_locative(hass, see, handler, path_match, data):
|
||||||
""" Locative message received. """
|
""" Locative message received. """
|
||||||
|
|
||||||
|
@ -58,26 +57,31 @@ def _handle_get_api_locative(hass, see, handler, path_match, data):
|
||||||
|
|
||||||
if "zone.{}".format(location_name.lower()) in zones:
|
if "zone.{}".format(location_name.lower()) in zones:
|
||||||
see(dev_id=device, location_name=location_name)
|
see(dev_id=device, location_name=location_name)
|
||||||
handler.write_json_message("Set new location to {}".format(location_name))
|
handler.write_json_message(
|
||||||
|
"Set new location to {}".format(location_name))
|
||||||
else:
|
else:
|
||||||
see(dev_id=device, gps=gps_coords)
|
see(dev_id=device, gps=gps_coords)
|
||||||
handler.write_json_message("Set new location to {}".format(gps_coords))
|
handler.write_json_message(
|
||||||
|
"Set new location to {}".format(gps_coords))
|
||||||
|
|
||||||
elif direction == 'exit':
|
elif direction == 'exit':
|
||||||
current_zone = hass.states.get("{}.{}".format("device_tracker", device)).state
|
current_zone = hass.states.get(
|
||||||
|
"{}.{}".format("device_tracker", device)).state
|
||||||
|
|
||||||
if current_zone.lower() == location_name.lower():
|
if current_zone.lower() == location_name.lower():
|
||||||
see(dev_id=device, location_name=STATE_NOT_HOME)
|
see(dev_id=device, location_name=STATE_NOT_HOME)
|
||||||
handler.write_json_message("Set new location to not home")
|
handler.write_json_message("Set new location to not home")
|
||||||
else:
|
else:
|
||||||
# Ignore the message if it is telling us to exit a zone that we aren't
|
# Ignore the message if it is telling us to exit a zone that we
|
||||||
# currently in. This occurs when a zone is entered before the previous
|
# aren't currently in. This occurs when a zone is entered before
|
||||||
# zone was exited. The enter message will be sent first, then the exit
|
# the previous zone was exited. The enter message will be sent
|
||||||
# message will be sent second.
|
# first, then the exit message will be sent second.
|
||||||
handler.write_json_message("Ignoring transition to {}".format(location_name))
|
handler.write_json_message(
|
||||||
|
"Ignoring transition to {}".format(location_name))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
handler.write_json_message("Received unidentified message: {}".format(direction))
|
handler.write_json_message(
|
||||||
|
"Received unidentified message: {}".format(direction))
|
||||||
_LOGGER.error("Received unidentified message from Locative: %s",
|
_LOGGER.error("Received unidentified message from Locative: %s",
|
||||||
direction)
|
direction)
|
||||||
|
|
||||||
|
@ -115,4 +119,3 @@ def _check_data(handler, data):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue