Commit Graph

1155 Commits (127eca3c35f07fa9732cf5525092d1491a44393f)

Author SHA1 Message Date
epenet 295cd0143c
Adjust type hints for SirenEntityFeature (#82266) 2022-11-17 15:06:26 +01:00
epenet 2453f95b24
Adjust HumidifierEntity type hints (#82248) 2022-11-17 10:58:46 +01:00
Jan Bouwhuis 3d00923665
Improve MQTT type hints / refactor part 9 - light (#81151)
* Improve type hints light base

* improve type hints light schema basic

* Improve type hints light schema json

* Use MQTT Template models with light template

* Addtional type hints for template light

* Improve template hints for schema template

* Use strict type hints for templates

* MyPy corrections

* Follow up comments

* Follow up comments

* Revert changes schema_json

* Revert changes schema template

* Hints setup_entity_json and setup_entity_template

* Remove type hint on setup_entity JSON
2022-11-17 10:22:25 +01:00
Jan Bouwhuis f60850586e
Remove `b64` encoding work-a-round for MQTT camera (#82244) 2022-11-17 10:11:25 +01:00
epenet 17573196c8
Adjust type hints for CoverEntityFeature (#82238) 2022-11-17 08:39:44 +01:00
GitHub Action c999953514 [ci skip] Translation update 2022-11-17 00:26:24 +00:00
epenet e85e79052b
Improve climate type hints for supported_features (#82223) 2022-11-16 23:07:48 +02:00
epenet f952b74b74
Adjust type hints for AlarmControlPanelEntityFeature (#82186) 2022-11-16 17:08:42 +01:00
epenet 00f4933e72
Import tag from homeassistant.components (#82161) 2022-11-16 07:09:46 +01:00
Jan Bouwhuis 7932864e00
Always update attributes on an update for MQTT update (#82139) 2022-11-15 18:43:01 +01:00
Jan Bouwhuis 285c61c0d7
Add TagProtocol as type hint in MQTT tag (#82134) 2022-11-15 16:54:39 +01:00
Jan Bouwhuis 6975186f2f
Improve MQTT type hints / refactor part 10 - vacuum (#81253)
* Improve type hints vacuum __init__ and schema

* Improve type hints and refactor templates legacy

* Improve type hints state vacuum

* Add hint for template parameters

* Apply suggestions from code review

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Some corrections

* Remove stale constant

* Use bitwise and

* Follow-up comment

* Remove incorrect type hint

* Remove asserts

* Cleanup  asserts and reduce code

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-11-15 12:48:02 +01:00
GitHub Action 83a6012f80 [ci skip] Translation update 2022-11-15 00:26:42 +00:00
Aarni Koskela bbda122c99
Fix mqtt typo (#82086)
mqtt: fix "certiticate" typo
2022-11-14 16:22:23 +01:00
GitHub Action a6a3bf261d [ci skip] Translation update 2022-11-12 00:28:24 +00:00
Jan Bouwhuis 7500d0c61c
Refactor MQTT_WILL_BIRTH_SCHEMA (#81879)
* Refactor MQTT_WILL_BIRTH_SCHEMA

* Refactor and move birth/will validation to utils

* Simplify birth will validation
2022-11-10 15:24:56 +01:00
GitHub Action 8b4dbbe593 [ci skip] Translation update 2022-11-10 00:27:41 +00:00
GitHub Action dcf68d768e [ci skip] Translation update 2022-11-09 00:27:20 +00:00
Jan Bouwhuis b364ef98a0
Use `_attr_` for MQTT vacuum (#81534)
* Use `_attr_` for MQTT vacuum

* Remove unneeded properties

* Follow-up comment

* Remove default value
2022-11-08 18:48:08 +01:00
Jan Bouwhuis 7d768dc3a6
Improve MQTT type hints / refactor part 7 - trigger (#81019)
* Improve typing trigger

* Improve hints on templates

* Use new sentinel for template

* Follow-up comment
2022-11-08 17:02:06 +01:00
Aarni Koskela 88a7c76739
Fix late-import paho (#81791)
fix: late-import MQTTMessage

`paho-mqtt` is not listed in main requirements and is imported early by `conftest`.

Import it late to avoid an ImportError.

Split out from #81678.
2022-11-08 16:16:31 +01:00
Jan Bouwhuis 4293c88fb6
Improve MQTT type hints part 6 (#81001)
* Improve typing siren

* Improve typing switch

* Set siren type hints at class level

* Set switch type hints at class level

* Follow up comment

* Improve hints on siren templates

* Another cleanup for siren

* Follow up comment

* Follow up comment
2022-11-08 13:11:45 +01:00
Jan Bouwhuis 47dba6f6bc
Improve MQTT type hints part 5 (#80979)
* Improve typing scene

* Improve typing select

* Improve typing sensor

* move expire_after - and class level attrs

* Follow up comment

* Solve type confict

* Remove stale sentinel const

* Update homeassistant/components/mqtt/sensor.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Make _expire_after a class attribute

* Code styling

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-11-08 12:55:41 +01:00
Jan Bouwhuis d66d079330
Use `_attr_` for MQTT light (#81465)
* Schema basic

* Schema json

* Schema template

* add color_mode - follow up comments

* Fix regression

* Follow up comments 2

* Fix mypy errors

* Update homeassistant/components/mqtt/light/schema_template.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-11-08 10:16:05 +01:00
Jan Bouwhuis 8c0a7b9d7f
Add type hints for MQTT tag (#81495)
* Improve typing tag

* Additional type hints for tag platform

* Follow up comment tag

* Folow up comments

* Revert comment removal
2022-11-08 09:24:16 +01:00
Jan Bouwhuis 88faf33cb8
Improve type hints for MQTT climate (#81396)
* Improve typing climate

* Move climate type hints to class level

* Apply suggestions from code review

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* remove stale command after applying suggestions

* cleanup

* Update homeassistant/components/mqtt/climate.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-11-08 09:17:03 +01:00
GitHub Action 785cf0e29c [ci skip] Translation update 2022-11-08 00:26:39 +00:00
Jan Bouwhuis b9c47ed3c3
Align MQTT config entry setup strings with option flow (#81616) 2022-11-07 10:45:27 -06:00
epenet 9b2a8901b1
Adjust payload sentinel in mqtt (#81553)
* Adjust payload sentinel in mqtt

* Add type hints

* Update sensor.py

* Adjust vacuum

* Add type hints

* Adjust schema basic

* Remove invalid hint
2022-11-07 12:31:11 +01:00
Jan Bouwhuis ff4456cb29
Improve MQTT type hints part 4 (#80971)
* Improve typing humidifier

* Improve typing lock

* Improve typing number

* Set humidifier type hints at class level

* Set lock type hints at class level

* Set number type hints at class level

* Some small updates

* Follow up comment

* Remove assert
2022-11-07 08:24:49 +01:00
GitHub Action fc472eb040 [ci skip] Translation update 2022-11-06 00:27:15 +00:00
GitHub Action c7fc51cfa5 [ci skip] Translation update 2022-11-04 00:29:52 +00:00
Jan Bouwhuis b3403d7fca
Improve MQTT type hints part 3 (#80542)
* Improve typing debug_info

* Improve typing device_automation

* Improve typing device_trigger

* Improve typing fan

* Additional type hints device_trigger

* Set fan type hints to class level

* Cleanup and mypy

* Follow up and missed hint

* Follow up comment
2022-11-03 13:06:53 +01:00
Jan Bouwhuis 203c83b6f0
Use _attr_ in MQTT climate (#81406)
* Use _attr_ in MQTT climate

* Follow up comment

* Do not change code
2022-11-03 10:58:37 +01:00
GitHub Action 7995f0e414 [ci skip] Translation update 2022-11-03 00:28:45 +00:00
Jan Bouwhuis bda7e416c4
Improve MQTT type hints part 2 (#80529)
* Improve typing camera

* Improve typing cover

* b64 encoding can be either bytes or a string.
2022-11-02 20:33:46 +01:00
Jan Bouwhuis b4ad03784f
Improve MQTT type hints part 1 (#80523)
* Improve typing alarm_control_panel

* Improve typing binary_sensor

* Improve typing button

* Add misssed annotation

* Move CONF_EXPIRE_AFTER to _setup_from_config

* Use CALL_BACK type

* Remove assert, improve code style
2022-11-02 20:33:18 +01:00
epenet 9afabc17ae
Use attr in mqtt sensor (#81402) 2022-11-02 19:50:11 +01:00
epenet 442c5ccc06
Use attr in mqtt fan (#81401)
* Use attr in mqtt fan

* Fix is_on
2022-11-02 16:25:18 +01:00
epenet a255546e9d
Use attr in mqtt binary sensor and switch (#81403) 2022-11-02 13:41:14 +01:00
epenet 7a930d7e79
Use attr in mqtt humidifier (#81400) 2022-11-02 13:39:36 +01:00
epenet dd4b843d47
Use attr in mqtt number (#81399) 2022-11-02 13:39:21 +01:00
Jan Bouwhuis db0785827f
Revert "Do not write state if payload is `''`" for MQTT sensor (#81347)
* Revert "Do not write state if payload is ''"

This reverts commit 869c11884e.

* Add test
2022-11-01 16:25:01 +01:00
Maciej Bieniek 509d5fd69d
Lower log level for non-JSON payload in MQTT update (#81348)
Change log level
2022-11-01 15:57:48 +01:00
GitHub Action 0bca9a614c [ci skip] Translation update 2022-11-01 00:33:48 +00:00
GitHub Action 1c7800c224 [ci skip] Translation update 2022-10-30 00:32:36 +00:00
Jan Bouwhuis 591d13bc49
Move MQTT CONF_SCHEMA from light and vacuum to .const (#81152)
Move CONF_SCHEMA to .const
2022-10-29 10:22:59 +02:00
GitHub Action 4b5de420ed [ci skip] Translation update 2022-10-29 00:24:41 +00:00
Jan Bouwhuis bcae6d604e
Improve MQTT type hints part 8 (#81034)
* Improve typing device_tracker discovery

* Improve typing device_tracker yaml

* Add test source_type attribute

* Follow up comment

* Initialize at `__init__` not at class level.

* Use full name for return variable

* Correct import, remove assert

* Use AsyncSeeCallback
2022-10-28 18:20:33 +02:00
Maciej Bieniek 11ea834cbe
Improve MQTT update platform (#81131)
* Allow JSON as state_topic payload

* Add title

* Add release_url

* Add release_summary

* Add entity_picture

* Fix typo

* Add abbreviations
2022-10-28 17:05:43 +02:00
Jan Bouwhuis f10f74a65a
Add default `source_type` for MQTT device_tracker (#81128)
Make sure the source_type is set - default to gps
2022-10-28 10:49:01 +02:00
GitHub Action f399385147 [ci skip] Translation update 2022-10-28 00:30:47 +00:00
Jan Bouwhuis 4da3fb5baa
Correct Import of ReceivePayloadType (#81035) 2022-10-26 20:26:05 +02:00
Jan Bouwhuis 2d9f39d406
Strict typing for shared MQTT modules (#80913)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-10-26 13:52:34 +02:00
GitHub Action d0ff6582e6 [ci skip] Translation update 2022-10-26 00:29:57 +00:00
GitHub Action 9b331abe91 [ci skip] Translation update 2022-10-25 00:39:01 +00:00
Jan Bouwhuis 2f11385627
Add typing hints for MQTT mixins (#80702)
* Add typing hints for MQTT mixins

* Follow up comments

* config_entry is always set

* typing discovery_data - substate None assignment

* Rename `config[CONF_DEVICE]` -> specifications
2022-10-24 15:00:37 +02:00
Maciej Bieniek 1f0cb73ad0
Add `update` platform to MQTT integration (#80659) 2022-10-24 11:47:45 +02:00
Jan Bouwhuis 5e7f571f01
Move advanced MQTT options to entry (#79351)
* Move advanced broker settings to entry

* Add repair issue for deprecated settings

* Split CONFIG_SCHEMA

* Do not store certificate UI flags in entry

* Keep entered password in next dialog

* Do not process yaml config in flow

* Correct typo
2022-10-24 09:58:23 +02:00
Jan Bouwhuis 5f27e2fe01
Improve typing hints MQTT __init__ (#80674)
* Improve typing __init__

* Follow up suggestions
2022-10-21 12:25:21 +02:00
epenet 2c43606922
Add websocket type hints in components (#80654)
* Add websocket type hints in components

* Adjust

* Apply suggestion

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-10-20 13:41:14 +02:00
Jan Bouwhuis cce4485fb7
Add missed write state request for MQTT cover (#80540)
Missed write state request for MQTT cover
2022-10-20 11:22:30 +02:00
epenet 60640b4436
Add websocket type hints in components (#80533) 2022-10-18 22:15:23 -04:00
GitHub Action 3c48ce9ee7 [ci skip] Translation update 2022-10-16 00:44:12 +00:00
Jan Bouwhuis 65187ab227
Use selectors for basic broker and options for MQTT config flow (#79791)
Use selectors for basic broker en options
2022-10-11 10:51:35 +02:00
Jan Bouwhuis 8aa30cce26
Fix state saving when sharing topics for MQTT entities (#79421)
* Do not write old state sharing availability topic

* Add a test

* Support for all availability topics

* delay async_write_ha_state till last callback

* Process write req after processing callback jobs

* Do not count subscription callbacks

* Simplify

* Stale docsting

* No topic needed for delays state write

* No need to clear when reloading

* Move test to test_mixins.py

* Only set up sensor platform for test
2022-10-11 10:49:54 +02:00
Marc Mueller 4e5b5dfb93
Update pyupgrade to 3.1.0 (#80058)
* Update pyupgrade to 3.1.0

* Remove redundant open modes - text is the default
2022-10-11 09:04:52 +02:00
Jan Bouwhuis 6eb2c96d32
Correct use of ConfigType in MQTT config flow code (#79934)
Correct use of ConfigType
2022-10-09 14:41:30 +02:00
Bert Melis 6546bba233
Process abbreviated availability options in mqtt discovery payload (#79712)
Expand availability in mqtt discovery payload
2022-10-08 15:36:49 +02:00
Jan Bouwhuis aee82e2b3b
De-duplicate MQTT config_flow code (#79369)
* De-duplicate config_flow code

* De duplicate code birth and will
2022-10-07 10:12:19 +02:00
Jan Bouwhuis 9c9c8b324a
Ignore an '' value_template result for MQTT sensor (#79417)
Do not write state if payload is ''
2022-10-01 19:00:54 +03:00
Jan Bouwhuis 84b2c74746
Move MQTT discovery hass.data globals to dataclass (#78706)
* Add MQTT discovery hass.data globals to dataclass

* isort

* Additional rework

* Add hass.data["mqtt_tags"] to dataclass

* Follow-up comment

* Corrections
2022-09-28 14:13:44 +02:00
Jan Bouwhuis c5a58c8501
Fix MQTT setup after changing config entry flow options (#79103)
Fix issues with config flow options
2022-09-27 08:05:28 +02:00
Jan Bouwhuis 7216d4c636
Add debug logging for MQTT templates (#79016) 2022-09-27 00:36:10 +02:00
Jan Bouwhuis bdcece4904
Fix MQTT device_tracker generating unique id-s - regression on #78547 (#79033) 2022-09-24 22:03:03 -04:00
Jan Bouwhuis 81514b0d1c
Move MQTT debug_info to dataclass (#78788)
* Add MQTT debug_info to dataclass

* Remove total attr, assign factory

* Rename typed dict to MqttDebugInfo and use helper

* Split entity and trigger debug info

* Refactor

* More rework
2022-09-23 20:55:29 +02:00
epenet e58531f118
Add MqttData helper to mqtt (#78825)
* Add MqttData helper to mqtt

* Adjust client for circular dependencies

* Move MqttData to models.py

* Move get_mqtt_data to util.py
2022-09-20 19:40:06 +02:00
Jan Bouwhuis 354411feed
Link manually added MQTT entities the the MQTT config entry (#78547)
Co-authored-by: Erik <erik@montnemery.com>
2022-09-18 12:55:31 -04:00
GitHub Action e9eb5dc338 [ci skip] Translation update 2022-09-18 00:29:50 +00:00
Jan Bouwhuis 1f410e884a
Make hass.data["mqtt"] an instance of a DataClass (#77972)
* Use dataclass to reference hass.data globals

* Add discovery_registry_hooks to dataclass

* Move discovery registry hooks to dataclass

* Add device triggers to dataclass

* Cleanup DEVICE_TRIGGERS const

* Add last_discovery to data_class

* Simplify typing for class `Subscription`

* Follow up on comment

* Redo suggested typing change to sasisfy mypy

* Restore typing

* Add mypy version to CI check logging

* revert changes to ci.yaml

* Add docstr for protocol

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Mypy update after merging #78399

* Remove mypy ignore

* Correct return type

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-09-17 21:43:42 +02:00
GitHub Action ec258410c5 [ci skip] Translation update 2022-09-16 00:29:29 +00:00
Erik Montnemery 8a55f85703
Improve MQTT debug log of retained messages (#78453)
Improve MQTT debug log for retained messages
2022-09-14 20:45:46 +02:00
GitHub Action 955f3b7083 [ci skip] Translation update 2022-09-13 00:29:19 +00:00
GitHub Action 051974304a [ci skip] Translation update 2022-09-11 00:27:01 +00:00
epenet 6affd9c6fb
Import climate constants from root [m-z] (#78178) 2022-09-10 23:42:28 +02:00
Jan Bouwhuis fb67123d77
Clear MQTT discovery topic when a disabled entity is removed (#77757)
* Cleanup discovery on entity removal

* Add test

* Cleanup and test

* Test with clearing payload not unique id

* Address comments

* Tests cover and typing

* Just pass hass

* reuse code

* Follow up comments revert changes to cover tests

* Add test unique_id has priority over disabled

* Update homeassistant/components/mqtt/__init__.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-09-09 15:24:26 +02:00
Jan Bouwhuis d53d59eb6c
Improve warning messages on invalid received modes (#77909) 2022-09-09 11:12:09 +02:00
GitHub Action 718d4ac6cc [ci skip] Translation update 2022-09-09 00:28:55 +00:00
epenet ff356205bf
Use platform constants from root (#78032) 2022-09-08 12:24:45 +02:00
Erik Montnemery b21f8c9ea8
Remove use of deprecated SUPPORT_* constants from MQTT light (#77828)
* Remove use of deprecated SUPPORT_* constants from MQTT light

* Refactor
2022-09-08 11:21:46 +02:00
epenet f62fbbe524
Use _attr_force_update in mqtt (#77902) 2022-09-07 23:42:16 +02:00
GitHub Action 4f7ad27b65 [ci skip] Translation update 2022-09-07 00:27:56 +00:00
epenet 6355e682fa
Improve entity type hints [m] (#77816) 2022-09-05 10:59:36 +02:00
GitHub Action 6921583410 [ci skip] Translation update 2022-09-04 00:28:06 +00:00
Jan Bouwhuis 2e34814d7a
Fix reload of MQTT config entries (#76089)
* Wait for unsubscribes

* Spelling comment

* Remove notify_all() during _register_mid()

* Update homeassistant/components/mqtt/client.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Correct handling reload manual set up MQTT items

* Save and restore device trigger subscriptions

* Clarify we are storing all remaining subscriptions

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-09-02 18:54:20 +02:00
GitHub Action ccef03f1d4 [ci skip] Translation update 2022-09-02 00:25:46 +00:00
Erik Montnemery 14717951c3
Support configuring the mode of MQTT number entities (#77478)
* Support configuring the mode of MQTT number entities

* Use modern schema for tests

Co-authored-by: jbouwh <jan@jbsoft.nl>
2022-08-30 12:47:35 +02:00
GitHub Action 035cd16a95 [ci skip] Translation update 2022-08-30 00:30:17 +00:00
GitHub Action 7f1a203721 [ci skip] Translation update 2022-08-28 00:29:27 +00:00
GitHub Action c916fcb2c6 [ci skip] Translation update 2022-08-27 00:24:30 +00:00