* Recorder exception catch for long state string
* Revert - Recorder exception catch for long state string
* Validate state length at core level
* Revert - this reverts commit 9d6bd017d9.
* Revert - Recorder exception catch for long state string
* Fix state TypeError
* Test for long state exception
* Add initial version
* Fix requirements
* Prefer logging over printing
* Set executor thread name on >Py36 only
* Add tests
* Lint
* Add restrictedpython to test dependencies
* Create python_script.py
From doc:
```
However, an empty dict ({}) is treated as is. If you want to specify a list that can contain anything, specify it as dict:
>>> schema = Schema({}, extra=ALLOW_EXTRA) # don't do this
>>> try:
... schema({'extra': 1})
... raise AssertionError('MultipleInvalid not raised')
... except MultipleInvalid as e:
... exc = e
>>> str(exc) == "not a valid value"
True
>>> schema({})
{}
>>> schema = Schema(dict) # do this instead
>>> schema({})
{}
>>> schema({'extra': 1})
{'extra': 1}
```
* Always return True/False from is_state and is_state_attr
These functions are documented to always return True/False but the
short-circuit evaluation would return None if the entity_id did not exist.
* Reword into a single statement
* Fire EVENT_HOMEASSISTANT_START automations off right away while starting
* Actually have core state be set to 'starting' during boot
* Fix correct start implementation
* Test and deprecate event automation platform on start
* Fix doc strings
* Remove shutting down exception
* More strict when to mark an instance as finished
* Add automation platform to listen for start/shutdown
* When we stop we should wait till it's all done
* Fix testing
* Fix async bugs in tests
* Only set UVLOOP when hass starts from CLI
* This hangs normal asyncio event loop
* Clean up Z-Wave node entity test
* Add support for remove services / Reload script support
* Reload support for scripts
* Add more unittest for services
* Add unittest for script reload
* Address paulus comments
* Core cleanup: two stage shutdown
* fix spell
* fix
* add async logger to close
* change aiohttp to use CLOSE
* address paulus comments
* Fix tests
* Add unittest
* Move core servcie from core to components
* add new handler for signals/exception
* Static persistent id
* Move unittest
* fix coro/callback
* Add more unittest for new services
* Address comments
* Update __init__.py
* Check config before restarting.
* Make check_config on restart async
* don't check if notification service exists
* Use .communicate()
* Reduce the number of notifications. Add tests.
* Set executor to 15 and help to reduce flooting async core with udpates
* fix typing
* if it a executor, wait
* address comments from paulus
* add space for style :)
* fix spell
* Update entity_component.py
* Update entity_component.py
* Lazy initialise the worker pool
* Minimize pool initialization in core tests
* Fix tests on Python 3.4
* Remove passing in thread count to mock HASS
* Tests: Allow pool by default for threaded, disable for async
* Remove JobPriority for thread pool
* Fix wrong block_till_done
* EmulatedHue: Remove unused test code
* Zigbee: do not touch hass.pool
* Init loop in add_job
* Fix core test
* Fix random sensor test
* Bugfix signhandling/services
* change from coroutine to callback
* add error handling
* fix bug with endless running
* fix unit test
* Revert "fix unit test"
This reverts commit 31135c7709.
* Disable sigterm/sighup test
* Add async_safe annotation
* More async_run_job
* coroutine -> async_save
* Lint
* Rename async_safe -> callback
* Add tests to core for different job types
* Add one more test with different type of callbacks
* Fix typing signature for callback methods
* Fix callback service executed method
* Fix method signatures for callback
* Move worker pool monitoring to be time based instead of add_job based.
* Stub out worker pool monitor during tests
* Add test for monitor worker pool.
* Improve naming
* Test stop_monitor coroutine
* Add async_create_timer test
* Finish rename create_timer
* Fix test shutdown to ensure loop/threads are clean.
We now ensure the loop is closed, it has completed, and the
executer has completed. This ensure all threads are freed
up with any test calling hass.stop().
* Fix lint issue with run_loop
* Add event loop to the core
* Add block_till_done to HA core object
* Fix some tests
* Linting core
* Fix statemachine tests
* Core test fixes
* fix block_till_done to wait for loop and queue to empty
* fix test_core for passing, and correct start/stop/block_till_done
* Fix remote tests
* Fix tests: block_till_done
* Fix linting
* Fix more tests
* Fix final linting
* Fix remote test
* remove unnecessary import
* reduce sleep to avoid slowing down the tests excessively
* fix remaining tests to wait for non-threadsafe operations
* Add async_ doc strings for event loop / coroutine info
* Fix command line test to block for the right timeout
* Fix py3.4.2 loop var access
* Fix SERVICE_CALL_LIMIT being in effect for other tests
* Fix lint errors
* Fix lint error with proper placement
* Fix slave start to not start a timer
* Add asyncio compatible listeners.
* Increase min Python version to 3.4.2
* Move async backports to util
* Add backported async tests
* Fix linting
* Simplify Python version check
* Fix lint
* Remove unneeded try/except and queue listener appproriately.
* Fix tuple vs. list unorderable error on version compare.
* Fix version tests
* Fix: Circular dependencies of internal files
* Change: dt.date for Date and dt.datetime for DateTime
* Use NewType if available
* FIX: Wrong version test
* Remove: Date and DateTime types due to error
* Change to HomeAssistantType
* General Improvement of Typing
* Improve typing config_validation
* Improve typing script
* General Typing Improvements
* Improve NewType check
* Improve typing db_migrator
* Improve util/__init__ typing
* Improve helpers/location typing
* Regroup imports and remove pylint: disable=ungrouped-imports
* General typing improvements
Add unit symbol constants
Initial unit system object
Import more constants
Pydoc for unit system file
Import constants for configuration validation
Unit system validation method
Typing for constants
Inches are valid lengths too
Typings
Change base class to dict - needed for remote api call serialization
Validation
Use dictionary keys
Defined unit systems
Update location util to use metric instead of us fahrenheit
Update constant imports
Import defined unit systems
Update configuration to use unit system
Update schema to use unit system
Update constants
Add imports to core for unit system and distance
Type for config
Default unit system
Convert distance from HASS instance
Update temperature conversion to use unit system
Update temperature conversion
Set unit system based on configuration
Set info unit system
Return unit system dictionary with config dictionary
Auto discover unit system
Update location test for use metric
Update forecast unit system
Update mold indicator unit system
Update thermostat unit system
Update thermostat demo test
Unit tests around unit system
Update test common hass configuration
Update configuration unit tests
There should always be a unit system!
Update core unit tests
Constants typing
Linting issues
Remove unused import
Update fitbit sensor to use application unit system
Update google travel time to use application unit system
Update configuration example
Update dht sensor
Update DHT temperature conversion to use the utility function
Update swagger config
Update my sensors metric flag
Update hvac component temperature conversion
HVAC conversion for temperature
Pull unit from sensor type map
Pull unit from sensor type map
Update the temper sensor unit
Update yWeather sensor unit
Update hvac demo unit test
Set unit test config unit system to metric
Use hass unit system length for default in proximity
Use the name of the system instead of temperature
Use constants from const
Unused import
Forecasted temperature
Fix calculation in case furthest distance is greater than 1000000 units
Remove unneeded constants
Set default length to km or miles
Use constants
Linting doesn't like importing just for typing
Fix reference
Test is expecting meters - set config to meters
Use constant
Use constant
PyDoc for unit test
Should be not in
Rename to units
Change unit system to be an object - not a dictionary
Return tuple in conversion
Move convert to temperature util
Temperature conversion is now in unit system
Update imports
Rename to units
Units is now an object
Use temperature util conversion
Unit system is now an object
Validate and convert unit system config
Return the scalar value in template distance
Test is expecting meters
Update unit tests around unit system
Distance util returns tuple
Fix location info test
Set units
Update unit tests
Convert distance
DOH
Pull out the scalar from the vector
Linting
I really hate python linting
Linting again
BLARG
Unit test documentation
Unit test around is metric flag
Break ternary statement into if/else blocks
Don't use dictionary - use members
is metric flag
Rename constants
Use is metric flag
Move constants to CONST file
Move to const file
Raise error if unit is not expected
Typing
No need to return unit since only performing conversion if it can work
Use constants
Line wrapping
Raise error if invalid value
Remove subscripts from conversion as they are no longer returned as tuples
No longer tuples
No longer tuples
Check for numeric type
Fix string format to use correct variable
Typing
Assert errors raised
Remove subscript
Only convert temperature if we know the unit
If no unit of measurement set - default to HASS config
Convert only if we know the unit
Remove subscription
Fix not in clause
Linting fixes
Wants a boolean
Clearer if-block
Check if the key is in the config first
Missed a couple expecting tuples
Backwards compatibility
No like-y ternary!
Error handling around state setting
Pretty unit system configuration validation
More tuple crap
Use is metric flag
Error handling around min/max temp
Explode if no unit
Pull unit from config
Celsius has a decimal
Unused import
Check if it's a temperature before we try to convert it to a temperature
Linting says too many statements - combine lat/long in a fairly reasonable manner
Backwards compatibility unit test
Better doc
* Add __main__ type hints
* Fix most errors of __main__
* Add ignore for script.run()
* Add type annotations for from_config_dict and from_config_file
* Fix errors
* Fix requirement error
* Add mypy type check to tests
* Enable travis typing check
* Messed up the tox deps
* Laxer type checker
* Stick version numbers
* Move elevation to core config
* Migrate forecast test to requests-mock
* Migrate YR tests to requests-mock
* Add requests_mock to requirements_test.txt
* Move conf code from bootstrap to config
* More config fixes
* Fix some more issues
* Add test for set config and failing auto detect
* Allow for restart without using parent/child processes.
Assuming that we normally correctly shut down running threads and
release resources, we just do some minimal scrubbing of open file
descriptors and child processes which would stay around across an
exec() boundary.
* Use sys.executable instead of multiprocessing.spawn.get_executable()
* Limit how many file descriptors we try to close.
Don't even try to close on OSX/Darwin until we figure out how to
recognize guarded fds because the kernel will yell at us, and kill
the process.
* Use the close on exec flag on MacOS to clean up.
* Introduce a small process runner to handle restart on windows.
* Handle missing signal.SIGHUP on Windows.
Added KeyboardInterrupt handling back to block_till_stopped method.
This is because Keyboard Interrupts are sent to both the parent and
child process in no particular order so both need to handle the
interrupt.
1. Moved RESTART_EXIT_CODE to constants so it can safely be used by
__main__.py.
2. Allowed __main__/main to return the desired exit code.
3. Forwarded the child processes exit code to the parent process to be
duplicated.
4. Added —debug flag to pass command to force Home Assistant to run in
only one process. A warning is printed to STDERR to indicate HASS is in
debug mode. Another is printed if HASS requests a restart in debug
mode. A restart request in debug mode will quit.
5. Added an argument to __main__/main/setup_and_run_hass to indicate
that it is running in the top process. This tells it to return the exit
code rather than exiting.
1. Removed handling of KeyboardInterrupt. This will no longer happen
now that HASS is run in a subprocess. The KeyboardInterrupt will not be
sent to the parent process which will send a SIGTERM to the HASS
process.
2. Fixed logger warning about not being able to bind to SIGTERM.
3. Removed check for Windows OSs when binding to SIGTERM. This check
was originally put in place when HASS was binding to SIGQUIT. SIGTERM
exists in NT OSs, so the check is no longer required.
3. Now returning exit code of 100 when requesting a restart. This will
allow the parent process to only restart HASS if it is specifically
requested and not just on any encountered crash.
Implemented an OS and environment safe restart service. This works by
running Home Assistant in a child process. If the child process
terminates with an exit code > 0, HASS is restarted. SIGTERM and
KeyboardInterrupts to the parent process are forwarded to the child
process. KeyboardInterrupts will only be forwarded once. The second
KeyboardInterrupt will be handled by the parent.
Since the requirements only change when the software is updated,
this adds a command line switch to disable pip installs on
startup. The default behavior is maintained when the switch is
not specified. Skipping pip helps a lot with startup on older RPi
hardware.
Created three additional flags for the hass command:
-v - Toggle verbose log file output
—pid-file - Specify PID file path
—daemon - Launch as daemon (nix only)
The core now binds to SIGQUIT on nix systems to trigger a clean
shutdown.
Modified HTTP server to write logging messages through the logging
module.
Rewrote imports of exceptions to be from the exceptions module.
Made nmap scanner check for libnmap dependency without crashing.
Various flake8 and pylint updates.
Revised main to use frontend and demo strings rather than importing
their domains.
Removed submodule validation.
Moved local library mounting to the bootstrap module and out of core.
Added requirements_all.txt for all dependencies.
Made core dependencies looser.
Small updates to setup.py.
Cleaned up default config directory determination.
Made bootstrap creators for HA always set config directory.
Made bootstrap creators set the local library in the Python Path.
Moved all exceptions to their own file to make imports easier.
Moved default configuration directory be in the users’ profile.
Moved pip installs to be done to a lib folder in the config directory.
Reduced requirements.txt to only the barebones reqs.