diff --git a/README.md b/README.md index a683a2a..eb5a45f 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,7 @@ shelly: | name | Specify if you want to set a name of the device | My Cool Shelly | | | entity_id | Override the auto generated part of entity_id, like shsw_1_500500 | bedlamp | 0.0.16- | | light_switch | Show this switch as a light | True | | +| dimmable | Show this dimmer as a dimmable light (set to false for non-dimmable bulbs) | True | | | sensors | A list with sensors to show for each device. This will override the global sensors. See list below. | | 0.0.15- | | upgrade_switch | Add firmware switches when upgrade needed. Override global configuration. | False | 0.0.15- | | unavailable_after_sec | Overide number of seconds before the device will be unavialable. | 120 | 0.0.16- | diff --git a/custom_components/shelly/__init__.py b/custom_components/shelly/__init__.py index 24ddf1e..ab56017 100755 --- a/custom_components/shelly/__init__.py +++ b/custom_components/shelly/__init__.py @@ -491,6 +491,8 @@ async def _async_device_added(self, dev, _code): elif dev.device_type == "BINARY_SENSOR": self.add_device("binary_sensor", dev) elif dev.device_type in ["LIGHT", "DIMMER", "RGBLIGHT"]: + if device_config.get(CONF_DIMMER_DIMMABLE) == False: + dev.device_type = "RELAY" self.add_device("light", dev) else: _LOGGER.error("Unknown device type, %s", dev.device_type) diff --git a/custom_components/shelly/configuration_schema.py b/custom_components/shelly/configuration_schema.py index b3d528f..45a11d7 100644 --- a/custom_components/shelly/configuration_schema.py +++ b/custom_components/shelly/configuration_schema.py @@ -38,6 +38,7 @@ vol.Required(CONF_ID): cv.string, vol.Optional(CONF_NAME): cv.string, vol.Optional(CONF_LIGHT_SWITCH, default=False): cv.boolean, + vol.Optional(CONF_DIMMER_DIMMABLE, default=True): cv.boolean, vol.Optional(CONF_SENSORS): vol.All(cv.ensure_list, [vol.In(ALL_SENSORS_W_EXTRA)]), vol.Optional(CONF_UPGRADE_SWITCH): cv.boolean, diff --git a/custom_components/shelly/const.py b/custom_components/shelly/const.py index a8e4e57..6fa8e6d 100644 --- a/custom_components/shelly/const.py +++ b/custom_components/shelly/const.py @@ -24,6 +24,7 @@ CONF_IGMPFIX = 'igmp_fix' CONF_MDNS = 'mdns' CONF_LIGHT_SWITCH = 'light_switch' +CONF_DIMMER_DIMMABLE = 'dimmable' CONF_OBJECT_ID_PREFIX = 'id_prefix' CONF_ENTITY_ID = 'entity_id' CONF_SHOW_ID_IN_NAME = 'show_id_in_name'