Update 'totalTime' and 'elapsedTime' to be optional attributes
This commit is contained in:
		
							parent
							
								
									11ed2d1444
								
							
						
					
					
						commit
						3e41dd31ae
					
				|  | @ -373,11 +373,15 @@ class SoundbarDevice: | ||||||
| 
 | 
 | ||||||
|     @property |     @property | ||||||
|     def media_duration(self) -> int | None: |     def media_duration(self) -> int | None: | ||||||
|         return self.device.status.attributes.get("totalTime").value |         attr = self.device.status.attributes.get("totalTime", None) | ||||||
|  |         if attr: | ||||||
|  |             return attr.value | ||||||
| 
 | 
 | ||||||
|     @property |     @property | ||||||
|     def media_position(self) -> int | None: |     def media_position(self) -> int | None: | ||||||
|         return self.device.status.attributes.get("elapsedTime").value |         attr = self.device.status.attributes.get("elapsedTime", None) | ||||||
|  |         if attr: | ||||||
|  |             return attr.value | ||||||
| 
 | 
 | ||||||
|     async def media_play(self): |     async def media_play(self): | ||||||
|         await self.device.play(True) |         await self.device.play(True) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue