mkh1991
(MKH)
February 24, 2022, 1:40am
1
Hi Team
I am trying to have motion-activated light, only to trigger between 11 pm to 5 am, and below is the code, however, this doesn’t work, and when I check the debug log, when the automation fired, now_time () was in iso-format and showed as 4 pm (while my local time was 12 am), hence light didn’t turn on. I have checked my time zone and it’s correct.
condition: time
after: ‘23:00:00’
before: ‘05:00:00’
action:
type: turn_on
device_id: XXXXX
entity_id: switch.power_outlet
domain: switch
Any support is appreciated.
Where is the rest of your automation? What you have posted is just a condition and an action, devoid of necessary configuration data.
mkh1991
(MKH)
February 24, 2022, 2:00am
3
trigger:
- type: motion
platform: device
device_id: XXXX
entity_id: binary_sensor.motion_sensor
domain: binary_sensor
- type: motion
platform: device
device_id: XXXX
entity_id: binary_sensor.motion_sensor_XX
domain: binary_sensor
condition:
- type: is_illuminance
condition: device
device_id: XXXXX
entity_id: sensor.illumination_XX
domain: sensor
below: 100
- condition: time
after: '23:00:00'
before: '05:00:00'
action:
- type: turn_on
device_id: XXXX
entity_id: switch.power_outlet
domain: switch
- delay:
hours: 0
minutes: 3
seconds: 0
milliseconds: 0
- type: turn_off
device_id: XXXX
entity_id: switch.power_outlet
domain: switch
mode: single
tom_l
February 24, 2022, 2:53am
4
Please read point 11 here then edit your posts and format them correctly.
tom_l
February 24, 2022, 2:59am
6
How did you install Home Assistant?
Your host OS timezone may not be set correctly.
mkh1991
(MKH)
February 24, 2022, 3:07am
7
Hi
I am using HASS portable version,
'https://github.com/AlexxIT/HassWP
Sorry, can you please guide me on how to change the time zone? Although I can see the correct time zone in Configuration–> General → Time Zone
tom_l
February 24, 2022, 3:12am
8
Yeah that thing is an abomination. I hope you are just testing to see if home assistant is for you and have plans to install it via one of the official methods later if you like it.
Seems there are already issues open:
opened 11:36AM - 22 Feb 22 UTC
{{ now() }}
{{ now().astimezone() }}
{{ utcnow().astimezone() }}
{{ now().now… () }}
{{ now().today() }}
{{ now().utcnow() }}
{{ utcnow() }}
{{ now().tzinfo }}
{{ now().astimezone().tzinfo }}
{{ utcnow().tzinfo }}
gives out
2022-02-22 11:35:38.536160+00:00
2022-02-22 19:35:38.536160+08:00
2022-02-22 19:35:38.536659+08:00
2022-02-22 19:35:38.536659
2022-02-22 19:35:38.536660
2022-02-22 11:35:38.536659
2022-02-22 11:35:38.536659+00:00
UTC
Malay Peninsula Standard Time
UTC
but config is set to
homeassistant:
latitude: 1.3089757786697331
longitude: 103.79403233127188
elevation: 24
unit_system: metric
time_zone: Asia/Tokyo
which is GMT +9 not 8
opened 12:08PM - 13 Feb 22 UTC
There an issue where the timezone of homeassistant is in UTC0 and does not follo… w the config define timezone / system timezone.
mkh1991
(MKH)
February 24, 2022, 4:33am
9
Thanks Sir. I am a noob to IT stuff, however really liked home assistant and its power. Is there any easy way to install a home assistant on a windows machine?
tom_l
February 24, 2022, 7:33am
10
Don’t use Windows as a base OS.
It will restart without warning to install updates.
Have a look at the official install methods here: