Commit Graph

1340 Commits (803d24ad1a5adbbe69dc0a04fc39eb7e2c014c7f)

Author SHA1 Message Date
Jan Bouwhuis edb28be964
Avoid redundant calls to async_write_ha_state in mqtt device_tracker (#100767)
Avoid redundant calls to async_ha_write_state
2023-09-24 12:52:13 +02:00
Jan Bouwhuis 14b39c3bcf
Correct some typo's in MQTT issue string (#100759) 2023-09-23 19:05:52 +02:00
Jan Bouwhuis c6d62faff3
Avoid redundant calls to async_write_ha_state in mqtt cover (#100720)
Avoid redundant calls to async_write_ha_state
2023-09-22 22:47:07 +02:00
Jan Bouwhuis 4c65c92fb0
Use shorthand attrs for MQTT cover (#100710)
* User shorthand attrs for MQTT cover

* Cleanup constructor

* Cleanup constructor
2023-09-22 13:41:31 +02:00
Jan Bouwhuis 5b422daf36
Avoid redundant calls to `async_write_ha_state` in MQTT light (#100690)
* Limit state writes for mqtt light

* Additional tests and review follow up
2023-09-22 13:32:30 +02:00
Jan Bouwhuis 87ae5add8a
Fix mqtt light rgbww update without state topic (#100707)
* Fix mqtt light rgbww update without state topic

* Add @callback decprator and correct mired conv
2023-09-22 13:31:29 +02:00
Jan Bouwhuis a66ad39c4e
Assign color_mode for mqtt light as ColorMode (#100709) 2023-09-22 12:09:37 +02:00
Jan Bouwhuis 384adb1c87
Avoid redundant calls to `async_write_ha_state` in MQTT climate & water_heater (#100696)
Limit state writes for mqtt climate & water_heater
2023-09-22 11:22:57 +02:00
Jan Bouwhuis 1041610a70
Avoid redundant calls to `async_write_ha_state` in MQTT mqtt alarm_control_panel (#100691)
Limit state writes for mqtt alarm_control_panel
2023-09-22 11:22:09 +02:00
Jan Bouwhuis aed3ba3acd
Avoid redundant calls to `async_ha_write_state` in MQTT (binary) sensor (#100438)
* Only call `async_ha_write_state` on changes.

* Make helper class

* Use UndefinedType

* Remove del

* Integrate monitor into MqttEntity

* Track extra state attributes and availability

* Add `__slots__`

* Add monitor to MqttAttributes and MqttAvailability

* Write out loop

* Add test

* Make common test and parameterize

* Add test for last_reset attribute

* MqttMonitorEntity base class

* Rename attr and update docstr `track` method.

* correction doct

* Implement as a decorator

* Move tracking functions into decorator

* Rename decorator

* Follow up comment
2023-09-21 13:33:26 +02:00
Jan Bouwhuis e3837cd1e0
Use shorthand attr for mqtt assumed_state (#100241) 2023-09-12 22:21:13 +02:00
Jan Bouwhuis eb0ab3de93
User shorthand attr for mqtt alarm_control_panel (#100234) 2023-09-12 21:28:29 +02:00
Jan Bouwhuis 5fcb69e004
Use shorthanded attributes for MQTT cover (#100230) 2023-09-12 13:46:43 -05:00
Jan Bouwhuis 6b265120b3
Fix entity name attribute on mqtt entity is not removed on update (#100187)
Fix entity name attribute is not remove on update
2023-09-12 15:22:37 +02:00
Jan Bouwhuis 20d0ebe3fa
Add TYPE_CHECKING condition on type assertions for mqtt (#100107)
Add TYPE_CHECKING condition on type assertions
2023-09-11 10:58:33 +02:00
Jan Bouwhuis 1a5f093397
Uer hass.loop.create_future() for MQTT client (#100053) 2023-09-10 17:15:46 +02:00
Jan Bouwhuis 677431ed71
Fix key error MQTT binary_sensor when no name is set (#99943)
Log entitty ID when instead of name
2023-09-08 19:10:17 +02:00
J. Nick Koston 6e743a5bb2
Switch mqtt to use async_call_later where possible (#99486) 2023-09-02 11:55:11 -05:00
J. Nick Koston 7c87b38a23
Reduce overhead to process and publish MQTT messages (#99457) 2023-09-01 15:41:34 -05:00
J. Nick Koston 5a8fc43212
Refactor MQTT discovery to avoid creating closure if hash already in discovery_pending_discovered (#99458) 2023-09-01 15:40:53 -05:00
J. Nick Koston 09f45660cf
Avoid linear search of MQTT SUPPORTED_COMPONENTS (#99459)
By making this a set we avoid the linear search in async_discovery_message_received
2023-09-01 20:10:47 +02:00
Ville Skyttä c287bd1a3b
Remove pylint configs flagged by useless-suppression (#99081) 2023-08-26 17:46:03 +03:00
Jan Bouwhuis 49897341ba
Add lawn_mower platform to MQTT (#98831)
* Add MQTT lawn_mower platform

* Use separate command topics and templates

* Remove unrelated change
2023-08-25 17:56:22 +02:00
Jan Bouwhuis 948b34b045
Do not force update mqtt device_tracker (#98838) 2023-08-24 20:09:14 +02:00
Jan Bouwhuis 8b232047c4
Add origin info support for MQTT discovered items (#98782)
* Add integration info support for MQTT discovery.

* Moving logs to discovery

* Revert adding class property

* Rename to origin

* Follow up comments
2023-08-24 09:50:39 +02:00
Ville Skyttä 34b47a2597
Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
Jan Bouwhuis 0f58007e97
Deprecate aux heat for mqtt climate (#98666) 2023-08-22 22:39:55 +02:00
Franck Nijhof c39fc0766e
Remove repair issue for MQTT discovered items (#98768) 2023-08-21 20:03:19 +02:00
Ville Skyttä 3094991236
Upgrade ruff to 0.0.285 (#98647) 2023-08-19 08:17:17 -04:00
Jan Bouwhuis 5ef6c03610
Log entity_id payload and template on MQTT value template error (#98353)
* Log entity_id payload and template on error

* Also handle cases with default values.

* Do not log payload twice

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

* Tweak test to assert without payload

* black

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-08-18 13:05:53 +02:00
Faidon Liambotis 9fdad592c2
Add option to disable MQTT Alarm Control Panel supported features (#98363)
* Make MQTT Alarm Control Panel features conditional

The MQTT Alarm Control Panel currently enables all features (arm home,
arm away, arm night, arm vacation, arm custom bypass) unconditionally.
This clutters the interface and can even be potentially dangerous, by
enabling modes that the remote alarm may not support.

Make all the features conditional, by adding a new "supported_features"
configuration option, comprising a list of the supported features as
options. Feature enablement seems inconsistent across the MQTT
component; this implementation is most alike to the Humidifier modes
option, but using a generic "supported_features" name that other
implementations may reuse in the future.

The default value of this new setting remains to be all features, which
while it may be overly expansive, is necessary to maintain backwards
compatibility.

* Apply suggestions from code review

* Use vol.Optional() instead of vol.Required() for "supported_features".
* Move the initialization of _attr_supported_features to _setup_from_config.

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

* Apply suggestions from emontnemery's code review

* Use vol.In() instead of cv.multi_seelct()
* Remove superfluous _attr_supported_features initializers, already
  present in the base class.

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

* Add invalid config tests for the MQTT Alarm Control Panel

* Set expected_features to None in the invalid MQTT Alarm Control Panel tests

* Add another expected_features=None in the invalid tests

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

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-08-18 08:23:48 +02:00
Marc Mueller a9ade1f84d
Use asyncio.timeout [core] (#98447) 2023-08-15 08:36:05 -05:00
Erik Montnemery 045c327928
Move DeviceInfo from entity to device registry (#98149)
* Move DeviceInfo from entity to device registry

* Update integrations
2023-08-10 22:04:26 -04:00
Franck Nijhof 868a5f377f
Ruff: isort don't split imports based on trailing comma (#98162) 2023-08-10 14:27:03 +02:00
Jan Bouwhuis 5c9bce9eac
Allow float for inital MQTT climate temperature (#97995)
* Allow float for inital MQTT climate temperature

* Update tests/components/mqtt/test_climate.py

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

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-08-08 23:44:49 +02:00
Jason Cook 32c1ffcde1
Update strings.json to correct grammer. (#97790)
Change of to off.
2023-08-04 21:23:33 +02:00
Jan Bouwhuis 9c6c391eea
Offer work- a-round for MQTT entity names that start with the device name (#97495)
Co-authored-by: SukramJ <sukramj@icloud.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-08-01 10:03:08 +02:00
Jan Bouwhuis 3fcfe7d0c6
Set mqtt entity name to `null` when it is a duplicate of the device name (#97304) 2023-07-27 09:23:23 +02:00
Jan Bouwhuis fb00cd8963
Add turn on/off support for mqtt water_heater (#97197) 2023-07-25 13:33:02 +02:00
Marc Mueller c0da6b822e
Fix ruff (#97131) 2023-07-24 10:34:16 +02:00
Marc Mueller 3371c41bda
Improve `async_track_device_registry_updated_event` callback typing (#97125) 2023-07-24 09:42:01 +02:00
Marc Mueller 0624345322
Improve `async_track_entity_registry_updated_event` callback typing (#97124) 2023-07-24 09:14:10 +02:00
Franck Nijhof 30058297cf
Migrate backported StrEnum to built-in StrEnum (#97101) 2023-07-23 23:19:24 +02:00
Jan Bouwhuis 1b8e03bb66
Add MQTT event entity platform (#96876)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2023-07-23 14:42:14 +02:00
Jan Bouwhuis 9424d11408
Allow homeassistant in MQTT configuration_url schema (#96107) 2023-07-22 22:50:58 +02:00
Jan Bouwhuis 9a5774a95d
Apply common entity schema for MQTT Scene (#96949) 2023-07-22 18:00:27 +02:00
Jan Bouwhuis 447fbf58c9
Change naming of MQTT entities to correspond with HA guidelines (#95159)
* Set has_entity_name if device_name is set

* revert unneeded formatting change

* Add image platform

* Follow up comment

* Don't set `has_entity_name` without device name

* Only set has_entity_name if a valid name is set

* Follow device_class name and add tests

* Follow up comments add extra tests

* Move to helper - Log a warning

* fix test

* Allow to assign None as name explictly

* Refactor

* Log info messages when device name is not set

* Revert scene schema change - no device link

* Always set has_entity_name with device mapping

* Always set `_attr_has_entity_name`

* Cleanup
2023-07-21 12:52:10 +02:00
Jan Bouwhuis b504665b56
Do not override extra_state_attributes property for MqttEntity (#96890) 2023-07-21 06:35:58 +02:00
Jan Bouwhuis 7c22225cd1
Allow ADR 0007 compliant schema for mqtt (#94305)
* Enforce listed entities in MQTT yaml config

* Add tests for setup with listed items

* Fix test

* Remove validator add comment

* Update homeassistant/components/mqtt/__init__.py

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

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-07-18 14:29:45 +02:00
Jan Bouwhuis 0134ee9305
Fix incorrect leagacy code tweak for MQTT (#96812)
Cleanup mqtt_data_updated_config
2023-07-18 10:50:34 +02:00