Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gearbest sensor #10556

Merged
merged 10 commits into from
Dec 5, 2017
Merged

Conversation

HerrHofrat
Copy link
Contributor

@HerrHofrat HerrHofrat commented Nov 13, 2017

Description:

The gearbest sensor will track price of a product from Gearbest. This information can be used in e.g. automations to notify you when a price drops. The update interval for every item is currently set to 2 hours.

Pull request in home-assistant.github.io with documentation: home-assistant/home-assistant.io#3973

Example entry for configuration.yaml:

# Example configuration.yaml entry
sensor:
  - platform: gearbest
    currency: EUR
    items:
      - url: https://www.gearbest.com/3d-printers-3d-printer-kits/pp_779174.html?wid=21
        name: Creality CR-10 upgraded
        currency: USD
      - id: 779174
        name: Creality CR-10 upgraded #2
        currency: EUR

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable ([example][ex-requir]).
  • New dependencies are only imported inside functions that use them ([example][ex-import]).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Get the latest price from gearbest and updates the state."""
self._hass.loop.run_in_executor(None, self._parser.update_conversion_list)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (82 > 79 characters)


hass.loop.run_in_executor(None, _add_items, hass, config, async_add_devices)

def _add_items(hass, config, async_add_devices):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1


del discovery_info #unused

hass.loop.run_in_executor(None, _add_items, hass, config, async_add_devices)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (80 > 79 characters)

def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the Gearbest sensor."""

del discovery_info #unused

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least two spaces before inline comment
inline comment should start with '# '

CONF_CURRENCY = 'currency'

ICON = 'mdi:coin'
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=2*60*60) #2h * 60min * 60sec

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least two spaces before inline comment
inline comment should start with '# '


_ITEM_SCHEMA = vol.Schema({
vol.Optional("url"): cv.string,
vol.Optional("id"): cv.string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all items can be optional, at least something should be required or else how can one represent an item?

def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the Gearbest sensor."""

del discovery_info #unused
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do this.


del discovery_info #unused

hass.loop.run_in_executor(None, _add_items, hass, config,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do this either. If your setup is sync, don't define an async setup platform method.

async_add_devices)


def _add_items(hass, config, async_add_devices):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method can just be your setup_platform

except AttributeError as exc:
_LOGGER.error(exc)

async_add_devices(sensors)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't call async methods from sync context

self._hass = hass
self._name = item.get("name", None)
self._parser = GearbestParser()
self._parser.update_conversion_list()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parser is updating this list once per entity. Instead can it be shared among entities?

item.get("url", None),
item.get("currency", currency))
if self._item is None:
raise AttributeError("id and url could not be resolved")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AttributeError? A ValueError maybe.

"""Return the state attributes."""
attrs = {'name': self._item.name,
'description': self._item.description,
'image': self._item.image,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't make this an attribute, instead make it the entity_picture property.

@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Get the latest price from gearbest and updates the state."""
self._hass.loop.run_in_executor(None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What? Don't run things in the executor inside a sync context… Just call the methods directly.

def update(self):
"""Get the latest price from gearbest and updates the state."""
self._hass.loop.run_in_executor(None,
self._parser.update_conversion_list)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is called too often and needs to be shared between entities.

Implemented library version 1.0.5
vol.Required(CONF_CURRENCY): cv.string,
})

def setup_platform(hass, config, add_devices, discovery_info=None):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

https://home-assistant.io/components/sensor.gearbest/
"""
import logging
import asyncio

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'asyncio' imported but unused

DOMAIN = 'gearbest'

_ITEM_SCHEMA = vol.All(
vol.Any(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nitpick: This can be replaced by has_at_least_one_key from config_validation.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure? It should validate if either url or id is present. It will also work when both are available, but it would make no sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, you would still need the vol.Exclusive() below. Just the first vol.Any(…) can be replaced. You could of course build a has_exactly_n_keys in config_validation.py (which would look very similar to has_at_least_one_key) and use it then here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allright - you mean like

_ITEM_SCHEMA = vol.All(
    vol.Schema({
        vol.Exclusive('url', 'XOR'): cv.string,
        vol.Exclusive('id', 'XOR'): cv.string,
        vol.Optional("name"): cv.string,
        vol.Optional("currency"): cv.string
    }), cv.has_at_least_one_key("url", "id")
)

I'll test that later and commit it

@@ -19,6 +19,9 @@
_LOGGER = logging.getLogger(__name__)

CONF_ITEMS = 'items'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to factor these out. However, at least CONF_NAME, CONF_URL, CONF_ID and CONF_CURRENCY should be imported from homeassistant/const.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out! What do you think about using CONF_ENTITIES instead of items?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the context of home assistant, entity is a very fixed term for an object representing a physical (or virtual) device, something that has a state, belongs to a component, offers services, can be represented in the front end, etc. So, no, don't use that term for Gearbest items. ;-)

@covrig
Copy link
Contributor

covrig commented Nov 14, 2017

Don't we have the scrape sensor for this?

@arsaboo
Copy link
Contributor

arsaboo commented Nov 15, 2017

@covrig I haven't tried it, but can we achieve similar results using the scrape sensor? The Gearbest component parses everything and even returns the entity_picture.

@covrig
Copy link
Contributor

covrig commented Nov 15, 2017

@arsaboo I wonder, why don't we work on enriching the scrape sensor even further instead of developing a new sensor? I think excluding the entity_picture everything else could be obtained with the scrape sensor.

Why stop at Gearbest? There are so many websites that could be integrated in here.

@fabaff fabaff changed the title Feature/gearbest sensor Gearbest sensor Dec 3, 2017
for item in items:
try:
sensor = GearbestSensor(hass, item, currency)
if sensor is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can't happen.

from gearbest_parser import GearbestParser

self._hass = hass
self._name = item.get(CONF_NAME, None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is the default value if the key is not found.

self._name = item.get(CONF_NAME, None)
self._parser = GearbestParser()
self._parser.set_currency_converter(hass.data[DOMAIN])
self._item = self._parser.load(item.get(CONF_ID, None),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is the default value if the key is not found.

self._parser = GearbestParser()
self._parser.set_currency_converter(hass.data[DOMAIN])
self._item = self._parser.load(item.get(CONF_ID, None),
item.get(CONF_URL, None),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

"""Initialize the sensor."""
from gearbest_parser import GearbestParser

self._hass = hass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this.

self._hass = hass
self._name = item.get(CONF_NAME, None)
self._parser = GearbestParser()
self._parser.set_currency_converter(hass.data[DOMAIN])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self._parser.set_currency_converter(converter)

sensors = []
items = config.get(CONF_ITEMS)

hass.data[DOMAIN] = CurrencyConverter()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, you don't need to store the convert in hass.data at all. Just do:

converter = CurrencyConverter()


for item in items:
try:
sensor = GearbestSensor(hass, item, currency)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sensor = GearbestSensor(converter, item, currency)

"""Return the state attributes."""
attrs = {'name': self._item.name,
'description': self._item.description,
'price': self._item.price,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Price is the state, so you don't need that here.

item.get(CONF_CURRENCY, currency))
if self._item is None:
raise ValueError("id and url could not be resolved")
self._item.update()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, and instead call add_devices in setup_platform like this:

add_devices(sensors, True)

sensors = []
items = config.get(CONF_ITEMS)

hass.data[DOMAIN] = CurrencyConverter()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, you don't need to store the convert in hass.data at all. Just do:

converter = CurrencyConverter()

items = config.get(CONF_ITEMS)

hass.data[DOMAIN] = CurrencyConverter()
hass.data[DOMAIN].update()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

converter.update()

MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=2*60*60) # 2h
MIN_TIME_BETWEEN_CURRENCY_UPDATES = timedelta(seconds=12*60*60) # 12h

DOMAIN = 'gearbest'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this. This is the 'sensor' domain.


def currency_update(event_time):
"""Update currency list."""
hass.data[DOMAIN].update()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

converter.update()

currency_update,
MIN_TIME_BETWEEN_CURRENCY_UPDATES)

add_devices(sensors)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_devices(sensors, True)

Fixed couple of issues found by MartinHjelmare
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!

@MartinHjelmare MartinHjelmare merged commit 821cf71 into home-assistant:dev Dec 5, 2017
jbarrancos added a commit to jbarrancos/home-assistant that referenced this pull request Dec 7, 2017
* Updated codeowner for Tile device tracker (home-assistant#10861)

* Revert "KNX: Added config option for broadcasting current time to KNX bus. (home-assistant#10654)" (home-assistant#10874)

This reverts commit cadd797.

As discussed within home-assistant#10708 we should chose a different implementation. Therefore we should revert this change to avoid a breaking change.

* Upgrade distro to 1.1.0 (home-assistant#10850)

* Bugfix trigger state with multible entities (home-assistant#10857)

* Bugfix trigger state with multible entities

* Fix numeric state

* fix lint

* fix dict

* fix unsub

* fix logic

* fix name

* fix new logic

* add test for state

* add numeric state test for unsub

* add test for multible entities

* Update numeric_state.py

* Update numeric_state.py

* Update state.py

* Fix logic for triple match

* Add clear to numeric state

* clear for state trigger

* tellstick fix DEPENDENCIES and update tellcore-net (home-assistant#10859)

* Update requirements_all.txt

* Update tellstick.py

* Fix DEPENDENCIES

* Update requirements_all.txt

* fix format

* fix lint

* fix lint

* Update tellstick.py

* update tellcore-net

* update tellcore-net

* besser validate

* Update frontend to 20171130.0

* Upgrade aiohttp to 2.3.5 (home-assistant#10889)

* Upgrade fastdotcom to 0.0.3 (home-assistant#10886)

* Upgrade schiene to 0.19 (home-assistant#10887)

* Xiaomi Vacuum: remove deprecated calls (home-assistant#10839)

* vacuum.xiaomi_miio: read dnd status properly instead of using imprecise dnd flag from vacuum_state

* vacuum.xiaomi_miio: use miio package instead of mirobo

* check only that wanted calls have taken place, ignore order of calls

* Fix linting issues

* Remove empty line after docstring

* Create ecobee weather platform (home-assistant#10869)

* Create ecobee weather component

* Update requirements_all for ecobee

* Fix missed lint issue

* Microsoft Text-to-speech: Fixing missing en-gb support bug (home-assistant#10429)

* Fixing missing en-gb support bug

* Microsoft TTS adding support for rate, volume, pitch and contour.

* Microsoft TTS fixing support for jp-jp.

* Fixing linting error on line 67

* make impossible things possible 🎉

* Upgrade youtube_dl to 2017.11.26 (home-assistant#10890)

* Upgrade yarl to 0.15.0 (home-assistant#10888)

* Fix tests (home-assistant#10891)

* Refactored WHOIS sensor to resolve assumed key errors (home-assistant#10662)

* Refactored WHOIS sensor to resolve assumed key errors

Altered it to now set an attribute key and value only if the attribute
is present in the WHOIS response. This prevents assumed keys (registrar)
from raising a KeyError on WHOIS lookups that don't contain registrar
information (onet.pl, wp.pl, for example).

* Removed non-used self._data

* WHOIS sensor now creates a new local attributes dict and overrides

* Corrected typos, refactored error cases to clear state adn attributes

* Resolved double return and refactored error logging

* Serve latest extra_html in dev mode (home-assistant#10863)

* Reload groups after saving a change via config API (home-assistant#10877)

* Version bump to 0.59.0

* Update ecobee version to fix stack-trace issue (home-assistant#10894)

* Pybotvac multi (home-assistant#10843)

* Update requirements_all.txt

* Update neato.py

* Fix issues from review of ecobee weather component (home-assistant#10903)

* Fix issues from review

* Don't use STATE_UNKNOWN

* Bugfix home-assistant#10902 (home-assistant#10904)

* Fix issues from review of ecobee weather component (home-assistant#10903)

* Fix issues from review

* Don't use STATE_UNKNOWN

* Bugfix home-assistant#10902 (home-assistant#10904)

* More declarative timeout syntax for manual alarm control panel. (home-assistant#10738)

More declarative timeout syntax for manual alarm control panel

* Unpacking RESTful sensor JSON results into attributes. (home-assistant#10753)

* Added support for extracting JSON attributes from RESTful values

Setting the json_attributes configuration option to true on the
RESTful sensor will cause the result of the REST request to be parsed
as a JSON string and if successful the resulting dictionary will be
used for the attributes of the sensor.

* Added support for extracting JSON attributes from RESTful values

Setting the json_attributes configuration option to true on the
RESTful sensor will cause the result of the REST request to be parsed
as a JSON string and if successful the resulting dictionary will be
used for the attributes of the sensor.

* Added requirement that RESTful JSON results used as attributes must be
objects, not lists.

* Expanded test coverage to test REFTful JSON attributes with and
without a value template.

* Added support for extracting JSON attributes from RESTful values

Setting the json_attributes configuration option to true on the
RESTful sensor will cause the result of the REST request to be parsed
as a JSON string and if successful the resulting dictionary will be
used for the attributes of the sensor.

* Added requirement that RESTful JSON results used as attributes must be
objects, not lists.

* Expanded test coverage to test REFTful JSON attributes with and
without a value template.

* sensor.envirophat: add missing requirement (home-assistant#7451)

Adding requirements that is not explicitly pulled in by the library
that manages the Enviro pHAT.

* PyPI Openzwave (home-assistant#7415)

* Remove default zwave config path

PYOZW now has much more comprehensive default handling for the config
path (in src-lib/libopenzwave/libopenzwave.pyx:getConfig()). It looks in
the same place we were looking, plus _many_ more. It will certainly do a
much better job of finding the config files than we will (and will be
updated as the library is changed, so we don't end up chasing it). The
getConfig() method has been there for a while, but was subsntially
improved recently.

This change simply leaves the config_path as None if it is not
specified, which will trigger the default handling in PYOZW.

* Install python-openzwave from PyPI

As of version 0.4, python-openzwave supports installation from PyPI,
which means we can use our 'normal' dependency management tooling to
install it. Yay.

This uses the default 'embed' build (which goes and downloads
statically sources to avoid having to compile anything locally). Check
out the python-openzwave readme for more details.

* Add python-openzwave deps to .travis.yml

Python OpenZwave require the libudev headers to build. This adds the
libudev-dev package to Travis runs via the 'apt' addon for Travis.

Thanks to @MartinHjelmare for this fix.

* Update docker build for PyPI openzwave

Now that PYOZW can be install from PyPI, the docker image build process
can be simplified to remove the explicit compilation of PYOZW.

* Add datadog component (home-assistant#7158)

* Add datadog component

* Improve test_invalid_config datadog test

* Use assert_setup_component for test setup

* Fix object type for default KNX port

home-assistant#7429 describes a TypeError that is raised if the port is omitted in the config for the KNX component (integer is required (got type str)). This commit changes the default port from a string to an integer. I expect this will resolve that issue...

* Added support for extracting JSON attributes from RESTful values

Setting the json_attributes configuration option to true on the
RESTful sensor will cause the result of the REST request to be parsed
as a JSON string and if successful the resulting dictionary will be
used for the attributes of the sensor.

* Added requirement that RESTful JSON results used as attributes must be
objects, not lists.

* Expanded test coverage to test REFTful JSON attributes with and
without a value template.

* Added support for extracting JSON attributes from RESTful values

Setting the json_attributes configuration option to true on the
RESTful sensor will cause the result of the REST request to be parsed
as a JSON string and if successful the resulting dictionary will be
used for the attributes of the sensor.

* Added requirement that RESTful JSON results used as attributes must be
objects, not lists.

* Expanded test coverage to test REFTful JSON attributes with and
without a value template.

* Added support for extracting JSON attributes from RESTful values

Setting the json_attributes configuration option to true on the
RESTful sensor will cause the result of the REST request to be parsed
as a JSON string and if successful the resulting dictionary will be
used for the attributes of the sensor.

* Added requirement that RESTful JSON results used as attributes must be
objects, not lists.

* Expanded test coverage to test REFTful JSON attributes with and
without a value template.

* Fixed breaks cause by manual upstream merge.

* Added one extra blank line to make PyLint happy.

* Switched json_attributes to be a list of keys rather than a boolean.

The value of json_attributes can now be either a comma sepaated list
of key names or a YAML list of key names. Only matching keys in a
retuned JSON dictionary will be mapped to sensor attributes.

Updated test cases to handle json_attributes being a list.

Also fixed two minor issues arrising from manual merge with 0.58 master.

* Added an explicit default value to the json_attributes config entry.

* Removed self.update() from __init__() body.

* Expended unit tests for error cases of json_attributes processing.

* Align quotes

* Bump dev to 0.60.0.dev0 (home-assistant#10912)

* Update eliqonline.py (home-assistant#10914)

Channel id is now required (change in API)

* Add iAlarm support (home-assistant#10878)

* Add iAlarm support

* Minor fixes to iAlarm

* Rename ialarmpanel to ialarm and add a check for the host value

* corrections in the value validation of ialarm

* add a missing period on ialarm

* Correction of Samsung Power OFF behaviour (home-assistant#10907)

* Correction of Samsung Power OFF behaviour

Addition of a delay after powering OFF a Samsung TV, this avoid status
update from powering the TV back ON.
Deletion of update() return statement, return value not used.

* Rename self._end_of_power_off_command into self._end_of_power_off

* Removal of unused line break in Samsung TV component

* Add Alpha Vantage sensor (home-assistant#10873)

* Add Alpha Vantage sensor

* Remove data object

* Remove unused vars and change return

* Fix typo

* Don't repeat getting receiver name on each update / pushed to denonavr 0.5.5 (home-assistant#10915)

* Add Min and Event Count Metrics To Prometheus (home-assistant#10530)

* Added min and Events sensor types to prometheus

* Updated prometheus client and fixed invalid swith state

* Added metric to count number of times an automation is triggered

* Removed assumption that may not apply to everybody

* Fixed tests

* Updated requirements_test_all

* Fixed unit tests

* fix ios component config generation (home-assistant#10923)

Fixes: home-assistant#19020

* Fix Notifications for Android TV (home-assistant#10798)

* Fixed icon path, added dynamic icon

* Addressing requested changes

* Using DEFAULT_ICON

* Using CONF_ICON from const

* Getting hass_frontend path via import

* Lint

* Using embedded 1px transparent icon

* woof -.-

* Lint

* Update coveragerc (home-assistant#10931)

* Sort coveragerc

* Add climate.honeywell and vacuum.xiaomi_miio to coveragerc

* Update frontend to 20171204.0 (home-assistant#10934)

* Dominos no order fix (home-assistant#10935)

* check for none

* fix error from no store being set

* typo

* Lint

* fix default as per notes. Lint fix and make closest store None not False

* update default

* Version bump to 0.59.1

* Fix Notifications for Android TV (home-assistant#10798)

* Fixed icon path, added dynamic icon

* Addressing requested changes

* Using DEFAULT_ICON

* Using CONF_ICON from const

* Getting hass_frontend path via import

* Lint

* Using embedded 1px transparent icon

* woof -.-

* Lint

* fix ios component config generation (home-assistant#10923)

Fixes: home-assistant#19020

* Update frontend to 20171204.0 (home-assistant#10934)

* Dominos no order fix (home-assistant#10935)

* check for none

* fix error from no store being set

* typo

* Lint

* fix default as per notes. Lint fix and make closest store None not False

* update default

* Report availability of TP-Link smart sockets (home-assistant#10933)

* Report availability of TP-Link smart sockets

* Changes according to our style guide

* Set percent unit for battery level so that history displays properly; edited variable name for consistency (home-assistant#10932)

* Export climate status and target temperature to Prometheus (home-assistant#10919)

* Export climate metrics to Prometheus.

This adds climate_state and temperature_c metrics for each climate
device.

* Add more climate states to state_as_number

* Tado ignore invalid devices (home-assistant#10927)

* Ignore devices without temperatures

* Typo

* Linting

* Removing return false

* Another typo. :(

* Spelling received correctly

* Upgrade tellduslive library version (closes home-assistant#10922) (home-assistant#10950)

* don't ignore voltage data if sensor data changed (home-assistant#10925)

* Fix linksys_ap.py by inheriting DeviceScanner (home-assistant#10947)

As per issue home-assistant#8638, the class wasn't inheriting from DeviceScanner, this commit patches it up.

* Add ADS component (home-assistant#10142)

* add ads hub, light and switch

* add binary sensor prototype

* switch: use adsvar for connection

* fix some issues with binary sensor

* fix binary sensor

* fix all platforms

* use latest pyads

* fixed error with multiple binary sensors

* add sensor

* add ads sensor

* clean up after shutdown

* ads component with platforms switch, binary_sensor, light, sensor

add locking

poll sensors at startup

update state of ads switch and light

update ads requirements

remove update() from constructors on ads platforms

omit ads coverage

ads catch read error when polling

* add ads service

* add default settings for use_notify and poll_interval

* fix too long line

* Fix style issues

* no pydocstyle errors

* Send and receive native brightness data to ADS device to prevent issues with math.floor reducing brightness -1 at every switch

* Enable non dimmable lights

* remove setting of self._state in switch

* remove polling

* Revert "remove polling"

This reverts commit 7da420f.

* add service schema, add links to documentation

* fix naming, cleanup

* re-remove polling

* use async_added_to_hass for setup of callbacks

* fix comment.

* add callbacks for changed values

* use async_add_job for creating device notifications

* set should_poll to False for all platforms

* change should_poll to property

* add service description to services.yaml

* add for brigthness not being None

* put ads component in package

* Remove whitespace

* omit ads package

* Reload closest store on api menu request (home-assistant#10962)

* reload closest store on api request

* revert change from debugging

* Gearbest sensor (home-assistant#10556)

* Added Gearbest Sensor

* Updated required files

* Fixed houndci-bout findings

* Fix tox lint errors

* Changed code according to review
Implemented library version 1.0.5

* Fixed houndci-bot findings

* Fixed tox lint issues

* Updated item schema to use has_at_least_one_key
Added conf constants

* Remove CONF_ constants and import them from homeassistant.const

* Removed CurrencyConverter from hass
Fixed couple of issues found by MartinHjelmare

* Add Ziggo Mediabox XL media_player (home-assistant#10514)

* Add Ziggo Mediabox XL media_player

* Using pypi module ziggo-mediabox-xl now.

* Code review changes

* Generic thermostat initial_operation_mode (home-assistant#10690)

* Generic thermostat restore operation mode

* Test restore operation mode

* Fix trailing whitespace

* Fix line too long

* Fix test duplicate entity_id

* Fix test

* async_added_to_hass modify modify internal state

* Test inital_operation_mode

* More restore state tests

* Fix whitespace

* fix test_custom_setup_param

* Test "None" target temp

* Use new build path for dev translations (home-assistant#10937)

* Add option to set default hide if away for new devices (home-assistant#10762)

* Option to change hide_if_away

* tests fix

* change new device defaults

* tests and requested changes

* fix assert

* Allow chime to work for wink siren/chime (home-assistant#10961)

* Allow Wink siren/chimes to work

* Updated requirements_all.txt

* Revert pychromecast update (home-assistant#10989)

* Revert pychromecast update

* Update cast.py

* Require FF43 for latest js (home-assistant#10941)

* Require FF43 for latest js

`Array.prototype.includes` added in Firefox 43

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes

* Update __init__.py

* Version bump to 0.59.2

* Require FF43 for latest js (home-assistant#10941)

* Require FF43 for latest js

`Array.prototype.includes` added in Firefox 43

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes

* Update __init__.py

* Fix linksys_ap.py by inheriting DeviceScanner (home-assistant#10947)

As per issue home-assistant#8638, the class wasn't inheriting from DeviceScanner, this commit patches it up.

* Upgrade tellduslive library version (closes home-assistant#10922) (home-assistant#10950)

* Reload closest store on api menu request (home-assistant#10962)

* reload closest store on api request

* revert change from debugging

* Allow chime to work for wink siren/chime (home-assistant#10961)

* Allow Wink siren/chimes to work

* Updated requirements_all.txt

* Revert pychromecast update (home-assistant#10989)

* Revert pychromecast update

* Update cast.py

* Allow disabling the LEDs on TP-Link smart plugs (home-assistant#10980)

* Update frontend to 20171206.0

* Meraki AP Device tracker (home-assistant#10971)

* Device tracker for meraki AP

* styles fix

* fix again

* again

* and again :)

* fix hide if away

* docs and optimization

* tests and fixes

* styles

* styles

* styles

* styles

* styles fix. Hope last

* clear track new

* changes

* fix accuracy error and requested changes

* remove meraki from .coveragerc

* tests and minor changes

* remove location

* Update tradfri.py (home-assistant#10991)

* webostv: Ensure source exists before use (home-assistant#10959)

In a case where either (a) an incorrect source name is used, or (b) the
TV isn't currently queryable (e.g. it's off), we get tracebacks because
we assume the source that we are being asked to select exists in
self._source_list.

This makes the lookup code a little more rugged, and adds in a warning
message (in place of the current exception).

* Ensure Docker script files uses LF line endings to support Docker for Windows. (home-assistant#10067)

* Added Vera scenes (home-assistant#10424)

* Added Vera scenes

* Fixed flake8 issues

* Fixed comments

* Moved vera to use hass.data

* Made requested changes

* Fix Egardia alarm status shown as unknown after restart (home-assistant#11010)
akatrevorjay added a commit to akatrevorjay/home-assistant that referenced this pull request Dec 11, 2017
…into dev

* 'dev' of https://github.com/home-assistant/home-assistant:
  Meraki AP Device tracker (home-assistant#10971)
  Update frontend to 20171206.0
  Allow disabling the LEDs on TP-Link smart plugs (home-assistant#10980)
  Revert pychromecast update (home-assistant#10989)
  Reload closest store on api menu request (home-assistant#10962)
  Allow chime to work for wink siren/chime (home-assistant#10961)
  Upgrade tellduslive library version (closes home-assistant#10922) (home-assistant#10950)
  Fix linksys_ap.py by inheriting DeviceScanner (home-assistant#10947)
  Require FF43 for latest js (home-assistant#10941)
  Version bump to 0.59.2
  Require FF43 for latest js (home-assistant#10941)
  Revert pychromecast update (home-assistant#10989)
  Allow chime to work for wink siren/chime (home-assistant#10961)
  Add option to set default hide if away for new devices (home-assistant#10762)
  Use new build path for dev translations (home-assistant#10937)
  Generic thermostat initial_operation_mode (home-assistant#10690)
  Add Ziggo Mediabox XL media_player (home-assistant#10514)
  Gearbest sensor (home-assistant#10556)
  Reload closest store on api menu request (home-assistant#10962)
  Add ADS component (home-assistant#10142)
@fabaff fabaff mentioned this pull request Dec 16, 2017
@HerrHofrat HerrHofrat deleted the feature/Gearbest_Sensor branch December 18, 2017 07:01
@home-assistant home-assistant locked and limited conversation to collaborators Mar 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants