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

Deprecate implicit state_topic for MQTT discovery #22998

Conversation

emontnemery
Copy link
Contributor

Breaking Change:

MQTT discovery will not longer implicitly set state_topic except for mqtt.alarm_control_panel, mqtt.binary_sensor and mqtt.sensor.

Description:

MQTT discovery implicitly sets state_topic, this is not documented, not covered by any tests and breaks implicit optimistic mode.

This PR:

  • Does not implicitly set state_topic for components where a state_topic is not required, i.e. where implicit optimistic mode is possible.
  • Prints a warning message when a state_topic is implicitly set
  • Adds tests

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@emontnemery emontnemery requested a review from a team as a code owner April 11, 2019 14:55
@ghost ghost assigned emontnemery Apr 11, 2019
@ghost ghost added the in progress label Apr 11, 2019
@github-actions
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration (mqtt) you are listed as a codeowner for? Thanks!

@codecov
Copy link

codecov bot commented Apr 11, 2019

Codecov Report

Merging #22998 into dev will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev   #22998      +/-   ##
==========================================
+ Coverage   93.95%   93.98%   +0.03%     
==========================================
  Files         448      449       +1     
  Lines       36750    36763      +13     
==========================================
+ Hits        34529    34553      +24     
+ Misses       2221     2210      -11
Impacted Files Coverage Δ
homeassistant/components/mqtt/climate.py 99.49% <ø> (-0.01%) ⬇️
homeassistant/components/mqtt/camera.py 100% <ø> (ø) ⬆️
homeassistant/components/mqtt/discovery.py 97.93% <100%> (+0.04%) ⬆️
homeassistant/components/mqtt/lock.py 91.83% <0%> (-8.17%) ⬇️
homeassistant/loader.py 94.11% <0%> (-0.2%) ⬇️
homeassistant/helpers/service.py 93.19% <0%> (-0.08%) ⬇️
homeassistant/components/google_assistant/trait.py 96.1% <0%> (-0.05%) ⬇️
homeassistant/helpers/entity_component.py 96.18% <0%> (-0.03%) ⬇️
homeassistant/components/deconz/deconz_device.py 100% <0%> (ø) ⬆️
homeassistant/helpers/aiohttp_client.py 95.34% <0%> (ø) ⬆️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d078e50...aa0c1d7. Read the comment docs.

@balloob balloob merged commit d99637e into home-assistant:dev Apr 14, 2019
@ghost ghost removed the in progress label Apr 14, 2019
@emontnemery emontnemery deleted the mqtt_discovery_deprecate_implicit_state_topic branch April 28, 2019 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants