mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[lifx] Fix IAE for unsupported products and update products (#8827)
* Fix IllegalArgumentException when updating properties of unsupported product * Add missing products Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
333cae9e72
commit
52b7c8e920
@ -150,14 +150,20 @@ public class LifxLightPropertiesUpdater {
|
||||
}
|
||||
|
||||
if (packet instanceof StateVersionResponse) {
|
||||
Product product = Product.getProductFromProductID(((StateVersionResponse) packet).getProduct());
|
||||
long productVersion = ((StateVersionResponse) packet).getVersion();
|
||||
long productId = ((StateVersionResponse) packet).getProduct();
|
||||
properties.put(LifxBindingConstants.PROPERTY_PRODUCT_ID, Long.toString(productId));
|
||||
|
||||
properties.put(LifxBindingConstants.PROPERTY_PRODUCT_ID, Long.toString(product.getID()));
|
||||
properties.put(LifxBindingConstants.PROPERTY_PRODUCT_NAME, product.getName());
|
||||
long productVersion = ((StateVersionResponse) packet).getVersion();
|
||||
properties.put(LifxBindingConstants.PROPERTY_PRODUCT_VERSION, Long.toString(productVersion));
|
||||
properties.put(LifxBindingConstants.PROPERTY_VENDOR_ID, Long.toString(product.getVendor().getID()));
|
||||
properties.put(LifxBindingConstants.PROPERTY_VENDOR_NAME, product.getVendor().getName());
|
||||
|
||||
try {
|
||||
Product product = Product.getProductFromProductID(productId);
|
||||
properties.put(LifxBindingConstants.PROPERTY_PRODUCT_NAME, product.getName());
|
||||
properties.put(LifxBindingConstants.PROPERTY_VENDOR_ID, Long.toString(product.getVendor().getID()));
|
||||
properties.put(LifxBindingConstants.PROPERTY_VENDOR_NAME, product.getVendor().getName());
|
||||
} catch (IllegalArgumentException e) {
|
||||
logger.debug("{} : Light has an unsupported product ID: {}", logId, productId);
|
||||
}
|
||||
|
||||
receivedPacketTypes.add(packet.getPacketType());
|
||||
} else if (packet instanceof StateHostFirmwareResponse) {
|
||||
|
@ -34,42 +34,64 @@ import org.openhab.core.thing.ThingTypeUID;
|
||||
@NonNullByDefault
|
||||
public enum Product {
|
||||
|
||||
PRODUCT_1(1, "Original 1000", TR_2500_9000, COLOR),
|
||||
PRODUCT_3(3, "Color 650", TR_2500_9000, COLOR),
|
||||
PRODUCT_10(10, "White 800 (Low Voltage)", TR_2700_6500),
|
||||
PRODUCT_11(11, "White 800 (High Voltage)", TR_2700_6500),
|
||||
PRODUCT_18(18, "White 900 BR30 (Low Voltage)", TR_2700_6500),
|
||||
PRODUCT_20(20, "Color 1000 BR30", TR_2500_9000, COLOR),
|
||||
PRODUCT_22(22, "Color 1000", TR_2500_9000, COLOR),
|
||||
PRODUCT_1(1, "LIFX Original 1000", TR_2500_9000, COLOR),
|
||||
PRODUCT_3(3, "LIFX Color 650", TR_2500_9000, COLOR),
|
||||
PRODUCT_10(10, "LIFX White 800 (Low Voltage)", TR_2700_6500),
|
||||
PRODUCT_11(11, "LIFX White 800 (High Voltage)", TR_2700_6500),
|
||||
PRODUCT_15(15, "LIFX Color 1000", TR_2500_9000, COLOR),
|
||||
PRODUCT_18(18, "LIFX White 900 BR30 (Low Voltage)", TR_2700_6500),
|
||||
PRODUCT_19(19, "LIFX White 900 BR30 (High Voltage)", TR_2700_6500),
|
||||
PRODUCT_20(20, "LIFX Color 1000 BR30", TR_2500_9000, COLOR),
|
||||
PRODUCT_22(22, "LIFX Color 1000", TR_2500_9000, COLOR),
|
||||
PRODUCT_27(27, "LIFX A19", TR_2500_9000, COLOR),
|
||||
PRODUCT_28(28, "LIFX BR30", TR_2500_9000, COLOR),
|
||||
PRODUCT_29(29, "LIFX+ A19", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_30(30, "LIFX+ BR30", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_29(29, "LIFX A19 Night Vision", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_30(30, "LIFX BR30 Night Vision", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_31(31, "LIFX Z", TR_2500_9000, COLOR, MULTIZONE),
|
||||
PRODUCT_32(32, "LIFX Z 2", TR_2500_9000, COLOR, MULTIZONE),
|
||||
PRODUCT_32(32, "LIFX Z", TR_2500_9000, COLOR, MULTIZONE),
|
||||
PRODUCT_36(36, "LIFX Downlight", TR_2500_9000, COLOR),
|
||||
PRODUCT_37(37, "LIFX Downlight", TR_2500_9000, COLOR),
|
||||
PRODUCT_38(38, "LIFX Beam", TR_2500_9000, COLOR, MULTIZONE),
|
||||
PRODUCT_39(39, "LIFX Downlight White to Warm", TR_1500_9000),
|
||||
PRODUCT_40(40, "LIFX Downlight", TR_2500_9000, COLOR),
|
||||
PRODUCT_43(43, "LIFX A19", TR_2500_9000, COLOR),
|
||||
PRODUCT_44(44, "LIFX BR30", TR_2500_9000, COLOR),
|
||||
PRODUCT_45(45, "LIFX+ A19", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_46(46, "LIFX+ BR30", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_49(49, "LIFX Mini", TR_2500_9000, COLOR),
|
||||
PRODUCT_50(50, "LIFX Mini Day and Dusk", TR_1500_4000),
|
||||
PRODUCT_45(45, "LIFX A19 Night Vision", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_46(46, "LIFX BR30 Night Vision", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_49(49, "LIFX Mini Color", TR_2500_9000, COLOR),
|
||||
PRODUCT_50(50, "LIFX Mini White to Warm", TR_1500_4000),
|
||||
PRODUCT_51(51, "LIFX Mini White", TR_2700_2700),
|
||||
PRODUCT_52(52, "LIFX GU10", TR_2500_9000, COLOR),
|
||||
PRODUCT_53(53, "LIFX GU10", TR_2500_9000, COLOR),
|
||||
PRODUCT_55(55, "LIFX Tile", TR_2500_9000, CHAIN, COLOR, MATRIX, TILE_EFFECT),
|
||||
PRODUCT_57(57, "LIFX Candle", TR_1500_9000, COLOR, MATRIX),
|
||||
PRODUCT_59(59, "LIFX Mini Color", TR_2500_9000, COLOR),
|
||||
PRODUCT_60(60, "LIFX Mini Day and Dusk", TR_1500_4000),
|
||||
PRODUCT_60(60, "LIFX Mini White to Warm", TR_1500_4000),
|
||||
PRODUCT_61(61, "LIFX Mini White", TR_2700_2700),
|
||||
PRODUCT_62(62, "LIFX A19", TR_2500_9000, COLOR),
|
||||
PRODUCT_63(63, "LIFX BR30", TR_2500_9000, COLOR),
|
||||
PRODUCT_64(64, "LIFX+ A19", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_65(65, "LIFX+ BR30", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_68(68, "LIFX Candle", TR_1500_9000, COLOR, MATRIX),
|
||||
PRODUCT_81(81, "LIFX Candle Warm to White", TR_2200_6500, MATRIX),
|
||||
PRODUCT_82(82, "LIFX Filament", TR_2000_2000);
|
||||
PRODUCT_64(64, "LIFX A19 Night Vision", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_65(65, "LIFX BR30 Night Vision", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_66(66, "LIFX Mini White", TR_2700_2700),
|
||||
PRODUCT_68(68, "LIFX Candle", TR_1500_9000, MATRIX),
|
||||
PRODUCT_81(81, "LIFX Candle White to Warm", TR_2200_6500),
|
||||
PRODUCT_82(82, "LIFX Filament Clear", TR_2100_2100),
|
||||
PRODUCT_85(85, "LIFX Filament Amber", TR_2000_2000),
|
||||
PRODUCT_87(87, "LIFX Mini White", TR_2700_2700),
|
||||
PRODUCT_88(88, "LIFX Mini White", TR_2700_2700),
|
||||
PRODUCT_90(90, "LIFX Clean", TR_2500_9000, HEV),
|
||||
PRODUCT_91(91, "LIFX Color", TR_2500_9000, COLOR),
|
||||
PRODUCT_92(92, "LIFX Color", TR_2500_9000, COLOR),
|
||||
PRODUCT_94(94, "LIFX BR30", TR_2500_9000, COLOR),
|
||||
PRODUCT_96(96, "LIFX Candle White to Warm", TR_2200_6500),
|
||||
PRODUCT_97(97, "LIFX A19", TR_2500_9000, COLOR),
|
||||
PRODUCT_98(98, "LIFX BR30", TR_2500_9000, COLOR),
|
||||
PRODUCT_99(99, "LIFX Clean", TR_2500_9000, HEV),
|
||||
PRODUCT_100(100, "LIFX Filament Clear", TR_2100_2100),
|
||||
PRODUCT_101(101, "LIFX Filament Amber", TR_2000_2000),
|
||||
PRODUCT_109(109, "LIFX A19 Night Vision", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_110(110, "LIFX BR30 Night Vision", TR_2500_9000, COLOR, INFRARED),
|
||||
PRODUCT_111(111, "LIFX A19 Night Vision", TR_2500_9000, COLOR, INFRARED);
|
||||
|
||||
/**
|
||||
* Enumerates the product features.
|
||||
@ -77,6 +99,7 @@ public enum Product {
|
||||
public enum Feature {
|
||||
CHAIN,
|
||||
COLOR,
|
||||
HEV,
|
||||
INFRARED,
|
||||
MATRIX,
|
||||
MULTIZONE,
|
||||
@ -125,6 +148,11 @@ public enum Product {
|
||||
*/
|
||||
TR_2000_2000(2000, 2000),
|
||||
|
||||
/**
|
||||
* 2100-2100K
|
||||
*/
|
||||
TR_2100_2100(2100, 2100),
|
||||
|
||||
/**
|
||||
* 2200-6500K
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user