GithubHelp home page GithubHelp logo

hypfer / hass-scene_presets Goto Github PK

View Code? Open in Web Editor NEW
98.0 7.0 7.0 15.41 MB

Hue-like scene presets for lights in home assistant

License: Apache License 2.0

Python 34.14% TypeScript 62.13% JavaScript 3.73%
home-assistant

hass-scene_presets's Introduction

scene_presets

This custom_component is an implementation of an idea not all too dissimilar to what the Philips Hue app calls Scenes. Apart from that though, it has nothing to do with Hue. No bridge required.

Everything has been implemented entirely inside this custom_component, meaning that it works with every light entity. No vendor restrictions. No need for special bridges. And, most importantly, no account required :-)

Screenshots

ui.png

service.png

Installation

  1. Add the repository as a custom repository of type integration in HACS: https://hacs.xyz/docs/faq/custom_repositories/
  2. Restart Home Assistant
  3. Navigate to Settings > Devices & Services
  4. Click Add integration
  5. Search for Scene Presets
  6. Click on it and follow the wizard 🧙

You should now have a new item in your sidebar.

Usage

The scene_presets component can either be used via its UI or by calling its services in automations, scripts etc.

It is compatible with any color-capable light entity. Additionally, it will also try its best to map colors to a matching color temperature if it encounters a light that only features tunable white capabilities.

UI Usage

To get to know what is possible, I'd recommend opening up the UI first and playing around for a bit.
For that, simply open the Home Assistant sidebar, navigate to "Scene Presets", select your lights and then click on a preset tile to apply it.

The UI will remember your favorite presets, your last selected targets and the last state of your tunables in your browser's local storage.
This means that it is persistent but not synced across devices.

The tunables section allows you to further customize how the preset should be applied.
In normal mode, you have the following options:

  • Shuffle - Whether or not the colors should be shuffled before applying them to the provided list of targets
  • Smart Shuffle - Attempt to create smooth color transitions when shuffling. See the docs for more info
  • Custom brightness - Override the brightness specified in the preset
  • Custom transition - Default transition time in normal mode is 1s

Dynamic Scenes

If you enable the dynamic toggle, you will have Dynamic Scenes.
These are endless loops that apply the same preset with smart shuffled colors every interval with a transition as specified.

Dynamic Scenes can be useful to e.g. have ambient lighting that constantly changes but does so mostly unnoticeable.
For that effect to work, you of course need to pick suitably long durations for interval and transition.

You can see all active dynamic scenes at the top of the UI. To stop them, just tap them.

Furthermore, you should know that

  • a dynamic scene will automatically stop once you turn off all lights it was active on.
  • a dynamic scene will be stopped if a second one is started that would also interact with a light that is already part of the first one.
  • dynamic scenes can put a lot of strain on your zigbee network if you pick many lights and very short intervals.
  • dynamic scenes may suffer from different lights having different command delays. Picking a longer transition time helps to mask that.
  • dynamic scenes do not survive a restart of home assistant. This is intentional.
  • dynamic scenes will on first iteration always use a transition of 0.5s and no smart shuffle for instant results and to make sure to get all colors of the selected preset into the rotation.

Service usage

The UI is not the only way to use this component. In fact, it too just calls the services provided by it.

You can use the services to e.g. bind scene presets to a button on a remote or someone entering a room or maybe even a voice command.

To make this easier, you can use the UI, do the action you'd like to do and then click on the robot icon on the top right.
This will then open a dialog that looks like this with a copy-pasteable service call for easy automation:

last_action_payload.png

Advanced usage

For advanced usage, use the Home Assistant DevTools and call the services provided by the custom_component directly.
Preset IDs can be found in the overview here: assets

If you're a developer, you can also add your own presets by creating a json file.
Check the docs page on that for more info.

Docs

Check out the ./docs/ folder.

Further questions?

scene_presets Telegram group

Misc

This component provides all the scene presets that were available in the Hue App scene gallery on 2023-09-28. These have been manually extracted in a clean-room way by setting a group of lights to a scene and then noting the different x,y values + its name. Thanks again to @coderph0x!

Check out the assets folder for a list with all presets available.

hass-scene_presets's People

Contributors

hypfer avatar marcelveldt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hass-scene_presets's Issues

Halloween Scenes

Would you consider adding the currently available Halloween scenes from the Hue app?

Unfortunately, as I don't own enough RGB lights, I can't reliably get all colors to extract their values; extracting them from palette sreenshots seems to be a valid substitute, though. Do you need them in x,y, or would rgb values work as well?

Question about unwrapping group childs

What is happening?

I noticed you made a change where grouped lights automatically are expanded. While this is in principle a nice behavior its not always wanted. For example I have a few groups of lights I'd like to have the same color. So I manually specified multiple groups of lights.

Which are now (since recent versions) all expanded into individual lights. Even creating a "super group" and adding the subgroups in there expands them all. I don't think that is desired behavior.

What should be happening?

I'm asking you to consider to only unwrap/unfold one single iteration of groups and not expand the entire tree.
Either that, or a simple option to not expand at all.

Reflection 1

Balanced View

Is this issue tracker the right place for this topic?

Sure and as you are aware I'm willing to PR the change myself.

Please enter the scene_preset version you're using

latest

Please enter the Home Assistant version you're using

2024.1

Details about your setup

irrelevant

Reflection 2

irrelevant

Time and Effort

  • Yes, I did my homework.
  • I understand that my issue will be deleted with no further comment if I did not do my homework.

Other users can't see Scene Presets

I am having trouble getting other users to see Scene Presets in their sidebars, as well as through a dashboard button that links to that page via nav. Is this intentional? Would love to let my other users set scenes in our home, but only I, the admin our our HAOS instance, can see it.

Issue running in a few scenes

First, let me congratulate you for your idea and efforts in bringing these scenes in HA.

I have some old Hue bulbs, but when they fail I choose to replace them with Wiz , which also come from same company (Signify) at a much affordable price. The one thing missing was scenes and interoperability with older bulbs, and I just found your integration and gave it a try.

Running the scenes against Wiz bulbs, the colors do not match the picture. They tend to stuck in a range of white.

And in a few scenes (Motown, Tokyo, , I got the following error :

Logger: homeassistant.config_entries
Source: config_entries.py:406
First occurred: 6:50:37 PM (1 occurrences)
Last logged: 6:50:37 PM

Error setting up entry scene_presets for scene_presets
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/scene_presets/__init__.py", line 178, in async_setup_entry
    await async_setup_view(hass)
  File "/config/custom_components/scene_presets/view.py", line 25, in async_setup_view
    hass.components.frontend.async_register_built_in_panel(
  File "/usr/src/homeassistant/homeassistant/components/frontend/__init__.py", line 303, in async_register_built_in_panel
    raise ValueError(f"Overwriting panel {panel.frontend_url_path}")
ValueError: Overwriting panel scene_presets

If you need me to provide more logs, let me know.

Thanks

How to setup?

Hey, I found your custom integration, but Iam not sure how to set it up. I did install it as a custom repository in HACS and downloaded it. It didnt appear in my sidebar (after restarting and clearing the cache).

The readme says "After the install via HACS, you must then set it up via a config flow that does nothing." => I have no clue, what that means... I did google "config flow" in context of Home Assisstant, but I really dont know what to do...^^

Could you add some extra explanation, please?

Thanks!

Make UI available as View / Card instead of Dashboard

What is happening?

When adding this custom integration, a new Dashboard is created on the sidebar. However, as "light-related" views might be defined in previously-configured dashboards, for the purpose of having related settings close to each other it would be great to have the option to show the UI of this integration within an existing dashboard.

What should be happening?

Ideally there could be the option to not automatically create a dashboard for the scene presets, while at the same time providing a "companion frontend card", meant to be added as single-card view.

Reflection 1

Subjective Opinion

Is this issue tracker the right place for this topic?

Yes, as it pertains to this integration only. The label "Enhancement" might be apt, as it is not describing a bug.

Please enter the scene_preset version you're using

1.2.3

Please enter the Home Assistant version you're using

2024.2.5

Details about your setup

Doesn't really matter, but exclusively hue lights integrated in HA over the Hue integration.

Reflection 2

No

Time and Effort

  • Yes, I did my homework.
  • I understand that my issue will be deleted with no further comment if I did not do my homework.

Dim-only bulbs

What is happening?

Hi, i have a few Hue white ambiance lights and a zigbee dimmer switch (Ecodim) that controls regular lights.

With the Hue app/bridge, setting a scene would also adjust the brightness for the dimmer, the scene presets plug-in doesn’t do anything when these bulbs are selected when setting a scene. Is it possible to change this?

What should be happening?

When I set a scene to “rest” or “relax”, the contrast of the selected dimmer switch should be updated to match te scene. This would allow me to set a scene for the whole room.

Reflection 1

Balanced View

Is this issue tracker the right place for this topic?

I can manually change the brightness of the dimmer with home assistant.

Please enter the scene_preset version you're using

1.2.2

Please enter the Home Assistant version you're using

2024.2.2

Details about your setup

ECO-DIM.05 connected to Zigbee controller SLZB-06, Zigbee2MQTT.

Reflection 2

HA and Zigbee2MQTT both running in Docker on a Synology NAS

Time and Effort

  • Yes, I did my homework.
  • I understand that my issue will be deleted with no further comment if I did not do my homework.

Disable brightness on scene

What is happening?

It is amazing how fluent this works! I really missed the hue scenes since letting go the bridge s few years ago.

I want to stay in charge of the brightness of each light, so I would like to have the option to disable the adjustment of brightness completely. Would it be possible to implement that? I want to combine this with smart light groups (Lightener integration) and this is not possible in the scene because for the colors, groups are expanded.

(another solution would be to expand the groups for the colors, but apply the set brightness to the group without expanding, but I’m not sure if that is easy to implement).

Kind regards,
Patrick

What should be happening?

I expected the brightness to apply to the group, and not the individual lights within the group.

Reflection 1

Balanced View

Is this issue tracker the right place for this topic?

Yes, the expansion of groups is not per se expected behavior, and the suggestions might benefit other use cases as well.

Please enter the scene_preset version you're using

Multiple scenes

Please enter the Home Assistant version you're using

2024.4

Details about your setup

Zigbee, ZHA, mostly hue

Reflection 2

Yes, I use lightener

Time and Effort

  • Yes, I did my homework.
  • I understand that my issue will be deleted with no further comment if I did not do my homework.

Support for supported_color_mode hs

I have a mixture of hue bulbs and LIFX bulbs. The integration works against the hue bulbs as expected. Thank you!

The LIFX bulbs do not change colour. I found in Developer tools for the LIFX bulb that supported_color_modes: color_temp, hs

I changed the line in presets.py that checks for xy to hs and restarted Home Assistant. The integration successfully works against the LIFX bulbs.

Can you consider making this change in the source code? By supporting xy (hue) and hs LIFX we can support more bulbs.

        if "xy" in hass_state.attributes.get("supported_color_modes", ""):

Thanks

min_color_temp_kelvin: 1500
max_color_temp_kelvin: 9000
min_mireds: 111
max_mireds: 666
effect_list: effect_colorloop, effect_pulse, effect_stop
supported_color_modes: color_temp, hs
color_mode: hs
brightness: 255
hs_color: 277.239, 34.118
rgb_color: 221, 168, 255
xy_color: 0.315, 0.231
friendly_name: Work Desk A19 1
supported_features: 36

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.