From ee9996374ccb281ce2e0cd6bcfdfce6c3192dcd6 Mon Sep 17 00:00:00 2001 From: Robbie Trencheny Date: Mon, 25 Apr 2016 11:43:18 -0700 Subject: [PATCH 1/2] Dont load price sensors for metered (read: taxi/cabs) products --- homeassistant/components/sensor/uber.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/uber.py b/homeassistant/components/sensor/uber.py index 3eb75382883..b29cca39c9b 100644 --- a/homeassistant/components/sensor/uber.py +++ b/homeassistant/components/sensor/uber.py @@ -47,7 +47,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None): (product_id not in wanted_product_ids): continue dev.append(UberSensor('time', timeandpriceest, product_id, product)) - if 'price_details' in product: + isMetered = (product['price_details']['estimate'] == "Metered") + if 'price_details' in product and isMetered is False: dev.append(UberSensor('price', timeandpriceest, product_id, product)) add_devices(dev) From f8340b94bc443cf56c0d50543927aea720d32658 Mon Sep 17 00:00:00 2001 From: Robbie Trencheny Date: Thu, 28 Apr 2016 17:57:03 -0700 Subject: [PATCH 2/2] Fix variable name --- homeassistant/components/sensor/uber.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sensor/uber.py b/homeassistant/components/sensor/uber.py index b29cca39c9b..611c0d44b3d 100644 --- a/homeassistant/components/sensor/uber.py +++ b/homeassistant/components/sensor/uber.py @@ -47,8 +47,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None): (product_id not in wanted_product_ids): continue dev.append(UberSensor('time', timeandpriceest, product_id, product)) - isMetered = (product['price_details']['estimate'] == "Metered") - if 'price_details' in product and isMetered is False: + is_metered = (product['price_details']['estimate'] == "Metered") + if 'price_details' in product and is_metered is False: dev.append(UberSensor('price', timeandpriceest, product_id, product)) add_devices(dev)