Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 455320c50e | |||
| 2b66ffa426 | |||
| 2b252c0b22 | |||
| d7a7b2d185 | |||
| 01165a4f85 | |||
| fa2c724333 | |||
| b21e2f95aa | |||
| 0e8c3ef0b6 | |||
| 4d8dc3fbe4 | |||
| f1002d107f | |||
| 67fef3862b | |||
| 24fc2ea74e | |||
| 0e7923103c |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"domain": "ecovacs",
|
"domain": "ecovacs",
|
||||||
"name": "Ecovacs Bumper",
|
"name": "Ecovacs Bumper",
|
||||||
"version": "1.4.0",
|
"version": "1.4.5",
|
||||||
"documentation": "https://github.com/bittles/ha_ecovacs_bumper",
|
"documentation": "https://github.com/bittles/ha_ecovacs_bumper",
|
||||||
"issue_tracker": "https://github.com/bittles/ha_ecovacs_bumper/issues",
|
"issue_tracker": "https://github.com/bittles/ha_ecovacs_bumper/issues",
|
||||||
"requirements": ["sleekxmppfs==1.4.1", "requests>=2.18", "pycryptodome>=3.4", "pycountry-convert>=0.5", "paho-mqtt>=1.4", "stringcase>=1.2"],
|
"requirements": ["sleekxmppfs==1.4.1", "requests>=2.18", "pycryptodome>=3.4", "pycountry-convert>=0.5", "paho-mqtt>=1.4", "stringcase>=1.2"],
|
||||||
|
|||||||
@@ -9,9 +9,24 @@ from paho.mqtt.client import Client as ClientMQTT
|
|||||||
from paho.mqtt import publish as MQTTPublish
|
from paho.mqtt import publish as MQTTPublish
|
||||||
from paho.mqtt import subscribe as MQTTSubscribe
|
from paho.mqtt import subscribe as MQTTSubscribe
|
||||||
from sleekxmppfs.xmlstream import ET
|
from sleekxmppfs.xmlstream import ET
|
||||||
|
from .sucks import EcoVacsAPI
|
||||||
|
|
||||||
from .const import LOGGER
|
from .const import LOGGER
|
||||||
|
|
||||||
|
def str_to_bool_or_cert(s):
|
||||||
|
if s == 'True' or s == True:
|
||||||
|
return True
|
||||||
|
elif s == 'False' or s == False:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if not s == None:
|
||||||
|
if os.path.exists(s): # User could provide a path to a CA Cert as well, which is useful for Bumper
|
||||||
|
if os.path.isfile(s):
|
||||||
|
return s
|
||||||
|
else:
|
||||||
|
raise ValueError("Certificate path provided is not a file - {}".format(s))
|
||||||
|
raise ValueError("Cannot covert {} to a bool or certificate path".format(s))
|
||||||
|
|
||||||
#This is used by EcoVacsIOTMQ and EcoVacsXMPP for _ctl_to_dict
|
#This is used by EcoVacsIOTMQ and EcoVacsXMPP for _ctl_to_dict
|
||||||
def RepresentsInt(stringvar):
|
def RepresentsInt(stringvar):
|
||||||
try:
|
try:
|
||||||
@@ -75,7 +90,7 @@ class EcoVacsIOTMQ(ClientMQTT):
|
|||||||
|
|
||||||
def schedule(self, timer_seconds, timer_function):
|
def schedule(self, timer_seconds, timer_function):
|
||||||
self.scheduler.enter(timer_seconds, 1, self._run_scheduled_func,(timer_seconds, timer_function))
|
self.scheduler.enter(timer_seconds, 1, self._run_scheduled_func,(timer_seconds, timer_function))
|
||||||
if not self.scheduler_thread.isAlive():
|
if not self.scheduler_thread.is_alive():
|
||||||
self.scheduler_thread.start()
|
self.scheduler_thread.start()
|
||||||
|
|
||||||
def wait_until_ready(self):
|
def wait_until_ready(self):
|
||||||
@@ -169,7 +184,7 @@ class EcoVacsIOTMQ(ClientMQTT):
|
|||||||
|
|
||||||
def _ctl_to_dict_api(self, action, xmlstring):
|
def _ctl_to_dict_api(self, action, xmlstring):
|
||||||
xml = ET.fromstring(xmlstring)
|
xml = ET.fromstring(xmlstring)
|
||||||
xmlchild = xml.getchildren()
|
xmlchild = list(xml)
|
||||||
if len(xmlchild) > 0:
|
if len(xmlchild) > 0:
|
||||||
result = xmlchild[0].attrib.copy()
|
result = xmlchild[0].attrib.copy()
|
||||||
#Fix for difference in XMPP vs API response
|
#Fix for difference in XMPP vs API response
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import logging
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
#sucks
|
#sucks
|
||||||
from . import sucksbumper
|
from . import sucks
|
||||||
|
|
||||||
from homeassistant.components.vacuum import VacuumEntity, VacuumEntityFeature
|
from homeassistant.components.vacuum import VacuumEntity, VacuumEntityFeature
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@@ -38,7 +38,7 @@ def setup_platform(
|
|||||||
class EcovacsVacuum(VacuumEntity):
|
class EcovacsVacuum(VacuumEntity):
|
||||||
"""Ecovacs Vacuums such as Deebot."""
|
"""Ecovacs Vacuums such as Deebot."""
|
||||||
|
|
||||||
_attr_fan_speed_list = [sucksbumper.FAN_SPEED_NORMAL, sucksbumper.FAN_SPEED_HIGH]
|
_attr_fan_speed_list = [sucks.FAN_SPEED_NORMAL, sucks.FAN_SPEED_HIGH]
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
_attr_supported_features = (
|
_attr_supported_features = (
|
||||||
VacuumEntityFeature.BATTERY
|
VacuumEntityFeature.BATTERY
|
||||||
@@ -53,7 +53,7 @@ class EcovacsVacuum(VacuumEntity):
|
|||||||
| VacuumEntityFeature.FAN_SPEED
|
| VacuumEntityFeature.FAN_SPEED
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, device: sucksbumper.VacBot) -> None:
|
def __init__(self, device: sucks.VacBot) -> None:
|
||||||
"""Initialize the Ecovacs Vacuum."""
|
"""Initialize the Ecovacs Vacuum."""
|
||||||
self.device = device
|
self.device = device
|
||||||
self.device.connect_and_wait_until_ready()
|
self.device.connect_and_wait_until_ready()
|
||||||
@@ -112,7 +112,7 @@ class EcovacsVacuum(VacuumEntity):
|
|||||||
def return_to_base(self, **kwargs: Any) -> None:
|
def return_to_base(self, **kwargs: Any) -> None:
|
||||||
"""Set the vacuum cleaner to return to the dock."""
|
"""Set the vacuum cleaner to return to the dock."""
|
||||||
|
|
||||||
self.device.run(sucksbumper.Charge())
|
self.device.run(sucks.Charge())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def battery_icon(self) -> str:
|
def battery_icon(self) -> str:
|
||||||
@@ -137,7 +137,7 @@ class EcovacsVacuum(VacuumEntity):
|
|||||||
def turn_on(self, **kwargs: Any) -> None:
|
def turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the vacuum on and start cleaning."""
|
"""Turn the vacuum on and start cleaning."""
|
||||||
|
|
||||||
self.device.run(sucksbumper.Clean())
|
self.device.run(sucks.Clean())
|
||||||
|
|
||||||
def turn_off(self, **kwargs: Any) -> None:
|
def turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the vacuum off stopping the cleaning and returning home."""
|
"""Turn the vacuum off stopping the cleaning and returning home."""
|
||||||
@@ -146,23 +146,23 @@ class EcovacsVacuum(VacuumEntity):
|
|||||||
def stop(self, **kwargs: Any) -> None:
|
def stop(self, **kwargs: Any) -> None:
|
||||||
"""Stop the vacuum cleaner."""
|
"""Stop the vacuum cleaner."""
|
||||||
|
|
||||||
self.device.run(sucksbumper.Stop())
|
self.device.run(sucks.Stop())
|
||||||
|
|
||||||
def clean_spot(self, **kwargs: Any) -> None:
|
def clean_spot(self, **kwargs: Any) -> None:
|
||||||
"""Perform a spot clean-up."""
|
"""Perform a spot clean-up."""
|
||||||
|
|
||||||
self.device.run(sucksbumper.Spot())
|
self.device.run(sucks.Spot())
|
||||||
|
|
||||||
def locate(self, **kwargs: Any) -> None:
|
def locate(self, **kwargs: Any) -> None:
|
||||||
"""Locate the vacuum cleaner."""
|
"""Locate the vacuum cleaner."""
|
||||||
|
|
||||||
self.device.run(sucksbumper.PlaySound())
|
self.device.run(sucks.PlaySound())
|
||||||
|
|
||||||
def set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
|
def set_fan_speed(self, fan_speed: str, **kwargs: Any) -> None:
|
||||||
"""Set fan speed."""
|
"""Set fan speed."""
|
||||||
if self.is_on:
|
if self.is_on:
|
||||||
|
|
||||||
self.device.run(sucksbumper.Clean(mode=self.device.clean_status, speed=fan_speed))
|
self.device.run(sucks.Clean(mode=self.device.clean_status, speed=fan_speed))
|
||||||
|
|
||||||
def send_command(
|
def send_command(
|
||||||
self,
|
self,
|
||||||
@@ -171,7 +171,7 @@ class EcovacsVacuum(VacuumEntity):
|
|||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Send a command to a vacuum cleaner."""
|
"""Send a command to a vacuum cleaner."""
|
||||||
self.device.run(sucksbumper.VacBotCommand(command, params))
|
self.device.run(sucks.VacBotCommand(command, params))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self) -> dict[str, Any]:
|
def extra_state_attributes(self) -> dict[str, Any]:
|
||||||
|
|||||||
Reference in New Issue
Block a user