Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'SimpleSwitch' object has no attribute '_current_settings' #1054

Open
JohnnyTwoFingers opened this issue Sep 28, 2024 · 0 comments

Comments

@JohnnyTwoFingers
Copy link

Home Assistant Adaptive Lighting Issue Template

Bug Reports

If you need help with using or configuring Adaptive Lighting, please open a Q&A discussion thread here instead.

Before submitting a bug report, please follow these troubleshooting steps:

Please confirm that you have completed the following steps:

  1. Debug logs captured while the issue occurred. See here for instructions on enabling debug logging:

See attached CSV.
Adaptives.csv

Key error is below

<style> </style>

2024-09-28 22:09:27.758 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'SimpleSwitch' object has no attribute '_current_settings'

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/adaptive_lighting/switch.py", line 360, in handle_change_switch_settings
defaults = switch._current_settings  # pylint: disable=protected-access
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SimpleSwitch' object has no attribute '_current_settings'
2024-09-28 22:09:27.785 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140411163976480] Error handling message: Unknown error (unknown_error) Kirk from 192.168.11.4 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 816, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1795, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 463, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 557, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/adaptive_lighting/switch.py", line 360, in handle_change_switch_settings
defaults = switch._current_settings  # pylint: disable=protected-access
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SimpleSwitch' object has no attribute '_current_settings'

  1. Your Adaptive Lighting configuration:
    Nothing more than the following in configuration.yaml. My config is set up in the UI.
    adaptive_lighting:

image
image
image
image

  1. Nil

  2. Describe the bug and how to reproduce it:
    I just called the action below from Developer tools
    ACTION:
    action: adaptive_lighting.change_switch_settings
    data:
    entity_id: switch.adaptive_lighting_adapt_brightness_living_room
    min_brightness: "30"
    use_defaults: current

  3. Steps to reproduce the behavior:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant