template: - vacuum: - unique_id: kabum500 start: - action: script.kabum500_start pause: - entity_id: - switch.kabum500_power_go action: switch.turn_off stop: - data: entity_id: input_select.kabum500_mode option: Em Espera action: input_select.select_option return_to_base: - data: entity_id: input_select.kabum500_mode option: Retornar action: input_select.select_option locate: - action: script.kabum500_locate set_fan_speed: - data_template: entity_id: input_select.kabum500_suction option: '{{ fan_speed }}' action: input_select.select_option fan_speeds: - Mínimo - Médio - Máximo default_entity_id: vacuum.kabum500 attributes: status: '{{ states(''sensor.kabum500_state_ptbr'') }}' name: KaBuM! Smart 500 battery_level: '{{ states(''sensor.kabum500_battery'') }}' fan_speed: '{{ states(''input_select.kabum500_suction'') }}' state: '{{ states(''sensor.kabum500_state'') }}' mqtt: sensor: - unique_id: kabum500_state name: "KaBuM500 State" state_topic: tele/kabum500/RESULT value_template: > {% if value_json['TuyaReceived'].DpType4Id28 is defined %} {% set value = value_json.TuyaReceived['28'].DpIdData %} {% if value == "00" %} idle {% elif value == "01" %} cleaning {% elif value == "02" %} error {% elif value == "03" %} idle {% elif value == "04" %} idle {% elif value == "05" %} docked {% elif value == "06" %} docked {% elif value == "07" %} paused {% elif value == "08" %} cleaning {% elif value == "09" %} cleaning {% elif value == "0A" %} returning {% endif %} {% else %} {{ states('sensor.kabum500_state') }} {% endif %} - unique_id: kabum500_state_ptbr name: "KaBuM500 State ptbr" state_topic: tele/kabum500/RESULT value_template: > {% if value_json['TuyaReceived'].DpType4Id28 is defined %} {% set value = value_json.TuyaReceived['28'].DpIdData %} {% if value == "00" %} Em Espera {% elif value == "01" %} Trabalhando {% elif value == "02" %} Erro {% elif value == "03" %} Dormindo {% elif value == "04" %} Trabalho Finalizado {% elif value == "05" %} Recarregando {% elif value == "06" %} Recarga Completa {% elif value == "07" %} Pausado {% elif value == "08" %} Aspirando {% elif value == "09" %} Passando Pano {% elif value == "0A" %} Retornando {% endif %} {% else %} {{ states('sensor.kabum500_state_ptbr') }} {% endif %} - unique_id: kabum500_suction_speed name: "KaBuM500 Suction Speed" state_topic: tele/kabum500/RESULT value_template: > {% if value_json['TuyaReceived'].DpType4Id30 is defined %} {% set value = value_json.TuyaReceived['30'].DpIdData %} {% if value == "00" %} Mínimo {% elif value == "01" %} Médio {% elif value == "02" %} Máximo {% endif %} {% else %} {{ states('sensor.kabum500_suction_speed') }} {% endif %} - unique_id: kabum500_battery name: "KaBuM500 Battery" state_topic: tele/kabum500/RESULT device_class: battery unit_of_measurement: '%' value_template: > {% if value_json['TuyaReceived'].DpType2Id14 is defined %} {{ value_json['TuyaReceived'].DpType2Id14 | int(0) }} {% elif is_number(states('sensor.kabum500_battery')) %} {{ states('sensor.kabum500_battery') | int(0) }} {% else %} 0 {% endif %} - unique_id: kabum500_area name: "KaBuM500 Area" state_topic: tele/kabum500/RESULT value_template: > {% if value_json['TuyaReceived'].DpType2Id32 is defined %} {{ value_json['TuyaReceived'].DpType2Id32 | int(0) }} {% elif is_number(states('sensor.kabum500_area')) %} {{ states('sensor.kabum500_area') | int(0) }} {% else %} 0 {% endif %} - unique_id: kabum500_time name: "KaBuM500 Time" state_topic: tele/kabum500/RESULT value_template: > {% if value_json['TuyaReceived'].DpType2Id33 is defined %} {{ value_json['TuyaReceived'].DpType2Id33 | int(0) }} {% elif is_number(states('sensor.kabum500_time')) %} {{ states('sensor.kabum500_time') | int(0) }} {% else %} 0 {% endif %} - unique_id: kabum500_error name: "KaBuM500 Error" state_topic: tele/kabum500/RESULT value_template: > {% if value_json['TuyaReceived'].DpType5Id11 is defined %} {% set value = value_json.TuyaReceived['11'].DpIdData %} {% if value == "00" %} Sem erro {% elif value == "01" %} Roda enroscada {% elif value == "04" %} ??? 04 {% elif value == "08" %} Robô fora do chão {% elif value == "10" %} Robô fora do chão {% elif value == "20" %} Aspirador entupido {% elif value == "40" %} ??? 40 {% elif value == "0200" %} Coletor de poeira não instalado {% elif value == "8000" %} Mova o robô para uma área aberta {% elif value == "0800" %} Motor enroscado {% else %} {% set value = "Erro desconhecido: " ~ value %} {{ value }} {% endif %} {% elif states('sensor.kabum500_error') == "unknown" %} Sem erro {% else %} {{ states('sensor.kabum500_error') }} {% endif %} switch: - unique_id: kabum500_sleep_wake name: "KaBuM500 Sleep" icon: mdi:robot-vacuum state_topic: tele/kabum500/RESULT command_topic: cmnd/kabum500/TuyaSend1 value_template: > {% if value_json['TuyaReceived'].DpType1Id1 is defined %} {% if value_json['TuyaReceived'].DpType1Id1 == 0 %} OFF {% else %} ON {% endif %} {% else %} {{ states('switch.kabum500_sleep_wake') }} {% endif %} payload_on: "1,1" payload_off: "1,0" state_on: "ON" state_off: "OFF" qos: 1 retain: false - unique_id: kabum500_power_go name: "KaBuM500 Power go" icon: mdi:robot-vacuum state_topic: tele/kabum500/RESULT command_topic: cmnd/kabum500/TuyaSend1 value_template: > {% if value_json['TuyaReceived'].DpType1Id25 is defined %} {% if value_json['TuyaReceived'].DpType1Id25 == 0 %} OFF {% else %} ON {% endif %} {% else %} {{ states('switch.kabum500_power_go') }} {% endif %} payload_on: "25,1" payload_off: "25,0" state_on: "ON" # Start state_off: "OFF" # Pause qos: 1 retain: false - unique_id: kabum500_mute name: "KaBuM500 Mute" icon: mdi:robot-vacuum state_topic: tele/kabum500/RESULT command_topic: cmnd/kabum500/TuyaSend1 value_template: > {% if value_json['TuyaReceived'].DpType1Id31 is defined %} {% if value_json['TuyaReceived'].DpType1Id31 == 0 %} OFF {% else %} ON {% endif %} {% else %} {{ states('switch.kabum500_mute') }} {% endif %} payload_on: "31,1" payload_off: "31,0" state_on: "ON" state_off: "OFF" qos: 1 retain: false input_select: kabum500_mode: name: KaBuM500 Modes initial: "Em Espera" options: - "Em Espera" - "Inteligente" - "Espiral" - "Single" - "Cantos" - "Retornar" kabum500_user_mode: name: KaBuM500 User Modes initial: "Inteligente" options: - "Inteligente" - "Espiral" - "Single" - "Cantos" kabum500_suction: name: KaBuM500 suction initial: "Médio" options: - "Mínimo" - "Médio" - "Máximo" script: kabum500_start: sequence: - service: input_select.select_option data: entity_id: input_select.kabum500_mode option: "Inteligente" - service: switch.turn_on entity_id: switch.kabum500_power_go #Front kabum500_dpid26_direction_front: sequence: - service: mqtt.publish data_template: topic: cmnd/kabum500/TuyaSend4 payload: 26,0 #Back kabum500_dpid26_direction_back: sequence: - service: mqtt.publish data_template: topic: cmnd/kabum500/TuyaSend4 payload: 26,1 #Turn Left kabum500_dpid26_direction_left: sequence: - service: mqtt.publish data_template: topic: cmnd/kabum500/TuyaSend4 payload: 26,2 #Turn Right kabum500_dpid26_direction_right: sequence: - service: mqtt.publish data_template: topic: cmnd/kabum500/TuyaSend4 payload: 26,3 #Stop kabum500_dpid26_direction_stop: sequence: - service: mqtt.publish data_template: topic: cmnd/kabum500/TuyaSend4 payload: 26,4 #Pause kabum500_dpid26_direction_pause: sequence: - service: mqtt.publish data_template: topic: cmnd/kabum500/TuyaSend1 payload: 25,0 #Resume kabum500_dpid26_direction_resume: sequence: - service: mqtt.publish data_template: topic: cmnd/kabum500/TuyaSend1 payload: 25,1 #Locate kabum500_locate: sequence: - service: mqtt.publish data_template: topic: cmnd/kabum500/TuyaSend1 payload: 29,1 kabum500_mute: sequence: - service: switch.toggle target: entity_id: switch.kabum500_mute automation: - alias: "KaBuM500 Send Working Mode" trigger: - platform: state entity_id: input_select.kabum500_mode action: - service: mqtt.publish data: topic: cmnd/kabum500/TuyaSend4 payload: > {% if is_state("input_select.kabum500_mode", "Em Espera") %} 27,0 {% elif is_state("input_select.kabum500_mode", "Inteligente") %} 27,1 {% elif is_state("input_select.kabum500_mode", "Espiral") %} 27,2 {% elif is_state("input_select.kabum500_mode", "Single") %} 27,3 {% elif is_state("input_select.kabum500_mode", "Cantos") %} 27,4 {% elif is_state("input_select.kabum500_mode", "Retornar") %} 27,5 {% endif %} - alias: "KaBuM500 Send Suction" trigger: - platform: state entity_id: input_select.kabum500_suction action: - service: mqtt.publish data: topic: cmnd/kabum500/TuyaSend4 payload: > {% if is_state("input_select.kabum500_suction", "Mínimo") %} 30,0 {% elif is_state("input_select.kabum500_suction", "Médio") %} 30,1 {% elif is_state("input_select.kabum500_suction", "Máximo") %} 30,2 {% endif %} - alias: "Translate User Mode to Working Mode" trigger: - platform: state entity_id: input_select.kabum500_user_mode action: - service: input_select.select_option target: entity_id: input_select.kabum500_mode data: option: "{{ states('input_select.kabum500_user_mode') }}"