Skip to content

Commit

Permalink
HACS update - ShellyForHASS Beta 5 - #16
Browse files Browse the repository at this point in the history
  • Loading branch information
BeardedTinker committed Sep 3, 2020
1 parent 7e23103 commit 0f5e701
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion custom_components/shelly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

_LOGGER = logging.getLogger(__name__)

__version__ = "0.2.0-b4"
__version__ = "0.2.0-b5"
VERSION = __version__

async def async_setup(hass, config):
Expand Down
5 changes: 3 additions & 2 deletions custom_components/shelly/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, dev, instance):
self._unique_id += "_switch"
self.entity_id += "_switch"
self._state = None
self._click_delay = 500
self._click_delay = 700
self._last_state_change = 0
self._click_cnt = 0
self._click_timer = None
Expand Down Expand Up @@ -108,11 +108,12 @@ def _send_event(self, type):
def update(self):
"""Fetch new state data for this switch."""
millis = self._millis()
new_state = self._dev.state != 0
new_state = None if self._dev.state is None else self._dev.state != 0
if self._state is not None and new_state != self._state:
if self._click_timer is not None:
self._click_timer.cancel()
diff = millis - self._last_state_change
print(diff)
if diff < self._click_delay or self._click_cnt == 0:
self._click_cnt += 1
else:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/shelly/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def device_state_attributes(self):
if self._block.info_values is not None:
for key, value in self._block.info_values.items():
if self.instance.conf_attribute(key):
attrs[k] = value
attrs[key] = value
src = ''

return attrs
Expand Down
4 changes: 2 additions & 2 deletions custom_components/shelly/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
ATTRIBUTE_SWITCH,
ATTRIBUTE_OVER_POWER,
ATTRIBUTE_OVER_TEMP,
#ATTRIBUTE_TOTAL_CONSUMPTION,
#ATTRIBUTE_VOLTAGE,
ATTRIBUTE_TOTAL_CONSUMPTION,
ATTRIBUTE_VOLTAGE,
ATTRIBUTE_BATTERY,
ATTRIBUTE_CLICK_CNT,
ATTRIBUTE_CLICK_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/shelly/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def device_state_attributes(self):
if room:
attrs['room'] = room

if self._master_unit:
if self._master_unit or self.instance._debug_msg:

attrs['protocols'] = self._dev.protocols

Expand Down
2 changes: 1 addition & 1 deletion custom_components/shelly/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"documentation": "https://github.com/StyraHem/ShellyForHASS/blob/master/README.md",
"dependencies": ["zeroconf"],
"codeowners": ["@hakana","@StyraHem"],
"requirements": ["pyShelly==0.2.5"]
"requirements": ["pyShelly==0.2.6"]
}

0 comments on commit 0f5e701

Please sign in to comment.