benct / lovelace-xiaomi-vacuum-card

Simple card for various robot vacuums in Home Assistant's Lovelace UI
MIT License
264 stars 37 forks source link

2021.11.0 Beta Breaks Card - Doesn't Show Sensors #84

Closed julianrinaldi closed 3 years ago

julianrinaldi commented 3 years ago

In 2021.11.0 Beta, the sensors for the Xiaomi vacuum card have changed, due to the addition of the new non-primary/diagnostic entities. I figure this is already known, but I figured I'd make an issue for it.

jscherry commented 3 years ago

Same problem after installing 2021.11 beta all versions. Attributes are now sensors I believe.

pedrolamas commented 3 years ago

Confirming issue on latest version of Home Assistant 2021.11, as part of the breaking changes (check the "Xiaomi Miio" changes, seems the attributes are now separate sensors)

bellini666 commented 3 years ago

Was coming here to say that :)

mcavarano commented 3 years ago

Additionally for anyone who didn't read the breaking changes the sensors that are now missing for this card are disabled by default so you will need to manually enable them. Hopefully this is a simple fix to get the card functional again

kimme1024 commented 3 years ago

Additionally for anyone who didn't read the breaking changes the sensors that are now missing for this card are disabled by default so you will need to manually enable them. Hopefully this is a simple fix to get the card functional again

sadly it isn't... also enabling them and renaming them under attributes when configuring the card doesn't help. waiting for a solution for this as well...

pedrolamas commented 3 years ago

Not ideal, but I found a way to get it back working (though I don't expect this to be 100%) by using a template vacuum:

In the above I am using the vacuum.roborock_vacuum_s6 and all new sensors around it to create a vacuum.roborock_vacuum_s6_fix:

vacuum:
  - platform: template
    vacuums:
      roborock_vacuum_s6_fix:
        friendly_name: Limpinho
        value_template: >-
          {{ states('vacuum.roborock_vacuum_s6') }}
        battery_level_template: >-
          {{ state_attr('vacuum.roborock_vacuum_s6', 'battery_level') }}
        fan_speed_template: >-
          {{ state_attr('vacuum.roborock_vacuum_s6', 'fan_speed') }}
        attribute_templates:
          main_brush_left: >-
            {{ int(states('sensor.roborock_vacuum_s6_main_brush_left') | int / 3600) }}
          side_brush_left: >-
            {{ int(states('sensor.roborock_vacuum_s6_side_brush_left') | int / 3600) }}
          filter_left: >-
            {{ int(states('sensor.roborock_vacuum_s6_filter_left') | int / 3600) }}
          sensor_dirty_left: >-
            {{ int(states('sensor.roborock_vacuum_s6_sensor_dirty_left') | int / 3600) }}
          status: >-
            {{ state_attr('vacuum.roborock_vacuum_s6', 'status') }}
        fan_speeds: ["Silent", "Standard", "Medium", "Turbo", "Gentle", "Auto"]
        start:
          - service: vacuum.start
            target:
              entity_id: vacuum.roborock_vacuum_s6
        pause:
          - service: vacuum.pause
            target:
              entity_id: vacuum.roborock_vacuum_s6
        stop:
          - service: vacuum.stop
            target:
              entity_id: vacuum.roborock_vacuum_s6
        return_to_base:
          - service: vacuum.return_to_base
            target:
              entity_id: vacuum.roborock_vacuum_s6
        clean_spot:
          - service: vacuum.clean_spot
            target:
              entity_id: vacuum.roborock_vacuum_s6
        locate:
          - service: vacuum.locate
            target:
              entity_id: vacuum.roborock_vacuum_s6
        set_fan_speed:
          - service: vacuum.set_fan_speed
            target:
              entity_id: vacuum.roborock_vacuum_s6

This is not an ideal solution, and the best way going forward is to change the plugin to support the new way of working!

julianrinaldi commented 3 years ago

Dammit. I have 6 Roborock S6. That’s going to be a lot of clicking to enable those entities.

Sent from my iPhone

On Nov 4, 2021, at 3:04 PM, kimme1024 @.***> wrote:

 Additionally for anyone who didn't read the breaking changes the sensors that are now missing for this card are disabled by default so you will need to manually enable them. Hopefully this is a simple fix to get the card functional again

sadly it isn't... also enabling them and renaming them under attributes when configuring the card doesn't help. waiting for a solution for this as well...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

bellini666 commented 3 years ago

Not ideal, but I found a way to get it back working (though I don't expect this to be 100%) by using a template vacuum:

In the above I am using the vacuum.roborock_vacuum_s6 and all new sensors around it to create a vacuum.roborock_vacuum_s6_fix:

vacuum:
  - platform: template
    vacuums:
      roborock_vacuum_s6_fix:
        friendly_name: Limpinho
        value_template: >-
          {{ states('vacuum.roborock_vacuum_s6') }}
        battery_level_template: >-
          {{ state_attr('vacuum.roborock_vacuum_s6', 'battery_level') }}
        fan_speed_template: >-
          {{ state_attr('vacuum.roborock_vacuum_s6', 'fan_speed') }}
        attribute_templates:
          main_brush_left: >-
            {{ int(states('sensor.roborock_vacuum_s6_main_brush_left') | int / 3600) }}
          side_brush_left: >-
            {{ int(states('sensor.roborock_vacuum_s6_side_brush_left') | int / 3600) }}
          filter_left: >-
            {{ int(states('sensor.roborock_vacuum_s6_filter_left') | int / 3600) }}
          sensor_dirty_left: >-
            {{ int(states('sensor.roborock_vacuum_s6_sensor_dirty_left') | int / 3600) }}
          status: >-
            {{ state_attr('vacuum.roborock_vacuum_s6', 'status') }}
        fan_speeds: ["Silent", "Standard", "Medium", "Turbo", "Gentle", "Auto"]
        start:
          - service: vacuum.start
            target:
              entity_id: vacuum.roborock_vacuum_s6
        pause:
          - service: vacuum.pause
            target:
              entity_id: vacuum.roborock_vacuum_s6
        stop:
          - service: vacuum.stop
            target:
              entity_id: vacuum.roborock_vacuum_s6
        return_to_base:
          - service: vacuum.return_to_base
            target:
              entity_id: vacuum.roborock_vacuum_s6
        clean_spot:
          - service: vacuum.clean_spot
            target:
              entity_id: vacuum.roborock_vacuum_s6
        locate:
          - service: vacuum.locate
            target:
              entity_id: vacuum.roborock_vacuum_s6
        set_fan_speed:
          - service: vacuum.set_fan_speed
            target:
              entity_id: vacuum.roborock_vacuum_s6

This is not an ideal solution, and the best way going forward is to change the plugin to support the new way of working!

Yeah, sounds like a nice workaround but still the fix on the plugin is the way to go!

Lets wait for @benct :)

zeridon commented 3 years ago

Pull request that broke stuff: https://github.com/home-assistant/core/pull/54990

zeridon commented 3 years ago

note that also buttons are now missing due to ha-icon-button no longer using icon

FIX:

diff --git a/homeassistant-config/www/xiaomi-vacuum-card.js b/homeassistant-config/www/xiaomi-vacuum-card.js
index 25d6aae..d72ba29 100644
--- a/homeassistant-config/www/xiaomi-vacuum-card.js
+++ b/homeassistant-config/www/xiaomi-vacuum-card.js
@@ -306,9 +306,8 @@
             return data && data.show !== false
                 ? html`<ha-icon-button
                     @click="${() => this.callService(data.service, data.service_data)}"
-                    icon="${data.icon}"
                     title="${data.label || ''}"
-                    style="${this.config.styles.icon}"></ha-icon-button>`
+                    style="${this.config.styles.icon}"><ha-icon style="display:flex;" icon="${data.icon}"></ha-icon></ha-icon-button>`
                 : null;
         }
pannal commented 3 years ago

Yep, definitely broken. Thanks to all of you who hotfixed this with workarounds. Author needs to incorporate the new breaking changes, though :)

benct commented 3 years ago

Should be fixed in version 4.4.0, at least for Xiaomi vacuums (remember to clear browser cache after update)

znanywawa commented 3 years ago

Looks like counters for xiaomi are still not working (or there is an issue with Roborock S7): image

Any idea?

Tamsy commented 3 years ago

Updated to 4.4.0 through HACS on core-2021.11.1, supervisor-2021.10.8. Activated all deactivated referring entities through Settings --> Integrations --> Xiaomi Miio. Browser cache cleared.

But: roborocks5u

The entities are showing through "Devices" on HA though: roborocks5u-diag

I have 2 Roborock S5 Max devices (2 storey house, one device for each floor). Both are showing the same like the pictures above.

zeridon commented 3 years ago

add vendor: xiaomi to the card config in order to use the new processing of entities

znanywawa commented 3 years ago

Alredy have added vendor, below is my card config: image

So it doesnt help either.

StWiesi commented 3 years ago

Alredy have added vendor, below is my card config: image

So it doesnt help either.

worked for me. Have you re-enabled all the required entities that were disabled by HA by default after the update?

znanywawa commented 3 years ago

Alredy have added vendor, below is my card config: image So it doesnt help either.

worked for me. Have you re-enabled all the required entities that were disabled by HA by default after the update?

Yep, I do have all entities enabled (also, I have disabled and re-enabled them after card update): image

Mkay, I figured it out :) Name of entity for vacuum was: vacuum.roborock_vacuum_a15 But all other entities are: sensor.roborock_s7_XXX

So to fix it, it required to change entity of vacuum device and now card is working as expected (except mop and cleaned are status but I dont need them too much).

Tamsy commented 3 years ago

It's working now with both vacuums.

@znanywawa hint made the difference: "So to fix it, it required to change entity of vacuum device and now card is working as expected."

pedrolamas commented 3 years ago

Should be fixed in version 4.4.0, at least for Xiaomi vacuums (remember to clear browser cache after update)

Working fine here now, no need to use my "hack" anymore! Thank you for the prompt fix! 🙂

heisenberg2980 commented 3 years ago

The main card is working now, but the "Customize specific state values" is still not working for me, does anybody know if I can fix it?

        - type: custom:xiaomi-vacuum-card
          entity: vacuum.xiaomi_vacuum_cleaner
          image: /local/Floorplan_images/vacuum.png
          name: My Vacuum
          vendor: xiaomi
          buttons:
            spot:
              show: false
          state:
            cleaning_time:
              key: cleaning_time
              label: 'Cleaning time: '
              unit: ' min'
            cleaned_area:
              key: cleaned_area
              label: 'Cleaned area: '
              unit: ' m2'
          attributes:
            total_cleaning_time:
              key: total_cleaning_time
              label: 'Total time: '
              unit: ' min'
            total_cleaned_area:
              key: total_cleaned_area
              label: 'Total area: '
              unit: ' m2'

image

Bieniu82 commented 3 years ago

@znanywawa hint made the difference: "So to fix it, it required to change entity of vacuum device and now card is working as expected."

still doesn't work for me ... name of the entity is correct, sensors show up values in the entity list, however stay unavailable in the card itself

benct commented 3 years ago

If it still does not work, try the following:

wanti00 commented 3 years ago

following

heisenberg2980 commented 3 years ago

The main card is working now, but the "Customize specific state values" is still not working for me, does anybody know if I can fix it?

        - type: custom:xiaomi-vacuum-card
          entity: vacuum.xiaomi_vacuum_cleaner
          image: /local/Floorplan_images/vacuum.png
          name: My Vacuum
          vendor: xiaomi
          buttons:
            spot:
              show: false
          state:
            cleaning_time:
              key: cleaning_time
              label: 'Cleaning time: '
              unit: ' min'
            cleaned_area:
              key: cleaned_area
              label: 'Cleaned area: '
              unit: ' m2'
          attributes:
            total_cleaning_time:
              key: total_cleaning_time
              label: 'Total time: '
              unit: ' min'
            total_cleaned_area:
              key: total_cleaned_area
              label: 'Total area: '
              unit: ' m2'

image

@benct As this issue is closed, should I open a new one for this problem with customize state values?

heisenberg2980 commented 3 years ago

Answering my own question, the issue was the name of the entities, I have updated them and it is showing the correct numbers (I just need to figure out if it is possible to change from seconds to minutes or hours, but that is a different issue...):

        - type: custom:xiaomi-vacuum-card
          entity: vacuum.xiaomi_vacuum_cleaner
          image: /local/Floorplan_images/vacuum.png
          name: My Vacuum
          vendor: xiaomi
          buttons:
            spot:
              show: false
          state:
            cleaning_time:
              key: last_clean_duration
              label: 'Last clean duration: '
              unit: ' s'
            cleaned_area:
              key: last_clean_area
              label: 'Last clean area: '
              unit: ' m2'
          attributes:
            total_cleaning_time:
              key: total_duration
              label: 'Total time: '
              unit: ' s'
            total_cleaned_area:
              key: total_clean_area
              label: 'Total area: '
              unit: ' m2'

image