mirror of
				https://github.com/home-assistant/supervisor.git
				synced 2025-10-31 22:49:29 +00:00 
			
		
		
		
	 c0e3ccdb83
			
		
	
	c0e3ccdb83
	
	
	
		
			
			* Improve gdbus error handling * Fix logging type * Detect no dbus * Fix issue with complex * Update hassio/dbus/__init__.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update hassio/dbus/hostname.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update hassio/dbus/rauc.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update hassio/dbus/systemd.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Fix black
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| """Init file for Hass.io hardware RESTful API."""
 | |
| import logging
 | |
| 
 | |
| from .utils import api_process
 | |
| from ..const import (
 | |
|     ATTR_SERIAL,
 | |
|     ATTR_DISK,
 | |
|     ATTR_GPIO,
 | |
|     ATTR_AUDIO,
 | |
|     ATTR_INPUT,
 | |
|     ATTR_OUTPUT,
 | |
| )
 | |
| from ..coresys import CoreSysAttributes
 | |
| 
 | |
| _LOGGER: logging.Logger = logging.getLogger(__name__)
 | |
| 
 | |
| 
 | |
| class APIHardware(CoreSysAttributes):
 | |
|     """Handle RESTful API for hardware functions."""
 | |
| 
 | |
|     @api_process
 | |
|     async def info(self, request):
 | |
|         """Show hardware info."""
 | |
|         return {
 | |
|             ATTR_SERIAL: list(
 | |
|                 self.sys_hardware.serial_devices | self.sys_hardware.serial_by_id
 | |
|             ),
 | |
|             ATTR_INPUT: list(self.sys_hardware.input_devices),
 | |
|             ATTR_DISK: list(self.sys_hardware.disk_devices),
 | |
|             ATTR_GPIO: list(self.sys_hardware.gpio_devices),
 | |
|             ATTR_AUDIO: self.sys_hardware.audio_devices,
 | |
|         }
 | |
| 
 | |
|     @api_process
 | |
|     async def audio(self, request):
 | |
|         """Show ALSA audio devices."""
 | |
|         return {
 | |
|             ATTR_AUDIO: {
 | |
|                 ATTR_INPUT: self.sys_host.alsa.input_devices,
 | |
|                 ATTR_OUTPUT: self.sys_host.alsa.output_devices,
 | |
|             }
 | |
|         }
 |