Actualización módulos de hacs
This commit is contained in:
		| @@ -55,16 +55,16 @@ class XiaomiVacuumCard extends Polymer.Element { | ||||
|             </template> | ||||
|             <div class="content grid" style="[[contentStyle]]" on-click="moreInfo"> | ||||
|               <div class="grid-content grid-left"> | ||||
|                 <div>[[_config.labels.status]]: [[stateObj.attributes.status]]</div> | ||||
|                 <div>[[_config.labels.battery]]: [[stateObj.attributes.battery_level]] %</div> | ||||
|                 <div>[[_config.labels.mode]]: [[stateObj.attributes.fan_speed]]</div> | ||||
|                 <div>[[getValue('status')]]</div> | ||||
|                 <div>[[getValue('battery', ' %')]]</div> | ||||
|                 <div>[[getValue('mode')]]</div> | ||||
|               </div> | ||||
|               <template is="dom-if" if="{{showDetails}}"> | ||||
|                 <div class="grid-content grid-right" > | ||||
|                   <div>[[_config.labels.main_brush]]: [[stateObj.attributes.main_brush_left]] [[_config.labels.hours]]</div> | ||||
|                   <div>[[_config.labels.side_brush]]: [[stateObj.attributes.side_brush_left]] [[_config.labels.hours]]</div> | ||||
|                   <div>[[_config.labels.filter]]: [[stateObj.attributes.filter_left]] [[_config.labels.hours]]</div> | ||||
|                   <div>[[_config.labels.sensor]]: [[stateObj.attributes.sensor_dirty_left]] [[_config.labels.hours]]</div> | ||||
|                   <div>[[computeValue('main_brush')]]</div> | ||||
|                   <div>[[computeValue('side_brush')]]</div> | ||||
|                   <div>[[computeValue('filter')]]</div> | ||||
|                   <div>[[computeValue('sensor')]]</div> | ||||
|                 </div> | ||||
|               </template> | ||||
|             </div> | ||||
| @@ -165,11 +165,32 @@ class XiaomiVacuumCard extends Polymer.Element { | ||||
|             return: true, | ||||
|         }; | ||||
|  | ||||
|         const attributes = { | ||||
|             status: 'status', | ||||
|             battery: 'battery_level', | ||||
|             mode: 'fan_speed', | ||||
|             main_brush: 'main_brush_left', | ||||
|             side_brush: 'side_brush_left', | ||||
|             filter: 'filter_left', | ||||
|             sensor: 'sensor_dirty_left', | ||||
|         }; | ||||
|  | ||||
|         const vendors = { | ||||
|             xiaomi: { | ||||
|                 image: '/local/img/vacuum.png', | ||||
|                 details: true, | ||||
|             }, | ||||
|             valetudo: { | ||||
|                 image: '/local/img/vacuum.png', | ||||
|                 details: true, | ||||
|                 attributes: { | ||||
|                     status: 'state', | ||||
|                     main_brush: 'mainBrush', | ||||
|                     side_brush: 'sideBrush', | ||||
|                     filter: 'filter', | ||||
|                     sensor: 'sensor', | ||||
|                 }, | ||||
|             }, | ||||
|             ecovacs: { | ||||
|                 image: '/local/img/vacuum_ecovacs.png', | ||||
|                 details: false, | ||||
| @@ -182,6 +203,21 @@ class XiaomiVacuumCard extends Polymer.Element { | ||||
|                     pause: 'stop', | ||||
|                     stop: 'turn_off', | ||||
|                 }, | ||||
|             }, | ||||
|             deebot: { | ||||
|                 image: '/local/img/vacuum_ecovacs.png', | ||||
|                 details: true, | ||||
|                 service: { | ||||
|                     start: 'turn_on', | ||||
|                     pause: 'stop', | ||||
|                     stop: 'turn_off', | ||||
|                 }, | ||||
|                 attributes: { | ||||
|                     main_brush: 'component_main_brush', | ||||
|                     side_brush: 'component_side_brush', | ||||
|                     filter: 'component_filter', | ||||
|                 }, | ||||
|                 computeValue: v => Math.round(Number(v) / 100), | ||||
|             } | ||||
|         }; | ||||
|  | ||||
| @@ -196,8 +232,25 @@ class XiaomiVacuumCard extends Polymer.Element { | ||||
|  | ||||
|         config.service = Object.assign({}, services, vendor.service); | ||||
|         config.buttons = Object.assign({}, buttons, vendor.buttons, config.buttons); | ||||
|         config.attributes = Object.assign({}, attributes, vendor.attributes, config.attributes); | ||||
|         config.labels = Object.assign({}, labels, config.labels); | ||||
|  | ||||
|         this.getValue = (field, unit = '') => { | ||||
|             const value = (this.stateObj && config.attributes[field] in this.stateObj.attributes) | ||||
|                 ? this.stateObj.attributes[config.attributes[field]] + unit | ||||
|                 : (this._hass ? this._hass.localize('state.default.unavailable') : 'Unavailable'); | ||||
|             return `${config.labels[field]}: ${value}`; | ||||
|         }; | ||||
|  | ||||
|         this.computeValue = field => { | ||||
|             if (this.stateObj && config.attributes[field] in this.stateObj.attributes) { | ||||
|                 const value = this.stateObj.attributes[config.attributes[field]]; | ||||
|                 return `${config.labels[field]}: ${vendor.computeValue ? vendor.computeValue(value) : value} ${config.labels.hours}`; | ||||
|             } else { | ||||
|                 return `${config.labels[field]}: - `; | ||||
|             } | ||||
|         }; | ||||
|  | ||||
|         this.contentText = `color: ${config.image !== false ? 'white; text-shadow: 0 0 10px black;' : 'var(--primary-text-color)'}`; | ||||
|         this.contentStyle = `padding: ${this.showButtons ? '16px 16px 4px' : '16px'}; ${this.contentText}`; | ||||
|         this.backgroundImage = config.image !== false ? `background-image: url('${config.image || vendor.image}')` : ''; | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user
	 dfcarvajal
					dfcarvajal