* Make entity_filter be a modifiable builder
* Add render_with_collect method
* Use sync render_with_collect and non-class based test case
* Refactor: Template renders to RenderInfo
* Freeze with exception too
* Finish merging test changes
* Removed unused sync interface
* Final bits of the diff
Handle the case of async_render_with_possible_json_value's value argument
being something other than a string. This can happen, e.g., when using the
SQL sensor to extract a datetime column such as last_changed and also using
its value_template to convert that datetime to another format. This was
causing a TypeError from json.loads, but async_render_with_possible_json_value
was only catching ValueError's.
* added additional filters
Added base64_encode, base64_decode and ordinal filters.
* added test cases
added test cases for base64_encode, base64_decode and ordinal filters.
* forgot to add filters :)
## Description:
More fixes flagged by pylint 2 that don't hurt to have before the actual pylint 2 upgrade (which I'll submit soon).
## Checklist:
- [ ] The code change is tested and works locally.
- [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
* Adds template function state_attr to get attribute from a state
Refactored is_state_attr to use new function
Adds tests for state_attr
* Fixes line too long and test bug
* Fixes pylint error
* Fixes tests and D401 lint error
* Upgrade pylint to 1.8.1
* Fix no-else-return
* Fix bad-whitespace
* Fix too-many-nested-blocks
* Fix raising-format-tuple
See https://github.com/PyCQA/pylint/blob/master/doc/whatsnew/1.8.rst
* Fix len-as-condition
* Fix logging-not-lazy
Not sure about that TEMP_CELSIUS though, but internally it's probably just like if you concatenated any other (variable) string
* Fix stop-iteration-return
* Fix useless-super-delegation
* Fix trailing-comma-tuple
Both of these seem to simply be bugs:
* Nest: The value of self._humidity never seems to be used anywhere
* Dovado: The called API method seems to expect a "normal" number
* Fix redefined-argument-from-local
* Fix consider-using-enumerate
* Fix wrong-import-order
* Fix arguments-differ
* Fix missed no-else-return
* Fix no-member and related
* Fix signatures-differ
* Revert "Upgrade pylint to 1.8.1"
This reverts commit af78aa00f125a7d34add97b9d50c14db48412211.
* Fix arguments-differ
* except for device_tracker
* Cleanup
* Fix test using positional argument
* Fix line too long
I forgot to run flake8 - shame on me... 🙃
* Fix bad-option-value for 1.6.5
* Fix arguments-differ for device_tracker
* Upgrade pylint to 1.8.2
* 👕 Fix missed no-member
* Implemented event_data_template
* The hound does not like my indentation
* Added passed variables to tests for event and svc template calls
* Moved recursive function to template.py
* Update template.py
* Update template.py
* Cleaned up service.py and fixed unit tests
* Blank lines
* Removed stray logger statement
* Blank lines again
* Add support for logarithm in templates
This adds a 'log' filter that takes the logarithm of the given value,
with an optional base number. The base defaults to 'e' - the natural
logarithm
* Remove usage of log10 in template filter 'log'
* Add logarithm as a global
This makes it possible to write:
'{{ log(4, 2) }}'
Instead of globally using StrictUndefined, introduce a filter that
will trigger a render failure on undefined variables.
Use as `{{ value_json.someval | is_defined }}`.
By not successfully rendering unknown objects to an empty string
the caller provided error_value actually gets used.
This allows, for instance, the MQTT sensor to retain its state when an
unexpected or unwanted message (#2733/#3834) is received.
* Allow reloading groups without restart
* Test to make sure automation listeners are removed.
* Remove unused imports for group tests
* Simplify group config validation
* Add prepare_reload function to entity component
* Migrate group to use entity_component.prepare_reload
* Migrate automation to use entity_component.prepare_reload
* Clean up group.get_entity_ids
* Use cv.boolean for group config validation
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
"unix" timestamp is number of seconds since Jan 1, 1970 UTC.
This allows scripts that use templates to generate time
deltas in seconds if desired from state attributes such
as last_updated.
Some examples:
timestamp now is
{{ as_timestamp(now) }}
timstamp of last change is
{{ as_timestamp(states.binary_sensor.garage_door.last_changed) }}
seconds since last change is
{{ as_timestamp(now) - as_timestamp(states.binary_sensor.garage_door.last_changed) }}