Browse Source

log (entities): log information about HA initiated actions

Some time ago all the logging was stripped from the higher levels
because it is usually the lower level device side that needs the
detailed debugging. But it is useful to be able to follow the
user's actions in the log when debugging, so add it back in for
HA initiated actions.
Jason Rumney 3 days ago
parent
commit
aa7bd570b4

+ 2 - 0
custom_components/tuya_local/alarm_control_panel.py

@@ -77,6 +77,7 @@ class TuyaLocalAlarmControlPanel(TuyaLocalEntity, AlarmControlPanelEntity):
         )
         )
 
 
     async def _alarm_send_command(self, cmd: str):
     async def _alarm_send_command(self, cmd: str):
+        _LOGGER.info("%s setting alarm state to %s", self._config.config_id, cmd)
         if cmd in self._alarm_state_dp.values(self._device):
         if cmd in self._alarm_state_dp.values(self._device):
             await self._alarm_state_dp.async_set_value(self._device, cmd)
             await self._alarm_state_dp.async_set_value(self._device, cmd)
         else:
         else:
@@ -106,6 +107,7 @@ class TuyaLocalAlarmControlPanel(TuyaLocalEntity, AlarmControlPanelEntity):
 
 
     async def async_alarm_trigger(self, code=None):
     async def async_alarm_trigger(self, code=None):
         if self._trigger_dp:
         if self._trigger_dp:
+            _LOGGER.info("%s triggering alarm", self._config.config_id)
             await self._trigger_dp.async_set_value(self._device, True)
             await self._trigger_dp.async_set_value(self._device, True)
         else:
         else:
             await self._alarm_send_command(AlarmControlPanelState.TRIGGERED)
             await self._alarm_send_command(AlarmControlPanelState.TRIGGERED)

+ 1 - 0
custom_components/tuya_local/button.py

@@ -57,4 +57,5 @@ class TuyaLocalButton(TuyaLocalEntity, ButtonEntity):
 
 
     async def async_press(self):
     async def async_press(self):
         """Press the button"""
         """Press the button"""
+        _LOGGER.info("%s pressing button", self._config._device.config)
         await self._button_dp.async_set_value(self._device, True)
         await self._button_dp.async_set_value(self._device, True)

+ 5 - 0
custom_components/tuya_local/camera.py

@@ -61,6 +61,7 @@ class TuyaLocalCamera(TuyaLocalEntity, CameraEntity):
 
 
     async def async_camera_image(self, width=None, height=None):
     async def async_camera_image(self, width=None, height=None):
         if self._snapshot_dp:
         if self._snapshot_dp:
+            _LOGGER.info("%s fetching snapshot", self._config.config_id)
             return self._snapshot_dp.decoded_value(self._device)
             return self._snapshot_dp.decoded_value(self._device)
 
 
     @property
     @property
@@ -73,22 +74,26 @@ class TuyaLocalCamera(TuyaLocalEntity, CameraEntity):
         """Turn off the camera"""
         """Turn off the camera"""
         if not self._switch_dp:
         if not self._switch_dp:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info("%s turning off camera", self._config.config_id)
         await self._switch_dp.async_set_value(self._device, False)
         await self._switch_dp.async_set_value(self._device, False)
 
 
     async def async_turn_on(self):
     async def async_turn_on(self):
         """Turn on the camera"""
         """Turn on the camera"""
         if not self._switch_dp:
         if not self._switch_dp:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info("%s turning on camera", self._config.config_id)
         await self._switch_dp.async_set_value(self._device, True)
         await self._switch_dp.async_set_value(self._device, True)
 
 
     async def async_enable_motion_detection(self):
     async def async_enable_motion_detection(self):
         """Enable motion detection on the camera"""
         """Enable motion detection on the camera"""
         if not self._motion_enable_dp:
         if not self._motion_enable_dp:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info("%s enabling motion detection", self._config.config_id)
         await self._motion_enable_dp.async_set_value(self._device, True)
         await self._motion_enable_dp.async_set_value(self._device, True)
 
 
     async def async_disable_motion_detection(self):
     async def async_disable_motion_detection(self):
         """Disable motion detection on the camera"""
         """Disable motion detection on the camera"""
         if not self._motion_enable_dp:
         if not self._motion_enable_dp:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info("%s disabling motion detection", self._config.config_id)
         await self._motion_enable_dp.async_set_value(self._device, False)
         await self._motion_enable_dp.async_set_value(self._device, False)

+ 48 - 0
custom_components/tuya_local/climate.py

@@ -245,14 +245,30 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
     async def async_set_temperature(self, **kwargs):
     async def async_set_temperature(self, **kwargs):
         """Set new target temperature."""
         """Set new target temperature."""
         if kwargs.get(ATTR_PRESET_MODE) is not None:
         if kwargs.get(ATTR_PRESET_MODE) is not None:
+            _LOGGER.info(
+                "%s setting temperature: setting preset mode to %s",
+                self._config.config_id,
+                kwargs.get(ATTR_PRESET_MODE),
+            )
             await self.async_set_preset_mode(kwargs.get(ATTR_PRESET_MODE))
             await self.async_set_preset_mode(kwargs.get(ATTR_PRESET_MODE))
         if kwargs.get(ATTR_TEMPERATURE) is not None:
         if kwargs.get(ATTR_TEMPERATURE) is not None:
+            _LOGGER.info(
+                "%s setting temperature to %s",
+                self._config.config_id,
+                kwargs.get(ATTR_TEMPERATURE),
+            )
             await self.async_set_target_temperature(
             await self.async_set_target_temperature(
                 kwargs.get(ATTR_TEMPERATURE),
                 kwargs.get(ATTR_TEMPERATURE),
             )
             )
         high = kwargs.get(ATTR_TARGET_TEMP_HIGH)
         high = kwargs.get(ATTR_TARGET_TEMP_HIGH)
         low = kwargs.get(ATTR_TARGET_TEMP_LOW)
         low = kwargs.get(ATTR_TARGET_TEMP_LOW)
         if high is not None or low is not None:
         if high is not None or low is not None:
+            _LOGGER.info(
+                "%s setting temperature range to %s - %s",
+                self._config.config_id,
+                low,
+                high,
+            )
             await self.async_set_target_temperature_range(low, high)
             await self.async_set_target_temperature_range(low, high)
 
 
     async def async_set_target_temperature(self, target_temperature):
     async def async_set_target_temperature(self, target_temperature):
@@ -317,6 +333,11 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         if self._humidity_dps is None:
         if self._humidity_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
 
 
+        _LOGGER.info(
+            "%s setting humidity to %s",
+            self._config.config_id,
+            humidity,
+        )
         await self._humidity_dps.async_set_value(self._device, humidity)
         await self._humidity_dps.async_set_value(self._device, humidity)
 
 
     @property
     @property
@@ -372,6 +393,11 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         """Set new HVAC mode."""
         """Set new HVAC mode."""
         if self._hvac_mode_dps is None:
         if self._hvac_mode_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info(
+            "%s setting HVAC mode to %s",
+            self._config.config_id,
+            hvac_mode,
+        )
         await self._hvac_mode_dps.async_set_value(self._device, hvac_mode)
         await self._hvac_mode_dps.async_set_value(self._device, hvac_mode)
 
 
     async def async_turn_on(self):
     async def async_turn_on(self):
@@ -379,6 +405,7 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         # Bypass the usual dps mapping to switch the power dp directly
         # Bypass the usual dps mapping to switch the power dp directly
         # this way the hvac_mode will be kept when toggling off and on.
         # this way the hvac_mode will be kept when toggling off and on.
         if self._hvac_mode_dps and self._hvac_mode_dps.type is bool:
         if self._hvac_mode_dps and self._hvac_mode_dps.type is bool:
+            _LOGGER.info("%s turning on", self._config.config_id)
             await self._device.async_set_property(self._hvac_mode_dps.id, True)
             await self._device.async_set_property(self._hvac_mode_dps.id, True)
         else:
         else:
             await super().async_turn_on()
             await super().async_turn_on()
@@ -388,6 +415,7 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         # Bypass the usual dps mapping to switch the power dp directly
         # Bypass the usual dps mapping to switch the power dp directly
         # this way the hvac_mode will be kept when toggling off and on.
         # this way the hvac_mode will be kept when toggling off and on.
         if self._hvac_mode_dps and self._hvac_mode_dps.type is bool:
         if self._hvac_mode_dps and self._hvac_mode_dps.type is bool:
+            _LOGGER.info("%s turning off", self._config.config_id)
             await self._device.async_set_property(
             await self._device.async_set_property(
                 self._hvac_mode_dps.id,
                 self._hvac_mode_dps.id,
                 False,
                 False,
@@ -412,6 +440,11 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         """Set the preset mode."""
         """Set the preset mode."""
         if self._preset_mode_dps is None:
         if self._preset_mode_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info(
+            "%s setting preset mode to %s",
+            self._config.config_id,
+            preset_mode,
+        )
         await self._preset_mode_dps.async_set_value(self._device, preset_mode)
         await self._preset_mode_dps.async_set_value(self._device, preset_mode)
 
 
     @property
     @property
@@ -431,6 +464,11 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         """Set the preset mode."""
         """Set the preset mode."""
         if self._swing_mode_dps is None:
         if self._swing_mode_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info(
+            "%s setting swing mode to %s",
+            self._config.config_id,
+            swing_mode,
+        )
         await self._swing_mode_dps.async_set_value(self._device, swing_mode)
         await self._swing_mode_dps.async_set_value(self._device, swing_mode)
 
 
     @property
     @property
@@ -450,6 +488,11 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         """Set the preset mode."""
         """Set the preset mode."""
         if self._swing_horizontal_mode_dps is None:
         if self._swing_horizontal_mode_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info(
+            "%s setting horizontal swing mode to %s",
+            self._config.config_id,
+            swing_mode,
+        )
         await self._swing_horizontal_mode_dps.async_set_value(
         await self._swing_horizontal_mode_dps.async_set_value(
             self._device,
             self._device,
             swing_mode,
             swing_mode,
@@ -472,4 +515,9 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         """Set the fan mode."""
         """Set the fan mode."""
         if self._fan_mode_dps is None:
         if self._fan_mode_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info(
+            "%s setting fan mode to %s",
+            self._config.config_id,
+            fan_mode,
+        )
         await self._fan_mode_dps.async_set_value(self._device, fan_mode)
         await self._fan_mode_dps.async_set_value(self._device, fan_mode)

+ 13 - 0
custom_components/tuya_local/cover.py

@@ -202,9 +202,11 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
     async def async_open_cover(self, **kwargs):
     async def async_open_cover(self, **kwargs):
         """Open the cover."""
         """Open the cover."""
         if self._control_dp and "open" in self._control_dp.values(self._device):
         if self._control_dp and "open" in self._control_dp.values(self._device):
+            _LOGGER.info("%s opening", self._config._config_id)
             await self._control_dp.async_set_value(self._device, "open")
             await self._control_dp.async_set_value(self._device, "open")
         elif self._position_dp:
         elif self._position_dp:
             pos = 100
             pos = 100
+            _LOGGER.info("%s opening to 100%%", self._config._config_id)
             await self._position_dp.async_set_value(self._device, pos)
             await self._position_dp.async_set_value(self._device, pos)
         else:
         else:
             raise NotImplementedError()
             raise NotImplementedError()
@@ -212,9 +214,11 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
     async def async_close_cover(self, **kwargs):
     async def async_close_cover(self, **kwargs):
         """Close the cover."""
         """Close the cover."""
         if self._control_dp and "close" in self._control_dp.values(self._device):
         if self._control_dp and "close" in self._control_dp.values(self._device):
+            _LOGGER.info("%s closing", self._config._config_id)
             await self._control_dp.async_set_value(self._device, "close")
             await self._control_dp.async_set_value(self._device, "close")
         elif self._position_dp:
         elif self._position_dp:
             pos = 0
             pos = 0
+            _LOGGER.info("%s closing to 0%%", self._config._config_id)
             await self._position_dp.async_set_value(self._device, pos)
             await self._position_dp.async_set_value(self._device, pos)
         else:
         else:
             raise NotImplementedError()
             raise NotImplementedError()
@@ -224,6 +228,9 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
         if position is None:
         if position is None:
             raise AttributeError()
             raise AttributeError()
         if self._position_dp:
         if self._position_dp:
+            _LOGGER.info(
+                "%s setting position to %d%%", self._config._config_id, position
+            )
             await self._position_dp.async_set_value(self._device, position)
             await self._position_dp.async_set_value(self._device, position)
         else:
         else:
             raise NotImplementedError()
             raise NotImplementedError()
@@ -241,6 +248,11 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
                 r = self._tiltpos_dp.range(self._device)
                 r = self._tiltpos_dp.range(self._device)
                 tilt_position = percentage_to_ranged_value(r, tilt_position)
                 tilt_position = percentage_to_ranged_value(r, tilt_position)
 
 
+            _LOGGER.info(
+                "%s setting tilt position to %d%%",
+                self._config._config_id,
+                tilt_position,
+            )
             await self._tiltpos_dp.async_set_value(self._device, tilt_position)
             await self._tiltpos_dp.async_set_value(self._device, tilt_position)
         else:
         else:
             raise NotImplementedError
             raise NotImplementedError
@@ -248,6 +260,7 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
     async def async_stop_cover(self, **kwargs):
     async def async_stop_cover(self, **kwargs):
         """Stop the cover."""
         """Stop the cover."""
         if self._control_dp and "stop" in self._control_dp.values(self._device):
         if self._control_dp and "stop" in self._control_dp.values(self._device):
+            _LOGGER.info("%s stopping", self._config._config_id)
             await self._control_dp.async_set_value(self._device, "stop")
             await self._control_dp.async_set_value(self._device, "stop")
         else:
         else:
             raise NotImplementedError()
             raise NotImplementedError()

+ 6 - 0
custom_components/tuya_local/datetime.py

@@ -115,11 +115,13 @@ class TuyaLocalDateTime(TuyaLocalEntity, DateTimeEntity):
         minute = value.minute
         minute = value.minute
         second = value.second
         second = value.second
         if self._year_dps:
         if self._year_dps:
+            _LOGGER.info("%s setting year to %d", self.name, year)
             settings.update(
             settings.update(
                 self._year_dps.get_values_to_set(self._device, year, settings)
                 self._year_dps.get_values_to_set(self._device, year, settings)
             )
             )
             month = month + (year - 1970) * 12
             month = month + (year - 1970) * 12
         if self._month_dps:
         if self._month_dps:
+            _LOGGER.info("%s setting month to %d", self.name, month)
             settings.update(
             settings.update(
                 self._month_dps.get_values_to_set(self._device, month, settings)
                 self._month_dps.get_values_to_set(self._device, month, settings)
             )
             )
@@ -136,12 +138,14 @@ class TuyaLocalDateTime(TuyaLocalEntity, DateTimeEntity):
                 - 1
                 - 1
             )
             )
         if self._day_dps:
         if self._day_dps:
+            _LOGGER.info("%s setting day to %d", self.name, day)
             settings.update(
             settings.update(
                 self._day_dps.get_values_to_set(self._device, day, settings)
                 self._day_dps.get_values_to_set(self._device, day, settings)
             )
             )
         else:
         else:
             hour = hour + day * 24
             hour = hour + day * 24
         if self._hour_dps:
         if self._hour_dps:
+            _LOGGER.info("%s setting hour to %d", self.name, hour)
             settings.update(
             settings.update(
                 self._hour_dps.get_values_to_set(self._device, hour, settings)
                 self._hour_dps.get_values_to_set(self._device, hour, settings)
             )
             )
@@ -149,6 +153,7 @@ class TuyaLocalDateTime(TuyaLocalEntity, DateTimeEntity):
             minute = minute + hour * 60
             minute = minute + hour * 60
 
 
         if self._minute_dps:
         if self._minute_dps:
+            _LOGGER.info("%s setting minute to %d", self.name, minute)
             settings.update(
             settings.update(
                 self._minute_dps.get_values_to_set(self._device, minute, settings)
                 self._minute_dps.get_values_to_set(self._device, minute, settings)
             )
             )
@@ -156,6 +161,7 @@ class TuyaLocalDateTime(TuyaLocalEntity, DateTimeEntity):
             second = second + minute * 60
             second = second + minute * 60
 
 
         if self._second_dps:
         if self._second_dps:
+            _LOGGER.info("%s setting second to %d", self.name, second)
             settings.update(
             settings.update(
                 self._second_dps.get_values_to_set(self._device, second, settings)
                 self._second_dps.get_values_to_set(self._device, second, settings)
             )
             )

+ 1 - 0
custom_components/tuya_local/entity.py

@@ -120,6 +120,7 @@ class TuyaLocalEntity:
             _LOGGER.warning(self._config.deprecation_message)
             _LOGGER.warning(self._config.deprecation_message)
 
 
     async def async_will_remove_from_hass(self):
     async def async_will_remove_from_hass(self):
+        _LOGGER.debug("Removing %s for %s", self._config.config_id, self._device.name)
         await self._device.async_unregister_entity(self)
         await self._device.async_unregister_entity(self)
 
 
     def on_receive(self, dps, full_poll):
     def on_receive(self, dps, full_poll):

+ 15 - 1
custom_components/tuya_local/fan.py

@@ -90,6 +90,7 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
         """Turn the fan on, setting any other parameters given"""
         """Turn the fan on, setting any other parameters given"""
         settings = {}
         settings = {}
         if self._switch_dps:
         if self._switch_dps:
+            _LOGGER.info("%s turning on", self._config.config_id)
             settings = {
             settings = {
                 **settings,
                 **settings,
                 **self._switch_dps.get_values_to_set(self._device, True, settings),
                 **self._switch_dps.get_values_to_set(self._device, True, settings),
@@ -101,12 +102,17 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
                 if r[0] == 0:
                 if r[0] == 0:
                     r = (1, r[1])
                     r = (1, r[1])
                 percentage = percentage_to_ranged_value(r, percentage)
                 percentage = percentage_to_ranged_value(r, percentage)
-
+            _LOGGER.info(
+                "%s turning on to speed %s", self._config.config_id, percentage
+            )
             settings = {
             settings = {
                 **settings,
                 **settings,
                 **self._speed_dps.get_values_to_set(self._device, percentage, settings),
                 **self._speed_dps.get_values_to_set(self._device, percentage, settings),
             }
             }
         if preset_mode and self._preset_dps:
         if preset_mode and self._preset_dps:
+            _LOGGER.info(
+                "%s turning on to preset %s", self._config.config_id, preset_mode
+            )
             settings = {
             settings = {
                 **settings,
                 **settings,
                 **self._preset_dps.get_values_to_set(
                 **self._preset_dps.get_values_to_set(
@@ -120,12 +126,14 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
     async def async_turn_off(self, **kwargs):
     async def async_turn_off(self, **kwargs):
         """Turn the switch off"""
         """Turn the switch off"""
         if self._switch_dps:
         if self._switch_dps:
+            _LOGGER.info("%s turning off", self._config.config_id)
             await self._switch_dps.async_set_value(self._device, False)
             await self._switch_dps.async_set_value(self._device, False)
         elif (
         elif (
             self._speed_dps
             self._speed_dps
             and self._speed_dps.range(self._device)
             and self._speed_dps.range(self._device)
             and self._speed_dps.range(self._device)[0] == 0
             and self._speed_dps.range(self._device)[0] == 0
         ):
         ):
+            _LOGGER.info("%s turning off by setting speed to 0", self._config.config_id)
             await self._speed_dps.async_set_value(self._device, 0)
             await self._speed_dps.async_set_value(self._device, 0)
         else:
         else:
             raise NotImplementedError
             raise NotImplementedError
@@ -183,6 +191,7 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
                 r = (1, r[1])
                 r = (1, r[1])
             percentage = percentage_to_ranged_value(r, percentage)
             percentage = percentage_to_ranged_value(r, percentage)
 
 
+        _LOGGER.info("%s setting speed to %s", self._config.config_id, percentage)
         values_to_set = self._speed_dps.get_values_to_set(self._device, percentage)
         values_to_set = self._speed_dps.get_values_to_set(self._device, percentage)
         if not self.is_on and self._switch_dps:
         if not self.is_on and self._switch_dps:
             values_to_set.update(
             values_to_set.update(
@@ -208,6 +217,9 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
         """Set the preset mode."""
         """Set the preset mode."""
         if self._preset_dps is None:
         if self._preset_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info(
+            "%s setting preset mode to %s", self._config.config_id, preset_mode
+        )
         await self._preset_dps.async_set_value(self._device, preset_mode)
         await self._preset_dps.async_set_value(self._device, preset_mode)
 
 
     @property
     @property
@@ -220,6 +232,7 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
         """Set the direction of the fan."""
         """Set the direction of the fan."""
         if self._direction_dps is None:
         if self._direction_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info("%s setting direction to %s", self._config.config_id, direction)
         await self._direction_dps.async_set_value(self._device, direction)
         await self._direction_dps.async_set_value(self._device, direction)
 
 
     @property
     @property
@@ -232,4 +245,5 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
         """Oscillate the fan."""
         """Oscillate the fan."""
         if self._oscillate_dps is None:
         if self._oscillate_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info("%s setting oscillate to %s", self._config.config_id, oscillating)
         await self._oscillate_dps.async_set_value(self._device, oscillating)
         await self._oscillate_dps.async_set_value(self._device, oscillating)

+ 4 - 1
custom_components/tuya_local/humidifier.py

@@ -99,10 +99,12 @@ class TuyaLocalHumidifier(TuyaLocalEntity, HumidifierEntity):
 
 
     async def async_turn_on(self, **kwargs):
     async def async_turn_on(self, **kwargs):
         """Turn the switch on"""
         """Turn the switch on"""
+        _LOGGER.info("%s turning on", self._config.config_id)
         await self._switch_dp.async_set_value(self._device, True)
         await self._switch_dp.async_set_value(self._device, True)
 
 
     async def async_turn_off(self, **kwargs):
     async def async_turn_off(self, **kwargs):
         """Turn the switch off"""
         """Turn the switch off"""
+        _LOGGER.info("%s turning off", self._config.config_id)
         await self._switch_dp.async_set_value(self._device, False)
         await self._switch_dp.async_set_value(self._device, False)
 
 
     @property
     @property
@@ -137,7 +139,7 @@ class TuyaLocalHumidifier(TuyaLocalEntity, HumidifierEntity):
     async def async_set_humidity(self, humidity):
     async def async_set_humidity(self, humidity):
         if self._humidity_dp is None:
         if self._humidity_dp is None:
             raise NotImplementedError()
             raise NotImplementedError()
-
+        _LOGGER.info("%s setting humidity to %s", self._config.config_id, humidity)
         await self._humidity_dp.async_set_value(self._device, humidity)
         await self._humidity_dp.async_set_value(self._device, humidity)
 
 
     @property
     @property
@@ -157,4 +159,5 @@ class TuyaLocalHumidifier(TuyaLocalEntity, HumidifierEntity):
         """Set the preset mode."""
         """Set the preset mode."""
         if self._mode_dp is None:
         if self._mode_dp is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info("%s setting mode to %s", self._config.config_id, mode)
         await self._mode_dp.async_set_value(self._device, mode)
         await self._mode_dp.async_set_value(self._device, mode)

+ 3 - 0
custom_components/tuya_local/lawn_mower.py

@@ -61,14 +61,17 @@ class TuyaLocalLawnMower(TuyaLocalEntity, LawnMowerEntity):
     async def async_start_mowing(self) -> None:
     async def async_start_mowing(self) -> None:
         """Start mowing the lawn."""
         """Start mowing the lawn."""
         if self._command_dp:
         if self._command_dp:
+            _LOGGER.info("%s starting lawn mowing", self._config.config_id)
             await self._command_dp.async_set_value(self._device, SERVICE_START_MOWING)
             await self._command_dp.async_set_value(self._device, SERVICE_START_MOWING)
 
 
     async def async_pause(self):
     async def async_pause(self):
         """Pause lawn mowing."""
         """Pause lawn mowing."""
         if self._command_dp:
         if self._command_dp:
+            _LOGGER.info("%s pausing lawn mowing", self._config.config_id)
             await self._command_dp.async_set_value(self._device, SERVICE_PAUSE)
             await self._command_dp.async_set_value(self._device, SERVICE_PAUSE)
 
 
     async def async_dock(self):
     async def async_dock(self):
         """Stop mowing and return to dock."""
         """Stop mowing and return to dock."""
         if self._command_dp:
         if self._command_dp:
+            _LOGGER.info("%s returning to dock", self._config.config_id)
             await self._command_dp.async_set_value(self._device, SERVICE_DOCK)
             await self._command_dp.async_set_value(self._device, SERVICE_DOCK)

+ 40 - 15
custom_components/tuya_local/light.py

@@ -283,10 +283,6 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                 color_mode = ColorMode.WHITE
                 color_mode = ColorMode.WHITE
             if ATTR_BRIGHTNESS not in params and self._brightness_dps:
             if ATTR_BRIGHTNESS not in params and self._brightness_dps:
                 bright = params.get(ATTR_WHITE)
                 bright = params.get(ATTR_WHITE)
-                _LOGGER.debug(
-                    "Setting brightness via WHITE parameter to %d",
-                    bright,
-                )
                 r = self._brightness_dps.range(self._device)
                 r = self._brightness_dps.range(self._device)
                 if r:
                 if r:
                     # ensure full range is used
                     # ensure full range is used
@@ -295,6 +291,9 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                     else:
                     else:
                         bright = color_util.brightness_to_value(r, bright)
                         bright = color_util.brightness_to_value(r, bright)
 
 
+                _LOGGER.info(
+                    "%s setting white brightness to %d", self._config.config_id, bright
+                )
                 settings = {
                 settings = {
                     **settings,
                     **settings,
                     **self._brightness_dps.get_values_to_set(
                     **self._brightness_dps.get_values_to_set(
@@ -315,7 +314,9 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
             if color_temp > self.max_color_temp_kelvin:
             if color_temp > self.max_color_temp_kelvin:
                 color_temp = self.max_color_temp_kelvin
                 color_temp = self.max_color_temp_kelvin
 
 
-            _LOGGER.debug("Setting color temp to %d", color_temp)
+            _LOGGER.info(
+                "%s setting color temp to %d", self._config.config_id, color_temp
+            )
             settings = {
             settings = {
                 **settings,
                 **settings,
                 **self._color_temp_dps.get_values_to_set(
                 **self._color_temp_dps.get_values_to_set(
@@ -383,11 +384,13 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                     ordered.append(val)
                     ordered.append(val)
                     idx += 1
                     idx += 1
                 binary = pack(fmt["format"], *ordered)
                 binary = pack(fmt["format"], *ordered)
+                encoded = self._rgbhsv_dps.encode_value(binary)
+                _LOGGER.info("%s setting color to %s", self._config.config_id, encoded)
                 settings = {
                 settings = {
                     **settings,
                     **settings,
                     **self._rgbhsv_dps.get_values_to_set(
                     **self._rgbhsv_dps.get_values_to_set(
                         self._device,
                         self._device,
-                        self._rgbhsv_dps.encode_value(binary),
+                        encoded,
                         settings,
                         settings,
                     ),
                     ),
                 }
                 }
@@ -399,6 +402,9 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
             best_match = self.named_color_from_hsv(hs, brightness)
             best_match = self.named_color_from_hsv(hs, brightness)
             _LOGGER.debug("Setting color to %s", best_match)
             _LOGGER.debug("Setting color to %s", best_match)
             if best_match:
             if best_match:
+                _LOGGER.info(
+                    "%s setting named color to %s", self._config.config_id, best_match
+                )
                 settings = {
                 settings = {
                     **settings,
                     **settings,
                     **self._named_color_dps.get_values_to_set(
                     **self._named_color_dps.get_values_to_set(
@@ -409,7 +415,11 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                 }
                 }
         if self._color_mode_dps:
         if self._color_mode_dps:
             if color_mode:
             if color_mode:
-                _LOGGER.debug("Auto setting color mode to %s", color_mode)
+                _LOGGER.info(
+                    "%s auto setting color mode to %s",
+                    self._config.config_id,
+                    color_mode,
+                )
                 settings = {
                 settings = {
                     **settings,
                     **settings,
                     **self._color_mode_dps.get_values_to_set(
                     **self._color_mode_dps.get_values_to_set(
@@ -429,8 +439,9 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                             self._color_mode_dps.default
                             self._color_mode_dps.default
                             or self._color_mode_dps.values(self._device)[0]
                             or self._color_mode_dps.values(self._device)[0]
                         )
                         )
-                    _LOGGER.debug(
-                        "Emulating effect using color mode of %s",
+                    _LOGGER.info(
+                        "%s emulating effect using color mode of %s",
+                        self._config.config_id,
                         effect,
                         effect,
                     )
                     )
                     settings = {
                     settings = {
@@ -448,7 +459,6 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
             and self._brightness_dps
             and self._brightness_dps
         ):
         ):
             bright = params.get(ATTR_BRIGHTNESS)
             bright = params.get(ATTR_BRIGHTNESS)
-            _LOGGER.debug("Setting brightness to %s", bright)
 
 
             r = self._brightness_dps.range(self._device)
             r = self._brightness_dps.range(self._device)
             if r:
             if r:
@@ -458,6 +468,7 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                 else:
                 else:
                     bright = color_util.brightness_to_value(r, bright)
                     bright = color_util.brightness_to_value(r, bright)
 
 
+            _LOGGER.info("%s setting brightness to %d", self._config.config_id, bright)
             settings = {
             settings = {
                 **settings,
                 **settings,
                 **self._brightness_dps.get_values_to_set(
                 **self._brightness_dps.get_values_to_set(
@@ -470,7 +481,7 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
         if self._effect_dps:
         if self._effect_dps:
             effect = params.get(ATTR_EFFECT, None)
             effect = params.get(ATTR_EFFECT, None)
             if effect:
             if effect:
-                _LOGGER.debug("Setting effect to %s", effect)
+                _LOGGER.info("%s setting effect to %s", self._config.config_id, effect)
                 settings = {
                 settings = {
                     **settings,
                     **settings,
                     **self._effect_dps.get_values_to_set(
                     **self._effect_dps.get_values_to_set(
@@ -489,10 +500,14 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                 # Special case for motion sensor lights with readonly switch
                 # Special case for motion sensor lights with readonly switch
                 # that have tristate switch available as effect
                 # that have tristate switch available as effect
                 if self._effect_dps.id not in settings:
                 if self._effect_dps.id not in settings:
+                    _LOGGER.info(
+                        "%s turning light on using effect", self._config.config_id
+                    )
                     settings = settings | self._effect_dps.get_values_to_set(
                     settings = settings | self._effect_dps.get_values_to_set(
                         self._device, "on", settings
                         self._device, "on", settings
                     )
                     )
             else:
             else:
+                _LOGGER.info("%s turning light on", self._config.config_id)
                 settings = settings | self._switch_dps.get_values_to_set(
                 settings = settings | self._switch_dps.get_values_to_set(
                     self._device, True, settings
                     self._device, True, settings
                 )
                 )
@@ -501,7 +516,11 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
             r = self._brightness_dps.range(self._device)
             r = self._brightness_dps.range(self._device)
             if r:
             if r:
                 bright = color_util.brightness_to_value(r, bright)
                 bright = color_util.brightness_to_value(r, bright)
-
+            _LOGGER.info(
+                "%s turning light on to brightness %d",
+                self._config.config_id,
+                bright,
+            )
             settings = settings | self._brightness_dps.get_values_to_set(
             settings = settings | self._brightness_dps.get_values_to_set(
                 self._device, bright, settings
                 self._device, bright, settings
             )
             )
@@ -518,15 +537,21 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
             ):
             ):
                 # Special case for motion sensor lights with readonly switch
                 # Special case for motion sensor lights with readonly switch
                 # that have tristate switch available as effect
                 # that have tristate switch available as effect
+                _LOGGER.info(
+                    "%s turning light off using effect", self._config.config_id
+                )
                 await self._effect_dps.async_set_value(self._device, "off")
                 await self._effect_dps.async_set_value(self._device, "off")
             else:
             else:
+                _LOGGER.info("%s turning light off", self._config.config_id)
                 await self._switch_dps.async_set_value(self._device, False)
                 await self._switch_dps.async_set_value(self._device, False)
         elif self._brightness_dps:
         elif self._brightness_dps:
+            _LOGGER.info(
+                "%s turning light off by setting brightness to 0",
+                self._config.config_id,
+            )
             await self._brightness_dps.async_set_value(self._device, 0)
             await self._brightness_dps.async_set_value(self._device, 0)
         else:
         else:
             raise NotImplementedError()
             raise NotImplementedError()
 
 
     async def async_toggle(self):
     async def async_toggle(self):
-        disp_on = self.is_on
-
-        await (self.async_turn_on() if not disp_on else self.async_turn_off())
+        await (self.async_turn_off() if self.is_on else self.async_turn_on())

+ 7 - 0
custom_components/tuya_local/lock.py

@@ -178,6 +178,7 @@ class TuyaLocalLock(TuyaLocalEntity, LockEntity):
     async def async_lock(self, **kwargs):
     async def async_lock(self, **kwargs):
         """Lock the lock."""
         """Lock the lock."""
         if self._lock_dp and not self._lock_dp.readonly:
         if self._lock_dp and not self._lock_dp.readonly:
+            _LOGGER.info("%s locking", self._config.config_id)
             await self._lock_dp.async_set_value(self._device, True)
             await self._lock_dp.async_set_value(self._device, True)
         elif self._code_unlock_dp:
         elif self._code_unlock_dp:
             code = kwargs.get("code")
             code = kwargs.get("code")
@@ -186,6 +187,7 @@ class TuyaLocalLock(TuyaLocalEntity, LockEntity):
             msg = self.build_code_unlock_msg(
             msg = self.build_code_unlock_msg(
                 CODE_LOCK, member_id=1, code=code, source=CODE_SRC_UNKNOWN
                 CODE_LOCK, member_id=1, code=code, source=CODE_SRC_UNKNOWN
             )
             )
+            _LOGGER.info("%s locking with code", self._config.config_id)
             await self._code_unlock_dp.async_set_value(self._device, msg)
             await self._code_unlock_dp.async_set_value(self._device, msg)
         else:
         else:
             raise NotImplementedError()
             raise NotImplementedError()
@@ -199,18 +201,22 @@ class TuyaLocalLock(TuyaLocalEntity, LockEntity):
             msg = self.build_code_unlock_msg(
             msg = self.build_code_unlock_msg(
                 CODE_UNLOCK, member_id=1, code=code, source=CODE_SRC_UNKNOWN
                 CODE_UNLOCK, member_id=1, code=code, source=CODE_SRC_UNKNOWN
             )
             )
+            _LOGGER.info("%s unlocking with code", self._config.config_id)
             await self._code_unlock_dp.async_set_value(self._device, msg)
             await self._code_unlock_dp.async_set_value(self._device, msg)
         elif self._lock_dp and not self._lock_dp.readonly:
         elif self._lock_dp and not self._lock_dp.readonly:
+            _LOGGER.info("%s unlocking", self._config.config_id)
             await self._lock_dp.async_set_value(self._device, False)
             await self._lock_dp.async_set_value(self._device, False)
         elif self._approve_unlock_dp:
         elif self._approve_unlock_dp:
             if self._req_unlock_dp and not self._req_unlock_dp.get_value(self._device):
             if self._req_unlock_dp and not self._req_unlock_dp.get_value(self._device):
                 raise TimeoutError()
                 raise TimeoutError()
+            _LOGGER.info("%s approving unlock", self._config.config_id)
             await self._approve_unlock_dp.async_set_value(self._device, True)
             await self._approve_unlock_dp.async_set_value(self._device, True)
         elif self._approve_intercom_dp:
         elif self._approve_intercom_dp:
             if self._req_intercom_dp and not self._req_intercom_dp.get_value(
             if self._req_intercom_dp and not self._req_intercom_dp.get_value(
                 self._device
                 self._device
             ):
             ):
                 raise TimeoutError()
                 raise TimeoutError()
+            _LOGGER.info("%s approving intercom unlock", self._config.config_id)
             await self._approve_intercom_dp.async_set_value(self._device, True)
             await self._approve_intercom_dp.async_set_value(self._device, True)
         else:
         else:
             raise NotImplementedError()
             raise NotImplementedError()
@@ -218,6 +224,7 @@ class TuyaLocalLock(TuyaLocalEntity, LockEntity):
     async def async_open(self, **kwargs):
     async def async_open(self, **kwargs):
         """Open the door latch."""
         """Open the door latch."""
         if self._open_dp:
         if self._open_dp:
+            _LOGGER.info("%s opening", self._config.config_id)
             await self._open_dp.async_set_value(self._device, True)
             await self._open_dp.async_set_value(self._device, True)
 
 
     def build_code_unlock_msg(self, action, member_id, code, source=CODE_SRC_UNKNOWN):
     def build_code_unlock_msg(self, action, member_id, code, source=CODE_SRC_UNKNOWN):

+ 1 - 0
custom_components/tuya_local/number.py

@@ -114,4 +114,5 @@ class TuyaLocalNumber(TuyaLocalEntity, NumberEntity):
 
 
     async def async_set_native_value(self, value):
     async def async_set_native_value(self, value):
         """Set the number."""
         """Set the number."""
+        _LOGGER.info("%s setting value to %s", self._config.config_id, value)
         await self._value_dps.async_set_value(self._device, value)
         await self._value_dps.async_set_value(self._device, value)

+ 37 - 0
custom_components/tuya_local/remote.py

@@ -282,6 +282,12 @@ class TuyaLocalRemote(TuyaLocalEntity, RemoteEntity):
                 dps_to_set = self._encode_send_code(code[3:], delay, is_rf=True)
                 dps_to_set = self._encode_send_code(code[3:], delay, is_rf=True)
             else:
             else:
                 dps_to_set = self._encode_send_code(code, delay)
                 dps_to_set = self._encode_send_code(code, delay)
+            _LOGGER.info(
+                "%s sending command %s to %s",
+                self._config.config_id,
+                code,
+                subdevice or "default device",
+            )
             await self._device.async_set_properties(dps_to_set)
             await self._device.async_set_properties(dps_to_set)
 
 
             if len(codes) > 1:
             if len(codes) > 1:
@@ -340,10 +346,25 @@ class TuyaLocalRemote(TuyaLocalEntity, RemoteEntity):
                 }
                 }
             )
             )
         if self._control_dp:
         if self._control_dp:
+            _LOGGER.debug(
+                "%s starting learning %s using multi dps method",
+                self._config.config_id,
+                command,
+            )
             await self._control_dp.async_set_value(self._device, CMD_LEARN)
             await self._control_dp.async_set_value(self._device, CMD_LEARN)
         elif is_rf:
         elif is_rf:
+            _LOGGER.debug(
+                "%s starting learning %s using RF",
+                self._config.config_id,
+                command,
+            )
             await self._send_dp.async_set_value(self._device, cmd_start)
             await self._send_dp.async_set_value(self._device, cmd_start)
         else:
         else:
+            _LOGGER.debug(
+                "%s starting learning %s using IR",
+                self._config.config_id,
+                command,
+            )
             await self._send_dp.async_set_value(
             await self._send_dp.async_set_value(
                 self._device,
                 self._device,
                 json.dumps({"control": CMD_LEARN}),
                 json.dumps({"control": CMD_LEARN}),
@@ -361,6 +382,12 @@ class TuyaLocalRemote(TuyaLocalEntity, RemoteEntity):
                 await asyncio.sleep(1)
                 await asyncio.sleep(1)
                 code = self._receive_dp.get_value(self._device)
                 code = self._receive_dp.get_value(self._device)
                 if code is not None:
                 if code is not None:
+                    _LOGGER.info(
+                        "%s received code for %s: %s",
+                        self._config.config_id,
+                        command,
+                        code,
+                    )
                     self._device.anticipate_property_value(self._receive_dp.id, None)
                     self._device.anticipate_property_value(self._receive_dp.id, None)
                     return "rf:" + code if is_rf else code
                     return "rf:" + code if is_rf else code
             _LOGGER.warning("Timed out without receiving code in %s", service)
             _LOGGER.warning("Timed out without receiving code in %s", service)
@@ -372,6 +399,7 @@ class TuyaLocalRemote(TuyaLocalEntity, RemoteEntity):
             persistent_notification.async_dismiss(
             persistent_notification.async_dismiss(
                 self._device._hass, notification_id="learn_command"
                 self._device._hass, notification_id="learn_command"
             )
             )
+            _LOGGER("%s ending learning mode", self._config.config_id)
             if self._control_dp:
             if self._control_dp:
                 await self._control_dp.async_set_value(
                 await self._control_dp.async_set_value(
                     self._device,
                     self._device,
@@ -406,6 +434,12 @@ class TuyaLocalRemote(TuyaLocalEntity, RemoteEntity):
         for command in commands:
         for command in commands:
             try:
             try:
                 del codes[command]
                 del codes[command]
+                _LOGGER.info(
+                    "%s deleted command %s for %s",
+                    self._config.config_id,
+                    command,
+                    subdevice or "default device",
+                )
             except KeyError:
             except KeyError:
                 cmds_not_found.append(command)
                 cmds_not_found.append(command)
 
 
@@ -423,6 +457,9 @@ class TuyaLocalRemote(TuyaLocalEntity, RemoteEntity):
 
 
         # Clean up
         # Clean up
         if not codes:
         if not codes:
+            _LOGGER.info(
+                "%s removing unused device %s", self._config.config_id, subdevice
+            )
             del self._codes[subdevice]
             del self._codes[subdevice]
             if self._flags.pop(subdevice, None) is not None:
             if self._flags.pop(subdevice, None) is not None:
                 self._flag_storage.async_delay_save(
                 self._flag_storage.async_delay_save(

+ 1 - 0
custom_components/tuya_local/select.py

@@ -54,4 +54,5 @@ class TuyaLocalSelect(TuyaLocalEntity, SelectEntity):
 
 
     async def async_select_option(self, option):
     async def async_select_option(self, option):
         "Set the option"
         "Set the option"
+        _LOGGER.info("%s selecting option %s", self._config.config_id, option)
         await self._option_dps.async_set_value(self._device, option)
         await self._option_dps.async_set_value(self._device, option)

+ 6 - 0
custom_components/tuya_local/siren.py

@@ -88,12 +88,14 @@ class TuyaLocalSiren(TuyaLocalEntity, SirenEntity):
                     tone = self._default_tone
                     tone = self._default_tone
 
 
             if tone is not None:
             if tone is not None:
+                _LOGGER.info("%s sending tone %s", self._config.config_id, tone)
                 set_dps = {
                 set_dps = {
                     **set_dps,
                     **set_dps,
                     **self._tone_dp.get_values_to_set(self._device, tone, set_dps),
                     **self._tone_dp.get_values_to_set(self._device, tone, set_dps),
                 }
                 }
 
 
         if duration is not None and self._duration_dp:
         if duration is not None and self._duration_dp:
+            _LOGGER.info("%s setting duration to %s", self._config.config_id, duration)
             set_dps = {
             set_dps = {
                 **set_dps,
                 **set_dps,
                 **self._duration_dp.get_values_to_set(self._device, duration, set_dps),
                 **self._duration_dp.get_values_to_set(self._device, duration, set_dps),
@@ -110,12 +112,14 @@ class TuyaLocalSiren(TuyaLocalEntity, SirenEntity):
                     key=lambda x: abs(x - volume),
                     key=lambda x: abs(x - volume),
                 )
                 )
 
 
+            _LOGGER.info("%s setting volume to %s", self._config.config_id, volume)
             set_dps = {
             set_dps = {
                 **set_dps,
                 **set_dps,
                 **self._volume_dp.get_values_to_set(self._device, volume, set_dps),
                 **self._volume_dp.get_values_to_set(self._device, volume, set_dps),
             }
             }
 
 
         if self._switch_dp and not self.is_on:
         if self._switch_dp and not self.is_on:
+            _LOGGER.info("%s turning on siren", self._config.config_id)
             set_dps = {
             set_dps = {
                 **set_dps,
                 **set_dps,
                 **self._switch_dp.get_values_to_set(self._device, True, set_dps),
                 **self._switch_dp.get_values_to_set(self._device, True, set_dps),
@@ -126,6 +130,8 @@ class TuyaLocalSiren(TuyaLocalEntity, SirenEntity):
     async def async_turn_off(self) -> None:
     async def async_turn_off(self) -> None:
         """Turn off the siren"""
         """Turn off the siren"""
         if self._switch_dp:
         if self._switch_dp:
+            _LOGGER.info("%s turning off siren", self._config.config_id)
             await self._switch_dp.async_set_value(self._device, False)
             await self._switch_dp.async_set_value(self._device, False)
         elif self._tone_dp:
         elif self._tone_dp:
+            _LOGGER.info("%s setting siren tone to off", self._config.config_id)
             await self._tone_dp.async_set_value(self._device, "off")
             await self._tone_dp.async_set_value(self._device, "off")

+ 2 - 0
custom_components/tuya_local/switch.py

@@ -64,8 +64,10 @@ class TuyaLocalSwitch(TuyaLocalEntity, SwitchEntity):
 
 
     async def async_turn_on(self, **kwargs):
     async def async_turn_on(self, **kwargs):
         """Turn the switch on"""
         """Turn the switch on"""
+        _LOGGER.info("%s turning on", self._config.config_id)
         await self._switch_dps.async_set_value(self._device, True)
         await self._switch_dps.async_set_value(self._device, True)
 
 
     async def async_turn_off(self, **kwargs):
     async def async_turn_off(self, **kwargs):
         """Turn the switch off"""
         """Turn the switch off"""
+        _LOGGER.info("%s turning off", self._config.config_id)
         await self._switch_dps.async_set_value(self._device, False)
         await self._switch_dps.async_set_value(self._device, False)

+ 1 - 0
custom_components/tuya_local/text.py

@@ -75,6 +75,7 @@ class TuyaLocalText(TuyaLocalEntity, TextEntity):
 
 
     async def async_set_value(self, value: str) -> None:
     async def async_set_value(self, value: str) -> None:
         """Set the value"""
         """Set the value"""
+        _LOGGER.info("%s setting value to %s", self._config.config_id, value)
         await self._value_dp.async_set_value(self._device, value)
         await self._value_dp.async_set_value(self._device, value)
 
 
     @property
     @property

+ 3 - 0
custom_components/tuya_local/time.py

@@ -104,6 +104,7 @@ class TuyaLocalTime(TuyaLocalEntity, TimeEntity):
         minutes = value.minute
         minutes = value.minute
         seconds = value.second
         seconds = value.second
         if self._hour_dps:
         if self._hour_dps:
+            _LOGGER.info("%s setting hours to %d", self._config.config_id, hours)
             settings.update(
             settings.update(
                 self._hour_dps.get_values_to_set(self._device, hours, settings)
                 self._hour_dps.get_values_to_set(self._device, hours, settings)
             )
             )
@@ -111,6 +112,7 @@ class TuyaLocalTime(TuyaLocalEntity, TimeEntity):
             minutes = minutes + hours * 60
             minutes = minutes + hours * 60
 
 
         if self._minute_dps:
         if self._minute_dps:
+            _LOGGER.info("%s setting minutes to %d", self._config.config_id, minutes)
             settings.update(
             settings.update(
                 self._minute_dps.get_values_to_set(self._device, minutes, settings)
                 self._minute_dps.get_values_to_set(self._device, minutes, settings)
             )
             )
@@ -118,6 +120,7 @@ class TuyaLocalTime(TuyaLocalEntity, TimeEntity):
             seconds = seconds + minutes * 60
             seconds = seconds + minutes * 60
 
 
         if self._second_dps:
         if self._second_dps:
+            _LOGGER.info("%s setting seconds to %d", self._config.config_id, seconds)
             settings.update(
             settings.update(
                 self._second_dps.get_values_to_set(self._device, seconds, settings)
                 self._second_dps.get_values_to_set(self._device, seconds, settings)
             )
             )

+ 22 - 0
custom_components/tuya_local/vacuum.py

@@ -116,11 +116,13 @@ class TuyaLocalVacuum(TuyaLocalEntity, StateVacuumEntity):
     async def async_turn_on(self, **kwargs):
     async def async_turn_on(self, **kwargs):
         """Turn on the vacuum cleaner."""
         """Turn on the vacuum cleaner."""
         if self._power_dps:
         if self._power_dps:
+            _LOGGER.info("%s turning on", self._config.config_id)
             await self._power_dps.async_set_value(self._device, True)
             await self._power_dps.async_set_value(self._device, True)
 
 
     async def async_turn_off(self, **kwargs):
     async def async_turn_off(self, **kwargs):
         """Turn off the vacuum cleaner."""
         """Turn off the vacuum cleaner."""
         if self._power_dps:
         if self._power_dps:
+            _LOGGER.info("%s turning off", self._config.config_id)
             await self._power_dps.async_set_value(self._device, False)
             await self._power_dps.async_set_value(self._device, False)
 
 
     async def async_toggle(self, **kwargs):
     async def async_toggle(self, **kwargs):
@@ -128,44 +130,53 @@ class TuyaLocalVacuum(TuyaLocalEntity, StateVacuumEntity):
         dps = self._power_dps or self._activate_dps
         dps = self._power_dps or self._activate_dps
         if dps:
         if dps:
             switch_to = not dps.get_value(self._device)
             switch_to = not dps.get_value(self._device)
+            _LOGGER.info("%s toggling to %s", self._config.config_id, switch_to)
             await dps.async_set_value(self._device, switch_to)
             await dps.async_set_value(self._device, switch_to)
 
 
     async def async_start(self):
     async def async_start(self):
         dps = self._command_dps or self._status_dps
         dps = self._command_dps or self._status_dps
         if dps and "start" in dps.values(self._device):
         if dps and "start" in dps.values(self._device):
+            _LOGGER.info("%s starting by command", self._config.config_id)
             await dps.async_set_value(self._device, "start")
             await dps.async_set_value(self._device, "start")
         elif self._activate_dps:
         elif self._activate_dps:
+            _LOGGER.info("%s activating", self._config.config_id)
             await self._activate_dps.async_set_value(self._device, True)
             await self._activate_dps.async_set_value(self._device, True)
 
 
     async def async_pause(self):
     async def async_pause(self):
         """Pause the vacuum cleaner."""
         """Pause the vacuum cleaner."""
         dps = self._command_dps or self._status_dps
         dps = self._command_dps or self._status_dps
         if dps and "pause" in dps.values(self._device):
         if dps and "pause" in dps.values(self._device):
+            _LOGGER.info("%s pausing by command", self._config.config_id)
             await dps.async_set_value(self._device, "pause")
             await dps.async_set_value(self._device, "pause")
         elif self._activate_dps:
         elif self._activate_dps:
+            _LOGGER.info("%s deactivating", self._config.config_id)
             await self._activate_dps.async_set_value(self._device, False)
             await self._activate_dps.async_set_value(self._device, False)
 
 
     async def async_return_to_base(self, **kwargs):
     async def async_return_to_base(self, **kwargs):
         """Tell the vacuum cleaner to return to its base."""
         """Tell the vacuum cleaner to return to its base."""
         dps = self._command_dps or self._status_dps
         dps = self._command_dps or self._status_dps
         if dps and SERVICE_RETURN_TO_BASE in dps.values(self._device):
         if dps and SERVICE_RETURN_TO_BASE in dps.values(self._device):
+            _LOGGER.info("%s returning to base", self._config.config_id)
             await dps.async_set_value(self._device, SERVICE_RETURN_TO_BASE)
             await dps.async_set_value(self._device, SERVICE_RETURN_TO_BASE)
 
 
     async def async_clean_spot(self, **kwargs):
     async def async_clean_spot(self, **kwargs):
         """Tell the vacuum cleaner do a spot clean."""
         """Tell the vacuum cleaner do a spot clean."""
         dps = self._command_dps or self._status_dps
         dps = self._command_dps or self._status_dps
         if dps and SERVICE_CLEAN_SPOT in dps.values(self._device):
         if dps and SERVICE_CLEAN_SPOT in dps.values(self._device):
+            _LOGGER.info("%s doing spot clean", self._config.config_id)
             await dps.async_set_value(self._device, SERVICE_CLEAN_SPOT)
             await dps.async_set_value(self._device, SERVICE_CLEAN_SPOT)
 
 
     async def async_stop(self, **kwargs):
     async def async_stop(self, **kwargs):
         """Tell the vacuum cleaner to stop."""
         """Tell the vacuum cleaner to stop."""
         dps = self._command_dps or self._status_dps
         dps = self._command_dps or self._status_dps
         if dps and SERVICE_STOP in dps.values(self._device):
         if dps and SERVICE_STOP in dps.values(self._device):
+            _LOGGER.info("%s stopping", self._config.config_id)
             await dps.async_set_value(self._device, SERVICE_STOP)
             await dps.async_set_value(self._device, SERVICE_STOP)
 
 
     async def async_locate(self, **kwargs):
     async def async_locate(self, **kwargs):
         """Locate the vacuum cleaner."""
         """Locate the vacuum cleaner."""
         if self._locate_dps:
         if self._locate_dps:
+            _LOGGER.info("%s locating", self._config.config_id)
             await self._locate_dps.async_set_value(self._device, True)
             await self._locate_dps.async_set_value(self._device, True)
 
 
     async def async_send_command(self, command, params=None, **kwargs):
     async def async_send_command(self, command, params=None, **kwargs):
@@ -180,11 +191,19 @@ class TuyaLocalVacuum(TuyaLocalEntity, StateVacuumEntity):
             and SERVICE_STOP in self._direction_dps.values(self._device)
             and SERVICE_STOP in self._direction_dps.values(self._device)
         ):
         ):
             dps = self._direction_dps
             dps = self._direction_dps
+
         if command in dps.values(self._device):
         if command in dps.values(self._device):
+            _LOGGER.info(
+                "%s sending %s %s",
+                self._config.config_id,
+                "direction" if dps is self._direction_dps else "command",
+                command,
+            )
             await dps.async_set_value(self._device, command)
             await dps.async_set_value(self._device, command)
         elif self._direction_dps and command in self._direction_dps.values(
         elif self._direction_dps and command in self._direction_dps.values(
             self._device
             self._device
         ):
         ):
+            _LOGGER.info("%s sending direction %s", self._config.config_id, command)
             await self._direction_dps.async_set_value(self._device, command)
             await self._direction_dps.async_set_value(self._device, command)
 
 
     @property
     @property
@@ -202,4 +221,7 @@ class TuyaLocalVacuum(TuyaLocalEntity, StateVacuumEntity):
     async def async_set_fan_speed(self, fan_speed, **kwargs):
     async def async_set_fan_speed(self, fan_speed, **kwargs):
         """Set the fan speed of the vacuum."""
         """Set the fan speed of the vacuum."""
         if self._fan_dps:
         if self._fan_dps:
+            _LOGGER.info(
+                "%s setting fan speed to %s", self._config.config_id, fan_speed
+            )
             await self._fan_dps.async_set_value(self._device, fan_speed)
             await self._fan_dps.async_set_value(self._device, fan_speed)

+ 7 - 0
custom_components/tuya_local/valve.py

@@ -102,9 +102,11 @@ class TuyaLocalValve(TuyaLocalEntity, ValveEntity):
     async def async_open_valve(self):
     async def async_open_valve(self):
         """Open the valve."""
         """Open the valve."""
         if self._switch_dp:
         if self._switch_dp:
+            _LOGGER.info("%s opening valve", self._config.config_id)
             await self._switch_dp.async_set_value(self._device, True)
             await self._switch_dp.async_set_value(self._device, True)
             if self._valve_dp.get_value(self._device):
             if self._valve_dp.get_value(self._device):
                 return
                 return
+        _LOGGER.info("%s fully opening valve", self._config.config_id)
         await self._valve_dp.async_set_value(
         await self._valve_dp.async_set_value(
             self._device,
             self._device,
             100 if self.reports_position else True,
             100 if self.reports_position else True,
@@ -113,8 +115,10 @@ class TuyaLocalValve(TuyaLocalEntity, ValveEntity):
     async def async_close_valve(self):
     async def async_close_valve(self):
         """Close the valve"""
         """Close the valve"""
         if self._switch_dp:
         if self._switch_dp:
+            _LOGGER.info("%s closing valve", self._config.config_id)
             await self._switch_dp.async_set_value(self._device, False)
             await self._switch_dp.async_set_value(self._device, False)
         else:
         else:
+            _LOGGER.info("%s closing valve to 0%%", self._config.config_id)
             await self._valve_dp.async_set_value(
             await self._valve_dp.async_set_value(
                 self._device,
                 self._device,
                 0 if self.reports_position else False,
                 0 if self.reports_position else False,
@@ -124,4 +128,7 @@ class TuyaLocalValve(TuyaLocalEntity, ValveEntity):
         """Set the position of the valve"""
         """Set the position of the valve"""
         if not self.reports_position:
         if not self.reports_position:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info(
+            "%s setting valve position to %s%%", self._config.config_id, position
+        )
         await self._valve_dp.async_set_value(self._device, position)
         await self._valve_dp.async_set_value(self._device, position)

+ 22 - 0
custom_components/tuya_local/water_heater.py

@@ -170,6 +170,11 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
         if kwargs.get(ATTR_OPERATION_MODE) is not None:
         if kwargs.get(ATTR_OPERATION_MODE) is not None:
             if self._operation_mode_dps is None:
             if self._operation_mode_dps is None:
                 raise NotImplementedError()
                 raise NotImplementedError()
+            _LOGGER.info(
+                "%s setting operation mode to %s while setting temperature",
+                self._config.config_id,
+                kwargs.get(ATTR_OPERATION_MODE),
+            )
             await self.async_set_operation_mode(
             await self.async_set_operation_mode(
                 kwargs.get(ATTR_OPERATION_MODE),
                 kwargs.get(ATTR_OPERATION_MODE),
             )
             )
@@ -177,6 +182,11 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
         if kwargs.get(ATTR_TEMPERATURE) is not None:
         if kwargs.get(ATTR_TEMPERATURE) is not None:
             if self._temperature_dps is None:
             if self._temperature_dps is None:
                 raise NotImplementedError()
                 raise NotImplementedError()
+            _LOGGER.info(
+                "%s setting temperature to %s",
+                self._config.config_id,
+                kwargs.get(ATTR_TEMPERATURE),
+            )
             await self._temperature_dps.async_set_value(
             await self._temperature_dps.async_set_value(
                 self._device, kwargs.get(ATTR_TEMPERATURE)
                 self._device, kwargs.get(ATTR_TEMPERATURE)
             )
             )
@@ -185,6 +195,9 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
         """Set new target operation mode."""
         """Set new target operation mode."""
         if self._operation_mode_dps is None:
         if self._operation_mode_dps is None:
             raise NotImplementedError()
             raise NotImplementedError()
+        _LOGGER.info(
+            "%s setting operation mode to %s", self._config.config_id, operation_mode
+        )
         await self._operation_mode_dps.async_set_value(
         await self._operation_mode_dps.async_set_value(
             self._device,
             self._device,
             operation_mode,
             operation_mode,
@@ -193,10 +206,15 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
     async def async_turn_away_mode_on(self):
     async def async_turn_away_mode_on(self):
         """Turn away mode on"""
         """Turn away mode on"""
         if self._away_mode_dps:
         if self._away_mode_dps:
+            _LOGGER.info("%s turning away mode on", self._config.config_id)
             await self._away_mode_dps.async_set_value(self._device, True)
             await self._away_mode_dps.async_set_value(self._device, True)
         elif self._operation_mode_dps and (
         elif self._operation_mode_dps and (
             "away" in self._operation_mode_dps.values(self._device)
             "away" in self._operation_mode_dps.values(self._device)
         ):
         ):
+            _LOGGER.info(
+                "%s setting operation mode away",
+                self._config.config_id,
+            )
             await self.async_set_operation_mode("away")
             await self.async_set_operation_mode("away")
         else:
         else:
             raise NotImplementedError()
             raise NotImplementedError()
@@ -204,11 +222,13 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
     async def async_turn_away_mode_off(self):
     async def async_turn_away_mode_off(self):
         """Turn away mode off"""
         """Turn away mode off"""
         if self._away_mode_dps:
         if self._away_mode_dps:
+            _LOGGER.info("%s turning away mode off", self._config.config_id)
             await self._away_mode_dps.async_set_value(self._device, False)
             await self._away_mode_dps.async_set_value(self._device, False)
         elif self._operation_mode_dps and (
         elif self._operation_mode_dps and (
             "away" in self._operation_mode_dps.values(self._device)
             "away" in self._operation_mode_dps.values(self._device)
         ):
         ):
             # switch to the default mode
             # switch to the default mode
+            _LOGGER.info("%s setting operation mode default", self._config.config_id)
             await self.async_set_operation_mode(
             await self.async_set_operation_mode(
                 self._operation_mode_dps.default,
                 self._operation_mode_dps.default,
             )
             )
@@ -243,6 +263,7 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
         boolean dp.
         boolean dp.
         """
         """
         if self._operation_mode_dps and self._operation_mode_dps.type is bool:
         if self._operation_mode_dps and self._operation_mode_dps.type is bool:
+            _LOGGER.info("%s turning on", self._config.config_id)
             await self._device.async_set_property(
             await self._device.async_set_property(
                 self._operation_mode_dps.id,
                 self._operation_mode_dps.id,
                 True,
                 True,
@@ -254,6 +275,7 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
         boolean dp.
         boolean dp.
         """
         """
         if self._operation_mode_dps and self._operation_mode_dps.type is bool:
         if self._operation_mode_dps and self._operation_mode_dps.type is bool:
+            _LOGGER.info("%s turning off", self._config.config_id)
             await self._device.async_set_property(
             await self._device.async_set_property(
                 self._operation_mode_dps.id,
                 self._operation_mode_dps.id,
                 False,
                 False,