DeebotUniverse / docs

https://deebot.readthedocs.io
GNU General Public License v3.0
33 stars 9 forks source link

Advanced UI with two DeeBots #234

Open be1er opened 1 year ago

be1er commented 1 year ago

Hello,

first of all: great work to provide this integration for Home Assistant!

We had a Deebot in use until the very end. I used this very intensively with the Advanced UI. After buying the second DeeBot a few weeks ago, this is no longer so easily possible. Is there a way to "overhaul" the Advanced UI to be used with multiple Deebots? In particular, the topic with the room queue is not really possible, since the script sections are probably not designed for the use of several Deebots.

Thanks in advance and best Ralph

willow999 commented 11 months ago

Hi, I am also interested in this. I have am no expert with these scripts etc. at all, looked at the code and could not find an easy way to add a second robot. It looks to me, the entire code somehow needs to be duplicated with seconds renamed.

second deebot integration would be highly appreciated (or some hints as to what I have to change and which parts could be re-used)

thanks!!

edenhaus commented 11 months ago

It is possible by creating separate variables per bot. This means some additional modification as the backend configuration needs to be created per bot.

willow999 commented 11 months ago

Last night, I started working on it. What I have managed so far is to make the script generic so that I can pass

what I am struggeling with is the Dashboard configuration itself. There are 2 parts: In the dashboard templates of

Ideal scenario would be to be able to select the robot in the UI and then based on the selection trigger everything else... is that possible?

edenhaus commented 11 months ago

Please open a PR with your changes, as everybody can profit from an example, which is working for multiple bots. Also I can give you feedback directly in the PR :)

willow999 commented 11 months ago

Uhm... I would be more than happy to do that, if only I knew how to and what a pull request actually is / does. I am not a software developer myself and frankly speaking dont even know the language of the HA-scripts etc. are written in. All I do is to derive the meaning of the code by "mentally debugging" it and make changes based on the syntax I see in the code. :)

What I have done is the following: https://deebot.readthedocs.io/integrations/home-assistant/examples/ui/advanced/ On this page here, I took the code for configuration.yaml and scripts.yaml and made a few adjustments. so rather than hard-coding the bot and the queue in the script itself, I took it out of the script and put the values in the code which calls the script (I believe hard-coding any values / entities in any code is mostly a mistake: Old script: deebot_clean: description: Start a deebot cleaning task variables: queue: input_text.deebot_susi_queue vacuum_bot: vacuum.susi New script: deebot_clean: fields: queue: description: the queue variable vacuum_bot: description: the vacuum bot entity

What I did then was to adjust the call from the Dashboard to hand over "vacuum_bot" and "queue": tap_action: action: call-service service: script.deebot_clean service_data: queue: input_text.deebot_robbi_2_queue vacuum_bot: vacuum.robbi_2 #=> this is what I now want to make dynamic, so instead of defining the vacuum_bot in the code, I would love to use an input helper or something similar

Where I am lost now is the Dashboard configuration, as I do not quite understand the concept of the template (I mean I do understand that the dashboard itself inherits the data etc. from the template, but I dont quite get how it is done :( For example: vacuum_service: color: var(--text-color) variables: lock_enabled: > [[[ return ['cleaning','paused'].includes(states['vacuum.robbi_2'].state) ]]] I could just copy the entire template and define "vacuum_service_2" for my second robot. But I hate redundant code :) a TEMPLATE should be generic enough (just like the script) to allow reusing it without any adjustment in the template itself. I have tried a couple of things in the dashboard, but failed making the necessary adjustments. My idea was to use an input_helper to define ["vacuum.bot_1", "vacuum.bot_2"], but I could not find a way to use the value of the input helper in the dashboard configuration to dynamically display the content based on which robot is "selected" via the input helper