Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced UI with two DeeBots #234

Open
be1er opened this issue Jun 19, 2023 · 5 comments
Open

Advanced UI with two DeeBots #234

be1er opened this issue Jun 19, 2023 · 5 comments

Comments

@be1er
Copy link

be1er commented Jun 19, 2023

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
Copy link

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
Copy link
Contributor

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
Copy link

willow999 commented Oct 16, 2023

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

  • queue
  • vacuum_bot
    to the scripts from the dashboard.

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

  • vacuum_room
  • vacuum_service
    the entity of the robot is defined also. How can I make these parts generic?
    Of course I could simple create 2 more templates "vacuum_room_2" and "vacuum_service_2". But surely there are better options than this, right? :)

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
Copy link
Contributor

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
Copy link

willow999 commented Oct 16, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants