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

v1.3.0b0 Hue Scenes #77

Open
pgale opened this issue Apr 27, 2024 · 21 comments
Open

v1.3.0b0 Hue Scenes #77

pgale opened this issue Apr 27, 2024 · 21 comments

Comments

@pgale
Copy link

pgale commented Apr 27, 2024

Hi,

Thanks for adding this. I'm a bit lost when going through the config process as there isn't any text describing what you are asking for. So the first screen after the screen with the scene path (scenes.yaml) is this:

Screenshot 2024-04-27 122851

I add a couple of Hue scenes and submit. Then I get the same screen with no description:

Screenshot 2024-04-27 122953

and that continues.

Is this a bug or am I expected to add something else?

Thanks.

@hugobloem
Copy link
Owner

There should be explanations there. Could you try restarting and refreshing your browser cache (normally ctrl+F5)?

@pgale
Copy link
Author

pgale commented Apr 27, 2024

Ah yes that worked.

I setup a single Hue scene and went through adding the individual Hue lights (something like 10 of them) and after confirming the scene had turned on, I got a failed to setup error. The log is:

Source: config_entries.py:551
First occurred: 12:51:56 (2 occurrences)
Last logged: 12:52:08

Error setting up entry Stateful Scenes for stateful_scenes
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 551, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/stateful_scenes/__init__.py", line 22, in async_setup_entry
    hass.data[DOMAIN][entry.entry_id] = Hub(
                                        ^^^^
  File "/config/custom_components/stateful_scenes/StatefulScenes.py", line 85, in __init__
    scene_conf = self.prepare_external_scene(entity_id, conf["entities"])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/stateful_scenes/StatefulScenes.py", line 177, in prepare_external_scene
    "id": get_id_from_entity_id(self.hass, entity_id),
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/stateful_scenes/StatefulScenes.py", line 35, in get_id_from_entity_id
    return state.attributes["id"]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'id'

@pgale
Copy link
Author

pgale commented Apr 27, 2024

...and I just tried to setup a scene in another room with different Hue lights. Got the same error again.

@hugobloem
Copy link
Owner

Sorry that was a bug, please try with 1.3.0b1

@pgale
Copy link
Author

pgale commented Apr 27, 2024

Got further - created the scene :)

But when clicking the "Turn Office Concentrate stateful scene on" in the controls card, it gives another error that might appear to be to do with entity_id's again?

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:239
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 13:24:32 (2 occurrences)
Last logged: 13:24:47

[139650018517952] Cannot find entity_id for: Office Concentrate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1655, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/stateful_scenes/switch.py", line 135, in turn_on
    self._scene.turn_on()
  File "/config/custom_components/stateful_scenes/StatefulScenes.py", line 233, in turn_on
    raise StatefulScenesYamlInvalid("Cannot find entity_id for: " + self.name)
custom_components.stateful_scenes.StatefulScenes.StatefulScenesYamlInvalid: Cannot find entity_id for: Office Concentrate

@pgale
Copy link
Author

pgale commented Apr 27, 2024

BUT!!! I should say that it seems to track the scene :) Even when I change the scene from within the hue app connected to the bridge. Fabulous! onlt a quick test but looking good - this will potentially be a game-changer!

Thanks :)

@hugobloem
Copy link
Owner

Hi,

I have released 1.3.0b2. I have tested this on my own instance and it seems to work. Let me know whether it works for you too!

@pgale
Copy link
Author

pgale commented Apr 27, 2024

Thanks :) I'll download it now and have a quick test. More time tomorrow.

@paulsgale
Copy link

Still getting errors after a restart:

`
logger:%20homeassistant%0ASource%3A%20helpers/entity.py:1208%0AFirst%20occurred:%2018:45:09%20(37%20occurrences)%0ALast%20logged:%2018:46:28%0A%0AError%20doing%20job:%20Future%20exception%20was%20never%20retrieved%0ATraceback%20(most%20recent%20call%20last):%0A%20%20File%20%22/usr/local/lib/python3.12/concurrent/futures/thread.py%22,%20line%2058,%20in%20run%0A%20%20%20%20result%20=%20self.fn(*self.args,%20**self.kwargs)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%0A%20%20File%20%22/config/custom_components/stateful_scenes/StatefulScenes.py%22,%20line%20304,%20in%20update_callback%0A%20%20%20%20self.schedule_update(True)%0A%20%20File%20%22/usr/src/homeassistant/homeassistant/helpers/entity.py%22,%20line%201208,%20in%20schedule_update_ha_state%0A%20%20%20%20self.hass.create_task(%0A%20%20%20%20%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%0AAttributeError:%20'NoneType'%20object%20has%20no%20attribute%20'create_task'%0A

`

@hugobloem
Copy link
Owner

That is annoying. Could you try to remove the integration by clicking on the three dots on the integration's page, and then readding it?

I hope you don't have to reconfigure too many scenes now. I would suggest trying one or two just to see if it works. I think I will have to update the UI anyway such that each scene is its own entry (#82).

@pgale
Copy link
Author

pgale commented Apr 27, 2024

Yes I'll give it a go

@pgale
Copy link
Author

pgale commented Apr 27, 2024

I noticed the error log i posted from my ipad was gibberish.

Anyway, removed the integration and added three scenes again - still errors.

Logger: homeassistant
Source: helpers/entity.py:1208
First occurred: 19:45:01 (20 occurrences)
Last logged: 19:45:09

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/stateful_scenes/StatefulScenes.py", line 304, in update_callback
    self.schedule_update(True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1208, in schedule_update_ha_state
    self.hass.create_task(
    ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'create_task'

@pgale
Copy link
Author

pgale commented Apr 27, 2024

I also noticed that on config, the integration creates a couple of new areas, despite adding the correct ones at the end - I had to go and remove the device and delete those incorrect areas.

@pgale
Copy link
Author

pgale commented May 2, 2024

Hi, did you have any thoughts on the errors? Thanks.

@pgale
Copy link
Author

pgale commented May 6, 2024

Appreciate you have a lot on. Any idea when you might be able to have another look at the errors? Thanks.

@hugobloem
Copy link
Owner

hugobloem commented May 26, 2024

Hi, I have released 1.3.0b4 and it seems to be working now. You now add the integration as per usual and additional scenes are discovered, which you can then configure individually.

@pgale
Copy link
Author

pgale commented May 26, 2024

I just tried it and the Hue scenes are discovered. However, my scenes aren't named with the room or area which will be common with most scenes other users setup I would imagine. That means there are potentially multiple scenes with the same name and no way to work out which one relates to the room/area in question to then add the devices. For example:
image

Is there a way to turn off auto discovery to enable careful adding scene by scene - which would then allow correct setup.

Or, is there any way to get additional info about the scene and which room it comes from? Thanks.

@pgale
Copy link
Author

pgale commented May 26, 2024

If the info of where the scene is located isn't available, I wonder if having a button to trigger it would help during setup?

@hugobloem
Copy link
Owner

In #93, I have added the area name to the discovered scenes so it is easier to identify which scene is being referred to. Also, you can disable discovery during the setup and configure external scenes using the config flow (independent on whether scenes are discovered or not).

@pgale
Copy link
Author

pgale commented May 26, 2024

Excellent. Look forward to trying it. Thanks very much!

@hugobloem
Copy link
Owner

You can! I released 1.3.0b5 now 😅

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

No branches or pull requests

3 participants