Commit Graph

51 Commits (a9728bd3a5bb7e97923cbf24410d75bad5d6853c)

Author SHA1 Message Date
Franck Nijhof 800b8abe39
Code styling tweaks to the MQTT integration (#85463) 2023-01-08 22:07:10 +01:00
Jan Bouwhuis ee21bc5d7f
Allow MQTT device_class or state_class to be set as `None` (#85106)
* Allow MQTT device_class to be set as `None`

* Add test

* Also allow sensor state_class to be `None`
2023-01-04 15:21:07 +01:00
Jan Bouwhuis 9cf86b234b
Add optimistic option for MQTT climate (#84777) 2023-01-02 11:39:42 +01:00
Jonathan de Jong b67009dee3
Allow MQTT device trackers to be able to the reset the location name for auto zone inference (#83952)
* adds auto-zone to mqtt device trackers

* black formatting

* abbr

* change abbreviation

* add test

* fade to black

* Modify custom overrides

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* add custom + abbr payload and fix test docstrings

* change auto_zone to reset

* change RST to None, address isort

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2022-12-20 17:38:40 +01:00
Jan Bouwhuis 4335b0db25
Clean up or correct from removed deprecation for MQTT platform (#82684)
Clean up or correct from removed deprecation
2022-11-25 16:11:22 +01:00
Jan Bouwhuis 7c2e7863d2
Remove legacy YAML support from MQTT (#82102) 2022-11-17 22:55:31 +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
epenet dd4b843d47
Use attr in mqtt number (#81399) 2022-11-02 13:39:21 +01: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
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
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
epenet c8f11d65d2
Improve type hints in demo and mqtt number entity (#76464) 2022-08-11 00:10:28 +02:00
Jan Bouwhuis 5930f056a8
Mqtt support config_entry unload (#70149)
* squashed commits for rebase

* Flake

* Fix reloading issue manual legacy items

* Improve ACS sync for unsubscribe at disconnect

* Processed review comments

* Update homeassistant/components/mqtt/client.py

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

* No need to await entry setup

* Remove complication is_connected

* Update homeassistant/components/mqtt/__init__.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-07-12 11:07:18 +02:00
epenet 64bfa20f6a
Improve type hints in mqtt (#74295) 2022-07-02 20:15:54 +03:00
Erik Montnemery f05b4a0ca0
Fire event_mqtt_reloaded only after reload is completed (#74226) 2022-06-30 10:15:25 -07:00
Jan Bouwhuis 57daeaa174
Fix MQTT config schema to ensure correct validation (#73619)
* Ensure config schema validation

* Use correct schema for device_tracker

* Remove schema validation from the platform setup

* Remove loop to build schema
2022-06-20 08:51:12 +02:00
Erik Montnemery dea8041461
Add device_class to MQTT number and migrate to native_value (#73534) 2022-06-16 13:34:54 +02:00
Erik Montnemery b97d346df7
Fix reload of MQTT yaml config (#72901) 2022-06-02 11:32:31 -07:00
Erik Montnemery 635d7085cf
Move MQTT config schemas and client to separate modules (#71995)
* Move MQTT config schemas and client to separate modules

* Update integrations depending on MQTT
2022-05-31 09:32:44 +02:00
Jan Bouwhuis 623abb1147
Move manual configuration of MQTT number to the integration key (#72272)
Add number
2022-05-23 08:03:09 +02:00
Erik Montnemery fe38e6ba87
Drop MQTT import flow (#66160)
* Drop MQTT import flow

* Reload manually configured MQTT entities when config entry is setup

* Address review comments

* Actually remove the import flow
2022-02-10 21:09:57 +01:00
Erik Montnemery 8245ff7473
Log transmitted MQTT messages (#65550) 2022-02-04 17:35:32 +01:00
Erik Montnemery f3a89de71f
Fix race when handling updated MQTT discovery data (#65415) 2022-02-02 17:12:22 -08:00
Jan Bouwhuis 7ea8d72133
Move CONF_COMMAND_TEMPLATE to .const (#64558) 2022-01-20 16:15:26 +01:00
Jan Bouwhuis dd0193052c
Add MQTT encoding parameter for all subscribed topics (#62263)
* Add encoding parameter for all subscribable topics

* test setup encoding incoming payload

* remove support for device_tracker and tag+tests
2022-01-03 16:08:07 +01:00
Jan Bouwhuis 3ca18922e6
Mqtt rework on value templates (#62105)
* add MqttValueTemplate class

* support variables at initiation

* pass MqttEntity instead of hass

* Use MqttValueTemplace class for value templates

* make hass en enitity parameters conditional

* remove unused property and remove None assignment

* rename self._attr_value_template
2022-01-03 16:07:40 +01:00
Jan Bouwhuis 457ce195dd
Add mqtt entity attributes command templates (#61937)
* Add entity variables to MqttCommandTemplate

* missing command template update

* make hass and entity conditional parameters

* Add encoding support for publishing

* Revert "Add encoding support for publishing"

This reverts commit b69b9c60ec.
2022-01-03 15:10:15 +01:00
Jan Bouwhuis d0c4f0fec4
Add mqtt encoding support for publishing (#62739)
* encoding support for mqtt publishing - todo tests

* signature allows None values for qos and retain

* common test for mqtt publishing encoding

* better test with command templates

* more tests

* fix tests alarm control panel+tests light basic

* tests light json and template

* add tests vacuum and fix tests light_template
2022-01-03 09:03:47 +01:00
epenet 2cc4d9846b
Add basic type hints to mqtt (#62875)
* Add basic type hints to mqtt

* Add hints to async_setup_platform

* Add type hint to async_setup_entry

* Fix pylint

* Set correct argument order in climate entity

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 08:53:52 +01:00
Jan Bouwhuis d5defa8995
Support publishing MQTT messages with raw bytes payloads (#61090)
* correctly publish mqtt ouput

* Additional tests

* Add template test with binary output

* render_outgoing_payload with command templates

* use MqttCommandTemplate helper class

* add tests command_template

* Additional tests

* support pass-through for MqttComandTemplate

* fix bugs

* unify workform always initiate with hass

* clean up

* remove not needed lines

* comment not adding value
2021-12-15 11:28:43 +01:00
Damien Duboeuf 67c2747027
Add MQTT object_id option (#58728)
* Add MQTT object_id option

* Add MQTT object_id option

* Add MQTT object_id option

* Add MQTT object_id option - Fix light and vacuum

* Add MQTT object_id option - Fix light and vacuum

* Add MQTT object_id option - Fix lock

* Add MQTT object_id option - Fix device

* Add MQTT object_id option - Fix device

* Update tests/components/mqtt/test_discovery.py

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

* Change deprecated method

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-11-08 14:02:18 +01:00
Jan Bouwhuis 0c4863198e
Add command_template to MQTT number platform (#58949) 2021-11-02 18:21:49 +01:00
Marc Mueller 887d04be60
Use assignment expressions 32 (#58716) 2021-10-30 16:30:13 +02:00
Erik Montnemery 0456a896e3
Avoid service call in MQTT async_publish function (#58441)
* Avoid service call in MQTT async_publish function

* Tweak

* Fix integrations + tests
2021-10-28 08:13:32 +02:00
Erik Montnemery 640a7fee9d
Allow extra keys in MQTT discovery messages (#58390)
* Allow extra keys in MQTT discovery messages

* Remove extra keys
2021-10-25 13:47:06 +02:00
Franck Nijhof 027e167d95
Add support for unit of measurement in MQTT number platform (#58343) 2021-10-25 09:44:43 +02:00
Jan Bouwhuis 879144b48d
MQTT rework constants (#57529)
* reference CONF_TOPIC to .const

* Organize common mqtt constants
2021-10-12 11:26:38 +02:00
Erik Montnemery 7223c59e79
Allow resetting an MQTT number (#57161)
* Allow resetting an MQTT number

* Add abbreviation
2021-10-07 13:54:34 +02:00
Erik Montnemery 71a0e474cc
Filter MQTT number JSON attributes (#52286) 2021-06-29 11:16:57 +02:00
Erik Montnemery e14480599b
Add value_template support to MQTT number (#52155) 2021-06-28 10:23:34 +02:00
Erik Montnemery 77de233679
Update MQTT number to treat received payload as UTF-8 (#52121)
* Update MQTT number to treat received payload as UTF-8

* Lint
2021-06-23 15:35:18 +02:00
Shay Levy 6e087039f4
Add min/max/step to MQTT number (#50869) 2021-05-21 18:35:27 +03:00
jan iversen 9410aefd0d
Integrations m*: Rename HomeAssistantType to HomeAssistant. (#49567) 2021-04-22 14:53:37 -07:00
Kristian Heljas 9e487eb260
Hoist mqtt name property and add icon support to MqttEntity (#47165)
* hoist common MqttEntity properties

* remove default name for MqttEntity

Default naming is sensible enough

* disable overriding common MqttEntity schema

* merge common MqttEntity schemas into MQTT_ENTITY_COMMON_SCHEMA
2021-03-11 13:42:13 +01:00
Erik Montnemery 959181a2e9
Make MQTT number respect retain setting (#47270) 2021-03-02 14:28:31 +01:00
tkdrob b85ecc0bd2
Use core constants for mqtt (#46389) 2021-02-11 13:38:33 +01:00
Erik Montnemery 248802efd5
Add MQTT base entity (#44971) 2021-01-09 17:46:53 +01:00
Erik Montnemery 6dd6d9b368
Deduplicate MQTT entity discovery code (#44970) 2021-01-09 14:37:33 +01:00
Erik Montnemery b85efd343f
Move MQTT entity helpers to separate file (#44838)
* Move MQTT entity helpers to separate file

* Fix imports

* Update MQTT number

* Review comments

* Fix formatting
2021-01-09 00:47:17 +01:00
Diogo Gomes e3c1281616
Add MQTT Number (non optimistic) (#44883)
* non optimistic

* test restored state

* ups

* review

* Ensure the entity is not in optimistic mode

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

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-01-08 23:43:14 +01:00