Skip to content

Commit 562b81b

Browse files
authored
Fix deprecated warnings (#170)
* Remove line now we're out of pre-release. * Fix some deprecated warnings. * Fix some deprecated warnings.
1 parent 51234bc commit 562b81b

File tree

6 files changed

+11
-22
lines changed

6 files changed

+11
-22
lines changed

README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ would be great.
132132

133133
## Thanks
134134
Many thanks to:
135-
* [JetBrains](https://www.jetbrains.com/?from=hass-aarlo) for the excellent
136-
**PyCharm IDE** and providing me with an open source licence to speed up the
137-
project development.
138-
139-
[![JetBrains](/images/jetbrains.svg)](https://www.jetbrains.com/?from=hass-aarlo)
140-
141135
* Icon from [iconscout](https://iconscout.com) by [twitter-inc](https://iconscout.com/contributors/twitter-inc)
142136

143137

@@ -151,12 +145,6 @@ Many thanks to:
151145
Virtual is part of the default HACS store. If you're not interested in
152146
development branches this is the easiest way to install.
153147

154-
- Go to `HACS` -> Search for `Virtual Components`
155-
- Click on `Virtual Components` to view the details and download button, or use the 3 dots to tghe right and press `Download`
156-
- Virtual Components `v0.8.0.1` will be downloaded by default. Recommended: Select `Need a different version?`
157-
- Select the latest version `(v0.9.0b or higher)` to use the new confiog flow.
158-
- Press `download` and **restart your Home Assistant**
159-
160148
## Adding the Integration
161149

162150
### After a Fresh Install

changelog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
0.9.3:
2+
Fix some deprecation warnings.
13
0.9.2:
24
Remove Python deprecated function.
35
Remove Home Assistant deprecated contants.

custom_components/virtual/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from .cfg import BlendedCfg, UpgradeCfg
3030

3131

32-
__version__ = '0.9.2'
32+
__version__ = '0.9.3'
3333

3434
_LOGGER = logging.getLogger(__name__)
3535

custom_components/virtual/light.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
DOMAIN as PLATFORM_DOMAIN,
2323
LightEntity,
2424
LightEntityFeature,
25-
SUPPORT_EFFECT,
2625
)
2726
from homeassistant.config_entries import ConfigEntry
2827
from homeassistant.const import STATE_ON
@@ -132,7 +131,7 @@ def __init__(self, config, old_style: bool):
132131
self._attr_supported_color_modes.add(ColorMode.ONOFF)
133132

134133
if config.get(CONF_SUPPORT_EFFECT):
135-
self._attr_supported_features |= SUPPORT_EFFECT
134+
self._attr_supported_features |= LightEntityFeature.EFFECT
136135
self._attr_effect_list = self._config.get(CONF_INITIAL_EFFECT_LIST)
137136

138137
def _create_state(self, config):
@@ -151,7 +150,7 @@ def _create_state(self, config):
151150
self._attr_color_mode = ColorMode.COLOR_TEMP
152151
self._attr_color_temp_kelvin = config.get(CONF_INITIAL_COLOR_TEMP)
153152
self._attr_brightness = config.get(CONF_INITIAL_BRIGHTNESS)
154-
if self._attr_supported_features & SUPPORT_EFFECT:
153+
if self._attr_supported_features & LightEntityFeature.EFFECT:
155154
self._attr_effect = config.get(CONF_INITIAL_EFFECT)
156155

157156
def _restore_state(self, state, config):
@@ -168,7 +167,7 @@ def _restore_state(self, state, config):
168167
if self._attr_color_mode == ColorMode.COLOR_TEMP:
169168
self._attr_color_temp_kelvin = state.attributes.get(ATTR_COLOR_TEMP_KELVIN, config.get(CONF_INITIAL_COLOR_TEMP))
170169
self._attr_brightness = state.attributes.get(ATTR_BRIGHTNESS, config.get(CONF_INITIAL_BRIGHTNESS))
171-
if self._attr_supported_features & SUPPORT_EFFECT:
170+
if self._attr_supported_features & LightEntityFeature.EFFECT:
172171
self._attr_effect = state.attributes.get(ATTR_EFFECT, config.get(CONF_INITIAL_EFFECT))
173172

174173
def _update_attributes(self):
@@ -211,7 +210,7 @@ async def async_turn_on(self, **kwargs: Any) -> None:
211210
self._attr_color_mode = ColorMode.ONOFF
212211

213212
effect = kwargs.get(ATTR_EFFECT, None)
214-
if effect is not None and self._attr_supported_features & SUPPORT_EFFECT:
213+
if effect is not None and self._attr_supported_features & LightEntityFeature.EFFECT:
215214
self._attr_effect = effect
216215

217216
self._attr_is_on = True

custom_components/virtual/lock.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
from homeassistant.components.lock import (
1515
DOMAIN as PLATFORM_DOMAIN,
1616
LockEntity,
17+
LockState,
1718
)
1819
from homeassistant.config_entries import ConfigEntry
19-
from homeassistant.const import STATE_LOCKED
2020
from homeassistant.core import HomeAssistant, callback
2121
from homeassistant.helpers.config_validation import PLATFORM_SCHEMA
2222
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@@ -92,12 +92,12 @@ def __init__(self, hass, config, old_style: bool):
9292
def _create_state(self, config):
9393
super()._create_state(config)
9494

95-
self._attr_is_locked = config.get(CONF_INITIAL_VALUE).lower() == STATE_LOCKED
95+
self._attr_is_locked = config.get(CONF_INITIAL_VALUE).lower() == LockState.LOCKED
9696

9797
def _restore_state(self, state, config):
9898
super()._restore_state(state, config)
9999

100-
self._attr_is_locked = state.state == STATE_LOCKED
100+
self._attr_is_locked = state.state == LockState.LOCKED
101101

102102
def _lock(self) -> None:
103103
if self._test_jamming == 0 or random.randint(0, self._test_jamming) > 0:

custom_components/virtual/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"documentation": "https://github.com/twrecked/hass-virtual/blob/master/README.md",
99
"iot_class": "local_push",
1010
"issue_tracker": "https://github.com/twrecked/hass-virtual/issues",
11-
"version": "0.9.2"
11+
"version": "0.9.3"
1212
}

0 commit comments

Comments
 (0)