Virtual Switch for Bluebot Xboost Vacuum cleaner

Hey guys,

I’m trying to create a virtual on/off switch for my Blaupunkt Bluebot Xboost vacuum cleaner that should turn the vacuum to smart cleaning with on and return to dock with off (and detect it being in the dock when it goes back to the dock after cleaning so it turns the switch to off when it is in the dock).

The vacuum runs on Tuya and I have Tuya connected, but somehow when I turn on the switch and the vacuum starts cleaning, I end up with a switch that turn back to off, so I am unable to make it turn back to the dock with it.

My guess is that there are problems with the sensor/value_template.

the config I have so farfor this in configuration.yaml:

switch:
  - platform: template
    switches:
      bluebot_vacuum:
        friendly_name: Bluebot Xboost Switch
        value_template: "{{ is_state('sensor.bluebot_xboost_cleaning_area', '0') }}"
        turn_on:
          service: vacuum.start
          target:
            entity_id: vacuum.bluebot_xboost
        turn_off:
          service: vacuum.return_to_base
          target:
            entity_id: vacuum.bluebot_xboost

The entities I can use from the vacuum are the following:

select.bluebot_xboost_mode (BLUEBOT XBOOST Mode, keeps track of the mode the vacuum are in. Tried it with this sensor and instead of on, smart, because that is the state it uses when it is on smart vacuum cleaning mode, but no success)

sensor.bluebot_xboost_cleaning_area (BLUEBOT XBOOST Cleaning Area, which keeps track of the cleaning area in integers. tried to have the value template on 1 instead of on or 0 but that doesn’t make a difference either and the area is increasing so it doesn’t stay on 1)

sensor.bluebot_xboost_cleaning_time (BLUEBOT XBOOST Cleaning Time, which keeps track of the cleaning time in integers, but that too just as the cleaning area increases in value off course and changing the value to 0 or more instead of on doesn’t seem to make a difference either)

switch.bluebot_vacuum (created by the configuration, but having that tracking value to on doesn’t matter as it turns it off straigh after pressing it on the dashboard)

switch.bluebot_xboost_voice (BLUEBOT XBOOST Voice, is for toggle between silent mode and verbal mode, so that is of no use)

vacuum.bluebot_xboost (BLUEBOT XBOOST, keeps track of the stats of the device and also let’s you turn it on/off and returns things like docked, but that too is something that somehow cannot be used, or at least I can’t seem to find out how to use it to get the switch status be correct)

Any hulp is appreciated with this :slight_smile:

The goal of this all is to have it in my emulated hue so I can turn it on/off from my Logitech Harmony remote like I do with my Tuya powered lights and plugs.

seems I finally figured it out myself after several days of working on this :slight_smile:

the actual working code wasn’t far off… what I needed was use the vauum.bluebot_xboost as sensor and the on state is not smart (which the actual state it from the select entity) or on like it suspected it to be, but idle. weirdly enough when it is cleaning it goes to idle and when it is charging it is docked.

# Bluebot Switch
switch:
  - platform: template
    switches:
      bluebot_vacuum:
        friendly_name: Bluebot Xboost Switch
        value_template: "{{ is_state('vacuum.bluebot_xboost', 'idle') }}"
        turn_on:
          service: vacuum.start
          target:
            entity_id: vacuum.bluebot_xboost
        turn_off:
          service: vacuum.return_to_base
          target:
            entity_id: vacuum.bluebot_xboost