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

[hue] Use system default channel types for lights #9856

Merged

Conversation

cweitkamp
Copy link
Contributor

  • Use system default channel types for lights

Signed-off-by: Christoph Weitkamp github@christophweitkamp.de

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
@cweitkamp cweitkamp added the enhancement An enhancement or new feature for an existing add-on label Jan 17, 2021
@cpmeister
Copy link
Contributor

Are these changes backwards compatible?

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Copy link
Contributor Author

@cweitkamp cweitkamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpmeister A comparison:

One thing we will lose is the "Lighting" tag form some channel types which imo is not relevant anymore. Semantics are using the "Light" tag.

The more detailed descriptions for the channels types can be backported to OHC.

<tags>
<tag>Lighting</tag>
</tags>
</channel-type>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public static final ChannelType SYSTEM_COLOR = ChannelTypeBuilder
        .state(new ChannelTypeUID(BINDING_ID, "color"), "Color", "Color")
        .withDescription("Controls the color of the light").withCategory("ColorLight").build();

<tags>
<tag>Lighting</tag>
</tags>
</channel-type>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public static final ChannelType SYSTEM_POWER = ChannelTypeBuilder
        .state(new ChannelTypeUID(BINDING_ID, "power"), "Power", "Switch")
        .withDescription("Device is operable when channel has state ON").withCategory("Switch").build();

temperature of a light from 0 (cold) to 100 (warm).
</description>
<category>ColorLight</category>
</channel-type>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public static final ChannelType SYSTEM_COLOR_TEMPERATURE = ChannelTypeBuilder
        .state(new ChannelTypeUID(BINDING_ID, "color-temperature"), "Color Temperature", "Dimmer")
        .withDescription("Controls the color temperature of the light").withCategory("ColorLight")
        .withStateDescriptionFragment(StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.ZERO)
                .withMaximum(new BigDecimal(100)).withPattern("%d").build())
        .build();

<tags>
<tag>Lighting</tag>
</tags>
</channel-type>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public static final ChannelType SYSTEM_BRIGHTNESS = ChannelTypeBuilder
        .state(new ChannelTypeUID(BINDING_ID, "brightness"), "Brightness", "Dimmer")
        .withDescription("Controls the brightness and switches the light on and off").withCategory("Light")
        .withStateDescriptionFragment(StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.ZERO)
                .withMaximum(new BigDecimal(100)).withPattern("%d %%").build())
        .build();

@cpmeister cpmeister merged commit 1a64f10 into openhab:main Jan 19, 2021
@cpmeister cpmeister added this to the 3.1 milestone Jan 19, 2021
@cweitkamp cweitkamp deleted the feature-hue-use-system-channel-types branch January 19, 2021 09:56
@BobMiles
Copy link

BobMiles commented Feb 4, 2021

Hi,
I recently switched to M1 and I lost all my thing channels for hue lamps except the alarm/loop.
Could this be related to this change? The items seem still to be linked and interaction is possible (I can control lights via OH), but the channels are "invisible".
Screenshot_20210204_163419

@cweitkamp
Copy link
Contributor Author

Yes, it is. For managed Things the Channel Type is stored in JSON storage and will not be changed accordingly. To solve your issue you have to delete and recreate your Thing.

@BobMiles
Copy link

BobMiles commented Feb 4, 2021

Thank you very much for the quick answer!

themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this pull request May 10, 2021
* Use system default channel types for lights

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: John Marshall <john.marshall.au@gmail.com>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this pull request Nov 7, 2021
* Use system default channel types for lights

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/hue-channels-for-light-items-disappeared/124411/19

marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
* Use system default channel types for lights

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on (potentially) not backward compatible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants