Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4.2 Startup Log files - question over constraints. #22

Closed
jwelter1971 opened this issue Jan 15, 2019 · 4 comments
Closed

2.4.2 Startup Log files - question over constraints. #22

jwelter1971 opened this issue Jan 15, 2019 · 4 comments

Comments

@jwelter1971
Copy link

jwelter1971 commented Jan 15, 2019

Hi Danny,

Please see below. I started HA at 9:30am local time; and it did detect it was inside the constraint period like it should.

It then adjusted that the FIRST_START callback is tomorrow at 7am. This makes sense as we've passed it already for today.

What I think might be a bug is the FIRST_END callback is also set for tomorrow; at 21:00. I would have suspected this should have been today? Or am I not following the logic of the callbacks correctly?

John

motion_master_bathroom:
   sensors: 
      - binary_sensor.master_bath_pir_sensor
   entities: 
      - light.master_vanity
   delay: 1800
   sensor_type_duration: True
   start_time: '07:00:00' 
   end_time: '21:00:00' 
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Initialising LightingSM entity with this configuration: OrderedDict([('sensors', ['binary_sensor.master_bath_pir_sensor']), ('entities', ['light.master_vanity']), ('delay', 1800), ('sensor_type_duration', True), ('start_time', '07:00:00'), ('end_time', '21:00:00'), ('name', 'motion_master_bathroom')])
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Entity name: motion_master_bathroom
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Control Entities: ['light.master_vanity']
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Added Control Entities as state entities: ['light.master_vanity']
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Sensor Entities: ['binary_sensor.master_bath_pir_sensor']
2019-01-15 09:30:45 INFO (MainThread) [custom_components.lightingsm.motion_master_bathroom] serivce data set up: OrderedDict([('sensors', ['binary_sensor.master_bath_pir_sensor']), ('entities', ['light.master_vanity']), ('delay', 1800), ('sensor_type_duration', True), ('start_time', '07:00:00'), ('end_time', '21:00:00'), ('name', 'motion_master_bathroom')])
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Result of parsing: {'datetime': datetime.datetime(2019, 1, 15, 7, 0, tzinfo=<DstTzInfo 'America/New_York' EST-1 day, 19:00:00 STD>), 'sun': None, 'offset': 0}
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Result of parsing: {'datetime': datetime.datetime(2019, 1, 15, 21, 0, tzinfo=<DstTzInfo 'America/New_York' EST-1 day, 19:00:00 STD>), 'sun': None, 'offset': 0}
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Parsed start time (unadjusted) 2019-01-15 07:00:00
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Parsed end time (unadjusted) 2019-01-15 21:00:00
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Setting FIRST START callback for 2019-01-16 07:00:00
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Setting FIRST END callback for 2019-01-16 21:00:00
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Result of parsing: {'datetime': datetime.datetime(2019, 1, 15, 7, 0, tzinfo=<DstTzInfo 'America/New_York' EST-1 day, 19:00:00 STD>), 'sun': None, 'offset': 0}
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Result of parsing: {'datetime': datetime.datetime(2019, 1, 15, 21, 0, tzinfo=<DstTzInfo 'America/New_York' EST-1 day, 19:00:00 STD>), 'sun': None, 'offset': 0}
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] now_is_between start time 2019-01-15 07:00:00.361415-05:00
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] now_is_between end time 2019-01-15 21:00:00.361415-05:00
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Config other
2019-01-15 09:30:45 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Using DAY MODE parameters: {'delay': 1800, 'service_data': None}
@danobot
Copy link
Owner

danobot commented Jan 15, 2019

You are right. The adjustment means it's ensures that the time period is in the future and end comes after start time.
This is really frustrating because I can't figure out the automated testing.
I had all set up for appdaemon but nothing for the component.

Will check this tomorrow. Meanwhile, please report back if the light goes into constrained mode at 21.00.

Do you have long lat, timezone and elevation configured under 'homeassitant'? I need to add this to the docs as its critical for timezone and sun component.

What is your timezone? I am +8:00.

@danobot
Copy link
Owner

danobot commented Jan 15, 2019

Just posed a fix. v2.4.3
I just edited on my phone and did not test in HA. Logic wise it should be correct now.

@jwelter1971
Copy link
Author

jwelter1971 commented Jan 15, 2019

Hi Danny,

I am in Washington DC area (EST = GMT-5). My lat/lng/elev/TZ are all set correctly (date time in the logs above looks correct).

I upgraded to 2.4.3 (note: version in the .py file is still 2.4.2 listed)

Below is the same log snipper and seems FIRST_END is as expected.

2019-01-15 11:48:15 INFO (MainThread) [custom_components.lightingsm] Config Item motion_master_bathroom: OrderedDict([('sensors', ['binary_sensor.master_bath_pir_sensor']), ('entities', ['light.master_vanity']), ('delay', 1800), ('sensor_type_duration', True), ('start_time', '07:00:00'), ('end_time', '21:00:00')])
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Initialising LightingSM entity with this configuration: OrderedDict([('sensors', ['binary_sensor.master_bath_pir_sensor']), ('entities', ['light.master_vanity']), ('delay', 1800), ('sensor_type_duration', True), ('start_time', '07:00:00'), ('end_time', '21:00:00'), ('name', 'motion_master_bathroom')])
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Entity name: motion_master_bathroom
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Control Entities: ['light.master_vanity']
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Added Control Entities as state entities: ['light.master_vanity']
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Sensor Entities: ['binary_sensor.master_bath_pir_sensor']
2019-01-15 11:48:15 INFO (MainThread) [custom_components.lightingsm.motion_master_bathroom] serivce data set up: OrderedDict([('sensors', ['binary_sensor.master_bath_pir_sensor']), ('entities', ['light.master_vanity']), ('delay', 1800), ('sensor_type_duration', True), ('start_time', '07:00:00'), ('end_time', '21:00:00'), ('name', 'motion_master_bathroom')])
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Result of parsing: {'datetime': datetime.datetime(2019, 1, 15, 7, 0, tzinfo=<DstTzInfo 'America/New_York' EST-1 day, 19:00:00 STD>), 'sun': None, 'offset': 0}
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Result of parsing: {'datetime': datetime.datetime(2019, 1, 15, 21, 0, tzinfo=<DstTzInfo 'America/New_York' EST-1 day, 19:00:00 STD>), 'sun': None, 'offset': 0}
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Parsed start time (unadjusted) 2019-01-15 07:00:00
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Parsed end time (unadjusted) 2019-01-15 21:00:00
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Setting FIRST START callback for 2019-01-16 07:00:00
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Setting FIRST END callback for 2019-01-15 21:00:00
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Result of parsing: {'datetime': datetime.datetime(2019, 1, 15, 7, 0, tzinfo=<DstTzInfo 'America/New_York' EST-1 day, 19:00:00 STD>), 'sun': None, 'offset': 0}
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Result of parsing: {'datetime': datetime.datetime(2019, 1, 15, 21, 0, tzinfo=<DstTzInfo 'America/New_York' EST-1 day, 19:00:00 STD>), 'sun': None, 'offset': 0}
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] now_is_between start time 2019-01-15 07:00:00.107425-05:00
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] now_is_between end time 2019-01-15 21:00:00.107425-05:00
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Config other
2019-01-15 11:48:15 DEBUG (MainThread) [custom_components.lightingsm.motion_master_bathroom] Using DAY MODE parameters: {'delay': 1800, 'service_data': None}

@danobot
Copy link
Owner

danobot commented Jan 16, 2019

initial start/stop callbacks workin 2.4.4

@danobot danobot closed this as completed Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants