Add additional validation for CONF_ENTRY_MAX_VOLUME value in the setup process to be greater than zero
This commit is contained in:
		
							parent
							
								
									5e24680d5d
								
							
						
					
					
						commit
						a35808b0b1
					
				|  | @ -1,5 +1,12 @@ | ||||||
| # Changelog | # Changelog | ||||||
| 
 | 
 | ||||||
|  | ## [0.3.2] Fix division by zero | ||||||
|  | 
 | ||||||
|  | ### Added | ||||||
|  | 
 | ||||||
|  | - The config flow now also checks whether the `int` provided for `CONF_ENTRY_MAX_VOLUME` is | ||||||
|  |   greater than `1` and lower than `100`. This will make sure that a division by zero cannot happen. | ||||||
|  | 
 | ||||||
| ## [0.3.0] Icons and Chore | ## [0.3.0] Icons and Chore | ||||||
| 
 | 
 | ||||||
| ### Added | ### Added | ||||||
|  |  | ||||||
|  | @ -5,6 +5,7 @@ import voluptuous as vol | ||||||
| from homeassistant import config_entries | from homeassistant import config_entries | ||||||
| from homeassistant.helpers.aiohttp_client import async_get_clientsession | from homeassistant.helpers.aiohttp_client import async_get_clientsession | ||||||
| from pysmartthings import APIResponseError | from pysmartthings import APIResponseError | ||||||
|  | from voluptuous import All, Range | ||||||
| 
 | 
 | ||||||
| from .const import (CONF_ENTRY_API_KEY, CONF_ENTRY_DEVICE_ID, | from .const import (CONF_ENTRY_API_KEY, CONF_ENTRY_DEVICE_ID, | ||||||
|                     CONF_ENTRY_DEVICE_NAME, CONF_ENTRY_MAX_VOLUME, DOMAIN) |                     CONF_ENTRY_DEVICE_NAME, CONF_ENTRY_MAX_VOLUME, DOMAIN) | ||||||
|  | @ -45,7 +46,7 @@ class ExampleConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): | ||||||
|                     vol.Required(CONF_ENTRY_API_KEY): str, |                     vol.Required(CONF_ENTRY_API_KEY): str, | ||||||
|                     vol.Required(CONF_ENTRY_DEVICE_ID): str, |                     vol.Required(CONF_ENTRY_DEVICE_ID): str, | ||||||
|                     vol.Required(CONF_ENTRY_DEVICE_NAME): str, |                     vol.Required(CONF_ENTRY_DEVICE_NAME): str, | ||||||
|                     vol.Required(CONF_ENTRY_MAX_VOLUME): int, |                     vol.Required(CONF_ENTRY_MAX_VOLUME): All(int, Range(min=1, max=100)) | ||||||
|                 } |                 } | ||||||
|             ), |             ), | ||||||
|         ) |         ) | ||||||
|  |  | ||||||
|  | @ -8,5 +8,5 @@ | ||||||
|   "iot_class": "cloud_polling", |   "iot_class": "cloud_polling", | ||||||
|   "issue_tracker": "https://github.com/samuelspagl/ha_samsung_soundbar/issues", |   "issue_tracker": "https://github.com/samuelspagl/ha_samsung_soundbar/issues", | ||||||
|   "requirements": ["pysmartthings"], |   "requirements": ["pysmartthings"], | ||||||
|   "version": "0.3.0" |   "version": "0.3.2" | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue