diff --git a/neato/__init__.py b/neato/__init__.py index bc4057bd8..c3a3d2db7 100755 --- a/neato/__init__.py +++ b/neato/__init__.py @@ -140,6 +140,9 @@ def start_robot(self, boundary_id=None, map_id=None): response = self.robot.robot_command("start", boundary_id, map_id) return self.check_command_response(response) + def get_known_mapId(self): + self.logger.warning(f"Debug: MapID is {self.robot.mapId}") + return self.robot.mapId # returns boundaryIds (clean zones) for given mapID # returns True on success and False otherwise @@ -151,7 +154,6 @@ def dismiss_current_alert(self): response = self.robot.robot_command("dismiss_current_alert") return self.check_command_response(response) - # enable cleaning schedule # returns True on success and False otherwise def enable_schedule(self): diff --git a/neato/assets/webif2.jpg b/neato/assets/webif2.jpg new file mode 100644 index 000000000..9611a32d7 Binary files /dev/null and b/neato/assets/webif2.jpg differ diff --git a/neato/plugin.yaml b/neato/plugin.yaml index 0d77baf71..c499cbe43 100755 --- a/neato/plugin.yaml +++ b/neato/plugin.yaml @@ -98,9 +98,53 @@ item_attributes: - command_startAvailable - clean_room -item_structs: NONE - # Definition of item-structure templates for this plugin (enter 'item_structs: NONE', if section should be empty) - #item_structs: NONE +item_structs: + Neato: + Name: + type: str + neato_attribute: 'name' + visu_acl: ro + State: + type: str + value: 'offline' + neato_attribute: 'state' + visu_acl: ro + StateAction: + type: str + neato_attribute: 'state_action' + visu_acl: ro + Command: + type: num + neato_attribute: 'command' + visu_acl: rw + IsDocked: + value: False + type: bool + neato_attribute: 'is_docked' + visu_acl: ro + IsScheduleEnabled: + value: False + type: bool + neato_attribute: 'is_schedule_enabled' + visu_acl: rw + IsCharging: + value: False + type: bool + neato_attribute: 'is_charging' + visu_acl: ro + ChargePercentage: + type: num + neato_attribute: 'charge_percentage' + visu_acl: ro + GoToBaseAvailable: + type: bool + value: False + neato_attribute: 'command_goToBaseAvailable' + visu_acl: ro + Alert: + type: str + neato_attribute: 'alert' + visu_acl: ro plugin_functions: enable_schedule: diff --git a/neato/robot.py b/neato/robot.py index ed68aa0df..d40f3d872 100755 --- a/neato/robot.py +++ b/neato/robot.py @@ -44,6 +44,7 @@ def __init__(self, email, password, vendor, token = ''): self.navigationMode = '' self.spotWidth = '' self.spotHeight = '' + self.mapId = 'unknown' # Meta self.name = "" @@ -158,13 +159,13 @@ def robot_command(self, command, arg1 = None, arg2 = None): self.logger.warning(f"Command returned {str(responseJson['result'])}: Retry starting with non-persistent-map") return self.robot_command(command = 'start_non-persistent-map') else: - self.logger.error("Sending command {command} failed. Result: {0}".format(str(responseJson['result']) )) - self.logger.error("Debug: send command response: {0}".format(start_cleaning_response.text)) + self.logger.error(f"Sending command {command} failed. Result: {str(responseJson['result'])}") + self.logger.error(f"Debug: send command response: {start_cleaning_response.text}") else: if 'message' in responseJson: - self.logger.error("Sending command {command} failed. Message: {0}".format(str(responseJson['message']))) + self.logger.error(f"Sending command {command} failed. Message: {str(responseJson['message'])}") if 'error' in responseJson: - self.logger.error("Sending command {command} failed. Error: {0}".format(str(responseJson['error']))) + self.logger.error(f"Sending command {command} failed. Error: {str(responseJson['error'])}") # - NOT on Charge BASE return start_cleaning_response @@ -286,6 +287,7 @@ def update_robot(self): self.navigationMode = response['cleaning']['navigationMode'] self.spotWidth = response['cleaning']['spotWidth'] self.spotHeight = response['cleaning']['spotHeight'] + self.mapId = response['cleaning']['mapId'] return response diff --git a/neato/user_doc.rst b/neato/user_doc.rst index e15714cfe..ccd0a315f 100755 --- a/neato/user_doc.rst +++ b/neato/user_doc.rst @@ -21,21 +21,102 @@ Die Informationen zur Konfiguration des Plugins sind unter :doc:`/plugins_doc/co Anforderungen ============= -- locale en_US.utf8 must be installed (sudo dpkg-reconfigure locales) - -Supported Hardware -================== - -=============== ========= ====== -Robot Supported Tested -=============== ========= ====== -Neato Botvac D3 yes no -Neato Botvac D4 yes no -Neato Botvac D5 yes yes -Neato Botvac D6 yes no -Neato Botvac D7 yes no -Vorwerk VR300 yes yes -=============== ========= ====== +1) Es muss auf dem SmarthomeNG Rechcner en_US.utf8 installiert sein (sudo dpkg-reconfigure locales) + +Unterstützte Hardware +===================== + +=============== ============= ========== +Roboter Unterstützt Getestet +=============== ============= ========== +Neato Botvac D3 ja nein +Neato Botvac D4 ja nein +Neato Botvac D5 ja ja +Neato Botvac D6 ja nein +Neato Botvac D7 ja nein +Vorwerk VR300 ja ja +=============== ============= ========== + + +Unterstützte Plugin Attribute +============================= + +Folgende Item Attribute (neato_attribute) werden vom Plugin unterstützt: + +=================== ========= ===================== +Attribut Itemtyp Lesend/Schreibend +=================== ========= ===================== +name str r +state str r +state_action str r +command num w +is_docked bool r +is_schedule_enabled bool r +is_charging bool r +charge_percentage num r +command_goToBaseAvailable bool r +alert str r +clean_room str w +=================== ========= ===================== + + + +Roboter Status +============== + +Das String Item für den Roboterstatus (state) kann folgende Zustände einnehmen: + +===================== +Roboterstatus (state) +===================== +invalid +invalid +idle +busy +paused +error +=============== + +Das Num Item für den Roboterzustand (state_action) kann folgende Zustände einnehmen: + +============================= ========= +Roboterzustand (state_action) dezimal +============================= ========= +Invalid 0 +House Cleaning 1 +Spot Cleaning 2 +Manual Cleaning 3 +Docking 4 +User Menu Active 5 +Suspended Cleaning 6 +Updating 7 +Copying Logs 8 +Recovering Location 9 +IEC Test 10 +Map cleaning 11 +Exploring map (creating a persistent map) 12 +Acquiring Persistent Map IDs 13 +Creating & Uploading Map 14 +Suspended Exploration 15 +============================= ========= + +Roboter Befehle +=============== + +Das Num Item für die Roboterbefehle (command) kann folgende Zustände einnehmen: + +============================= ========= +Befehl (command) dezimal +============================= ========= +Start cleaning 61 +Stop cleaning 62 +Pause cleaning 63 +Resume cleaning 64 +Find the robot 65 +Send to base 66 +Enable schedule 67 +Disable schedule 68 +============================= ========= Web Interface @@ -70,26 +151,42 @@ Im ersten Tab Vorwerk OAuth2 findet sich direkt die Schritt für Schritt Anleitu .. image:: assets/webif1.jpg :class: screenshot -Changelog +Im zweiten Tab Einstellungen findet sich zwei Optionen zum Löschen von gemeldeten Alarmmeldungen (z.B. Roboter Behälter leeren) und zum Auslesen aller bekannter RaumIDs (BoundardyIDs) zur +Einzelraumreinigung. Die bekannten Räume werden dazu in das Plugin Logfile geschrieben. Übergeben werden muss hierzu die Vorwerk MapID. Hierzu einmal manuell eine Einzelraumreinigung via Vorwerk/Neato +App anstoßen. Das Plugin extrahiert anschließend automatisch den Namen der MapID und schlägt diese als Eingabe im Eingabefeld des Webinterfaces vor. + +.. image:: assets/webif2.jpg + :class: screenshot + + +SmartVisu +========= + +Beispiele --------- -V1.6.8 added decoding of command availability status, e.g. "start" command available - If start command with persistent map is rejected due to "not_on_charge_base" error, retry start with non-persistent map. -V1.6.6 added option to clear errors/alarms in neato/vorwerk backend via plugin's webif +Beispiele für Integrationen in smartVisu: + +.. code-block:: html + +
{{ basic.button('RobotButton_Start', 'Neato.Robot.Command', 'Start', '', '61', 'midi') }}
+{{ basic.button('RobotButton_Stop', 'Neato.Robot.Command', 'Stop', '', '62', 'midi') }}
+{{ basic.button('RobotButton_Pause', 'Neato.Robot.Command', 'Pause', '', '63', 'midi') }}
+{{ basic.button('RobotButton_Resume', 'Neato.Robot.Command', 'Resume', '', '64', 'midi') }}
+{{ basic.button('RobotButton_Find', 'Neato.Robot.Command', 'Find', '', '65', 'midi') }}
-V1.6.5 added new function start_robot(boundary_id=None, map_id=None) to enable single room cleaning - added new function get_map_boundaries_robot(map_id=None) to request available map boundaries (rooms) for a given map - added new function dismiss_current_alert() to reset current alerts +Name: {{ basic.value('RobotName', 'Neato.Robot.Name') }}
+ /** Get the robots name (str)*/ -V 1.6.4 fixed readout for docking state and go to base availability - combined all neato attribues into one +Cleaning status: {{ basic.value('RobotState', 'Neato.Robot.State') }}
+ /** Get the robots cleaning status (str) */ -V 1.6.3 changed attribute charge_percentage from string to integer - added alert text output, e.g. dustbin full - Write obtained OAuth2 token obtained via web interface directly to config plugin.yaml +Cleaning status action: {{ basic.value('RobotStateAction', 'Neato.Robot.StateAction') }}
+ /** Get the robots cleaning status action (str). Only when it's busy */ -V 1.6.2 Added webinterface +Docking status: {{ basic.value('RobotDockingStatus', 'Neato.Robot.IsDocked') }}
+ /** Get the robots docking status (bool) */ -V 1.6.1 Added new Vorwerk Oauth2 based authentication feature (compatible with myKobold APP) +Battery status: {{ basic.value('RobotBatteryState', 'Neato.Robot.ChargePercentage') }}
+ /** Get the robots battery charge status (num) */ -V 1.6.0 Initial working version diff --git a/neato/webif/templates/index.html b/neato/webif/templates/index.html index 564762495..552e2b38a 100755 --- a/neato/webif/templates/index.html +++ b/neato/webif/templates/index.html @@ -340,9 +340,9 @@ {{ _('Verfuegbare Boundary IDs (Raeume) ins Log schreiben') }}