Commit graph

143 commits

Author SHA1 Message Date
Charles Spirakis
b86a1ece01 Allow conversion from date strings to "unix" timestamp. (#1985)
"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) }}
2016-05-06 18:33:46 -07:00
Brad Johnson
09693bf16c Upgrading to python-wink 0.7.4 and improving RGB color support in HA (#1832) 2016-04-17 19:07:21 -07:00
Paulus Schoutsen
68d92c3196 Use standardised datetime format 2016-04-16 01:46:50 -07:00
Jan Harkes
241735c924 Change local library path from {config_dir}/lib to {config_dir}/deps. (#1799)
Just on the off chance that someone who happens to run as root and also
doesn't correctly parse "just remove config /lib and restart".
2016-04-11 20:07:50 -07:00
Jan Harkes
dbbbed404c Detect duplicate keys in configuration.yaml. 2016-04-05 21:21:16 -07:00
Fabian Affolter
f22a40c3e8 Fix PEP257 issues 2016-03-09 11:15:04 +01:00
Fabian Affolter
9838697d2b Fix PEP257 issues 2016-03-09 10:25:50 +01:00
Paulus Schoutsen
bca4dee30e Merge pull request #1393 from persandstrom/throttle_fix
Throttle should work on a single method
2016-02-27 14:49:56 -08:00
Per Sandström
562db5ea4c Throttle for two methonds in same class 2016-02-27 23:18:56 +01:00
Fabian Affolter
213cc920d0 Move template to helpers 2016-02-23 21:19:10 +01:00
Paulus Schoutsen
3d8e9b4261 Lint fixes 2016-02-21 13:09:49 -08:00
Paulus Schoutsen
7c6dcdb082 Catch an extra error that could break util.convert 2016-02-21 11:23:16 -08:00
Paulus Schoutsen
c3bb6d32aa Add closest template helper 2016-02-21 11:13:40 -08:00
Paulus Schoutsen
9f5f13644a Add template multiply test 2016-02-21 11:12:37 -08:00
Paulus Schoutsen
7805d2800c Expose current time object instead of method to retrieve (thanks @fabaff) 2016-02-21 09:32:43 -08:00
Paulus Schoutsen
9ad2cf7b7a Adjust template rounding tests 2016-02-20 21:59:16 -08:00
Paulus Schoutsen
6ac54b20c7 Add template distance helper 2016-02-20 21:58:53 -08:00
Paulus Schoutsen
6847dac582 Expose current time in templates
Fixes #1282
2016-02-20 20:58:01 -08:00
MartinHjelmare
6e8c79d531 Change refactor structure
* Make a flatter one level inheritance, with MySensorsLight as parent
	with four children, one per light type.
* Break out helper methods. One per plain light, dimmer and RGB/RGBW
	children and per update, turn_on and turn_off, nine in total. Put
	these in the parent.
* Call the helper methods as needed from the child methods update,
	turn_on and turn_off.
* Change name of MySensorsLightLight to MySensorsLightPlain.
* Fix module docstrings according to pep257.
* Change name of color util method from rgb_hex_to_list to
	rgb_hex_to_rgb_list.
* Add unit tests for rgb_hex_to_rgb_list.
2016-02-18 02:04:06 +01:00
Paulus Schoutsen
09ab3e95c0 Tests should all use test HA 2016-02-14 15:08:23 -08:00
Paulus Schoutsen
bade0e0d71 Make tests pass flake8 2016-02-14 13:07:21 -08:00
Fabian Affolter
00afaac54c Update for file header, docstrings, and PEP8/PEP257 2016-02-13 14:19:11 +01:00
Ryan Kraus
56ac4281c7 Better tear down of util/package tests
Explicitly removed temp directory at the end of util/package unit tests.
2016-01-30 14:39:17 -05:00
Ryan Kraus
4a8f55e630 Revised package util tests
The package util tests were revised to pull the external library
pyhelloworld3 from an internal source rather than external. This speeds
up tests, makes tests more reliable, and removes dependency on internet
connection.
2016-01-30 14:08:32 -05:00
Ryan Kraus
0631f5c59d Added tests for package utilities 2016-01-30 06:44:22 -05:00
Paulus Schoutsen
ef132e4583 Add tests for color util 2016-01-29 18:44:21 -08:00
Paulus Schoutsen
bc19ef66bf Move split_entity_id to helpers 2016-01-23 22:49:49 -08:00
Andrew Thigpen
11f32d0500 Add is_state_attr method.
Returns True if the entity exists and has an attribute with the given
name and value.
2015-12-31 14:58:18 -06:00
Paulus Schoutsen
f73f824e0e Make template states var callable 2015-12-12 22:19:37 -08:00
Paulus Schoutsen
360b99be59 Add template is_state method 2015-12-12 22:19:12 -08:00
Paulus Schoutsen
2b975c8620 Add flexible error value for value template parsing 2015-12-12 10:35:15 -08:00
Paulus Schoutsen
b1bf6a609e Catch exceptions when error rendering templates 2015-12-11 19:07:03 -08:00
Paulus Schoutsen
5c63862054 Fix template rounding 2015-12-11 18:45:53 -08:00
Paulus Schoutsen
d55fda28c2 Add value renderer helper method 2015-12-10 21:38:35 -08:00
Paulus Schoutsen
7acef84aad Add variable support to template rendering 2015-12-10 21:16:05 -08:00
Paulus Schoutsen
0dcc69d800 Fix template rounding 2015-12-10 20:47:06 -08:00
Paulus Schoutsen
af09a305cf Add multiply template filter 2015-12-10 20:47:06 -08:00
Paulus Schoutsen
de68d3355a Add template support 2015-12-10 20:47:05 -08:00
Paulus Schoutsen
dcfc91e71c Fix throttle applied to methods 2015-10-11 10:42:42 -07:00
Paulus Schoutsen
47fc1deecb Fix throttle to work on instance-level 2015-10-08 23:49:55 -07:00
Paulus Schoutsen
86aea83f64 Device tracker improvements 2015-09-15 23:35:28 -07:00
Paulus Schoutsen
cfc23b0091 Speed up tests 2015-09-12 22:56:49 -07:00
Paulus Schoutsen
0c56fde5a9 Reorg tests folder 2015-07-26 10:17:01 +02:00