## Description:
More fixes flagged by pylint 2 that don't hurt to have before the actual pylint 2 upgrade (which I'll submit soon).
## Checklist:
- [ ] The code change is tested and works locally.
- [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
* Add discovery support to mqtt climate component.
* - Fix flake8 error (./homeassistant/components/climate/mqtt.py:130:1: D202 No blank lines allowed after function docstring)
- Fix test error (since climate component was expected not to work - changed it to "lock" component, which also does not have MQTT discovery support yet)
* Fix old assert statement to reflect new lock component usage
* Change invalid MQTT discovery component type from 'lock' to 'timer', since contrary to the documentation the lock component is properly supported when using MQTT discovery.
* Make configuration of invalid MQTT config component a single point of entry to prevent missing the assertion later in the code when changing.
* Add new testcases to cover not-yet-covered code paths in https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/climate/mqtt.py
* Enable autodiscovery for mqtt cameras, BREAKING CHANGE: homogenisation topic->state_topic
* fix line too long
* fix topic->state_topic in test
* image shall not be the state of entity
* phue -> aiohue
* Clean up
* Fix config
* Address comments
* Typo
* Fix rebase error
* Mark light as unavailable when bridge is disconnected
* Tests
* Make Throttle work with double delay and async
* Rework update logic
* Don't resolve host to IP
* Clarify comment
* No longer do unnecessary updates
* Add more doc
* Another comment update
* Wrap up tests
* Lint
* Fix tests
* PyLint does not like mix 'n match async and coroutine
* Lint
* Update aiohue to 1.2
* Lint
* Fix await MagicMock
* MQTT Typing
* Tiny style change
* Fixes
I should've probably really sticked to limiting myself to static typing...
* Small fix 😩
Ok, this seriously shouldn't have happened.
* Fix MQTT retained message not being re-dispatched
* Fix tests
* Use paho-mqtt for retained messages
* Improve code style
* Store list of subscribers
* Fix lint error
* Adhere to Home Assistant's logging standard
"Try to avoid brackets and additional quotes around the output to make it easier for users to parse the log."
- https://home-assistant.io/developers/development_guidelines/
* Add reconnect tests
* Fix lint error
* Introduce Subscription
Tests still need to be updated
* Use namedtuple for MQTT messages
... And fix issues
Accessing the config manually at runtime isn't ideal
* Fix MQTT __init__.py tests
* Updated usage of Mocks
* Moved tests that were testing subscriptions out of the MQTTComponent test, because of how mock.patch was used
* Adjusted the remaining tests for the MQTT clients new behavior - e.g. self.progress was removed
* Updated the async_fire_mqtt_message helper
* ✅ Update MQTT tests
* Re-introduce the MQTT subscriptions through the dispatcher for tests - quite ugly though... 🚧
* Update fixtures to use our new MQTT mock 🎨
* 📝 Update base code according to comments
* 🔨 Adjust MQTT test base
* 🔨 Update other MQTT tests
* 🍎 Fix carriage return in source files
Apparently test_mqtt_json.py and test_mqtt_template.py were written on Windows. In order to not mess up the diff, I'll just redo the carriage return.
* 🎨 Remove unused import
* 📝 Remove fire_mqtt_client_message
* 🐛 Fix using python 3.6 method
What's very interesting is that 3.4 didn't fail on travis...
* 🐛 Fix using assert directly
* Lazy loading of service descriptions
* Fix tests
* Load YAML in executor
* Return a copy of available services to allow mutations
* Remove lint
* Add zha/services.yaml
* Only cache descriptions for known services
* Remove lint
* Remove description loading during service registration
* Remove description parameter from async_register
* Test async_get_all_descriptions
* Remove lint
* Fix typos from multi-edit
* Remove unused arguments
* Remove unused import os
* Remove unused import os, part 2
* Remove unneeded coroutine decorator
* Only use executor for loading files
* Cleanups suggested in review
* Increase test coverage
* Fix races in existing tests
This applies what was the intended fix in #8336.
moves the fallback for setting client_id to the case when no mqtt config was provided at all. This should reflect the most common use case that fails.
This commit is a workaround and should be reverted when hbmqtt is fixed to allow empty client_id again.
* correct MQTT subscription filter
* wildcard handling (#) fixed
* wildcard handling (#) fixed
* added tests for topic subscription like +/something/#
* function names changed (line too long)
* using raw strings for regular expression
import order changed
* Managing binary payloads
Hello,
background: I wrote a HA camera component that gets the image from a binary payload. I'm testing it with Zanzito (https://play.google.com/store/apps/details?id=it.barbaro.zanzito) and it works apparently well: it gets the image and correctly displays it in the front-end.
But I had to make the changes I'm proposing here: the message was being blocked because the utf-8 decoding failed.
As far as I know, the utf-8 encoding is required for the topic, not for the payload. What I did here was try the utf-8 decoding, but even if unsuccessful, it dispatches the message anyway.
Is there anything else I'm missing?
thanks
Gianluca
* Update __init__.py
* Update __init__.py
* Update __init__.py
* git test - ignore
* Should work
* minor fixes
* updated mqtt/services.yaml
* added two tests, modified threaded subscribe
* removing polymer
* requested changes
* requested changes - minor fix
* security wrap around payload_file_path
* services.yaml updated
* removed file publishing
* minor fix
* Automation: initial state > restore state
* Clean up code
* Ensure MQTT defaults are used.
* Ensure failed platforms always return None
* Automation: write state to state machine after start
* automatically use bundled certificate if certificate-parameter is set to 'auto' and seperate this from which port is specified
* Fix travis error and long lines
* Update __init__.py
* Be able to select tls_version
* This test should always assert this value, not only in 3.6
* Disable linting on future property (py36)
* Only allow TLS 1.0, 1.1 and 1.2
* Fix line length issue
* Fix check config tests
* Allow auto as a TLS version
* Add effect support to MQTT Light
* Use effect state topic for supported_features
* Dont use rainbow as default color
* Add color_temp support to MQTT JSON Light
* Add effect to MQTT JSON light
* Support lights in MQTT discovery
* Allow discovered devices to set their platform
* Add white value support to MQTT Light
* Add white value support to MQTT JSON Light
* Remove blank line
* Add color_temp support to MQTT Template light
* Add white value support to MQTT Template Light
* Remove unused SUPPORT_MQTT_TEMPLATE and stale unused flash and transition code from MQTT Template
* Add XY Color to MQTT Light Platform
* Fix syntax
* Fix more syntax errors
* Revert "Remove unused SUPPORT_MQTT_TEMPLATE and stale unused flash and transition code from MQTT Template"
This reverts commit c03798cb63.
* MQTT Template supports flash and transition but doesnt allow templating of the values
* Add XY color support to MQTT JSON
* Proper variable names
* Only allow whitelisted MQTT platforms to be loaded via MQTT Discovery
* Minor tweaks.
* Use bundled certificates if port matches mqtts
* Move import requests.certs to top, since it's used in more places
* Add happy and non-happy path tests for default certificate bundle on mqtts port
* Migrate mqtt to async
* address paulus comment / convert it complet async
* adress paulus comment / remove future
* Automation triggers should be async
* Fix MQTT async calls
* Show that event helpers are callbacks
* Fix tests
* Lint
* catch all errors when doing mqtt message unicode-decode.
* added AttributeError and UnicodeDecodeError to exception when decoding an mqtt message payload
* added error handling to mqtt message receive if payload is not utf-8 unicode
added mqtt test for above code as well
* change permission back to 644
* attempting to test new code
* changed exception to AttributeError
fixed test for above
* fixed lint errors I made in tests....mqtt/test_init.py
* more lint fixes for my added test
* remove dual decode of MQTT payload
* convert if to try, except, else statement for mqtt payload decode
* rework mqtt unicode testing code to properly check for log file entriy on unicode decode exception
* fixed lint error
* Update test_init.py
* Add async_safe annotation
* More async_run_job
* coroutine -> async_save
* Lint
* Rename async_safe -> callback
* Add tests to core for different job types
* Add one more test with different type of callbacks
* Fix typing signature for callback methods
* Fix callback service executed method
* Fix method signatures for callback
* Template platforms: create_task instead of yield from
* Automation: less yielding, more create_tasking
* Helpers.script: less yielding, more create_tasking
* Deflake logbook test
* Deflake automation reload config test
* MQTT: Use async_add_job and threaded_listener_factory
* Deflake other logbook test
* lint
* Add test for automation trigger service
* MQTT client can be called from within async
* Use mqtt component to enable a MySensors MQTT gateway.
* Setup the MQTT gateway if mysensors config has mqtt as a value for
the key device in the list of gateways.
* Simplify two lines in the mqtt component.
* Made changes so that the mqtt configuration can accept client keys and certs for auth.
* Need to figure out how the broker_config works, it's failing tests
* Fixed it so all tests passed and ssl feature works for all brokers
which are't embedded
* Bring into line with pep8
* Added config validation which has allowed me to make the code simpler
Fix test to prevent early exit of mqtt init handler when
both embedded and broker configs are present.
Signed-off-by: Gwendal Grignou <gwendal@gmail.com>
vol.IsFile results in an instance of the IsFile method being returned by
the schema validation process. It needs to be called in order to do the
right thing.
Also fixes a bug where the test when no payload is given succeeds only
because we run the jinja templating out of memory. Sending an empty
payload instead of trying to fix it through validation for now.
* Service validation for MQTT component.
* Fixes for failing mqtt tests.
- Changed behaviour when both 'payload' and 'payload_template' are provided
instead of silently ignoring the payload_template value.
- Have validation accept any type of payload and leave encoding to paho-mqtt.