Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
- Remove Validate badge
- Update documentation
- Small cosmetic code changes
  • Loading branch information
myhomeiot committed Apr 1, 2021
1 parent c7d3e5c commit e8cc7aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![Validate](https://github.com/myhomeiot/DahuaVTO/workflows/Validate/badge.svg)](https://github.com/myhomeiot/DahuaVTO/actions)

A Home Assistant custom integration for control Dahua VTO/VTH devices.

The following models are reported as working:
Expand Down Expand Up @@ -155,6 +153,7 @@ Possible that in your case the `State` will be different and this depends from t
| 1, 2 | Call/Ring |
| 5 | Call answered from VTH |
| 6 | Call **not** answered |
| 7 | VTH calling VTO |
| 8 | Unlock |
| 9 | Unlock failed |
| 11 | Unknown, as result of **magicBox.getExitTime** command after VTO reboot |
Expand Down Expand Up @@ -199,6 +198,7 @@ logger:
# Useful Links

- [@mcw0 Dahua-JSON-Debug-Console-v2.py](https://github.com/mcw0/Tools)
- [@Antori91 Dahua-VTH-SecPanel.py](https://github.com/Antori91/Home_Automation/blob/master/Alarm%20Server/Dahua-VTH-SecPanel.py)
- [Dahua intercom - API](https://ipcamtalk.com/threads/dahua-intercom-api-for-vth1550ch.45455)
- ftp://ftp.asm.cz/Dahua/videovratni

Expand Down
8 changes: 4 additions & 4 deletions custom_components/dahua_vto/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def connection_lost(self, exc):
if self.heartbeat is not None:
self.heartbeat.cancel()
self.heartbeat = None
if not self.on_connection_lost.done():
if not self.on_connection_lost.cancelled():
self.on_connection_lost.set_result(True)

def hashed_password(self, random, realm):
Expand Down Expand Up @@ -121,8 +121,8 @@ def data_received(self, data):
while len(self.chunk) > 0:
if len(self.chunk) < self.header_len:
break
packet_proto, *_, packet_len = struct.unpack(
DAHUA_HEADER_FORMAT, self.chunk[0:self.header_len])
packet_proto, *_, packet_len = struct.unpack_from(
DAHUA_HEADER_FORMAT, self.chunk)
if packet_proto != DAHUA_PROTO_DHIP:
raise Exception("Wrong proto")
tail = self.header_len + packet_len
Expand All @@ -132,7 +132,7 @@ def data_received(self, data):
"utf-8", "ignore")
self.chunk = self.chunk[tail:]

_LOGGER.debug("<<< {}".format(packet.strip("\n")))
_LOGGER.debug("<<< {}".format(packet.rstrip()))
message = json.loads(packet)

if self.on_response is not None \
Expand Down

0 comments on commit e8cc7aa

Please sign in to comment.