Closed awooganl closed 3 years ago
Interesting, since it doesn't say where it gets a type error.
Could you please try to change all wakes by 1 och 0.1 and save the automation and see if the error disappear?
If it does, it's probably a default somewhere that causes the problem.
I increased all values by whatever the precision was on them and restarted the server. Same error. Before I restarted, the Logs page reported the error 71 times, so it's not just at startup that it happens.
This is really weird...
Can you post the automation created in automations.yaml ? Which log level are you using?
- id: '1613922705498' alias: Dim lights based on sun elevation description: '' use_blueprint: path: EvTheFuture/dim_lights_based_on_sun_elevation.yaml input: transition_time: '0' target_lights: entity_id: light.living_room_light_51 max_brightness: '100' min_brightness: '1' turn_on: true start_elevation_setting: '5.5' end_elevation_setting: '-30' end_elevation_rising: '6' start_elevation_rising: '-8' allowance: '100'
I'm not using any log level afaik, do I need to add logger to my config?
Sorry for the formatting, I find Github's editing dialog a little underwhelming.
I've added logger to my config, but error has persisted after server restart
I've added debug to the logger, but still no wiser:
2021-02-22 16:38:36 DEBUG (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Loaded automation automation.dim_lights_based_on_sun_elevation with state True from state storage last state <state automation.dim_lights_based_on_sun_elevation=on; last_triggered=2021-02-21T17:18:50.089371+00:00, mode=queued, current=0, max=10, id=1613922705498, friendly_name=Dim lights based on sun elevation @ 2021-02-22T16:35:13.103907+00:00> 2021-02-22 16:38:55 ERROR (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Error rendering variables: TypeError: can't multiply sequence by non-int of type 'float' 2021-02-22 16:38:55 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Initialized trigger Dim lights based on sun elevation 2021-02-22 16:40:26 ERROR (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Error rendering variables: TypeError: can't multiply sequence by non-int of type 'float' 2021-02-22 16:42:26 ERROR (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Error rendering variables: TypeError: can't multiply sequence by non-int of type 'float'
and so on
@awooganl I think I found the problem, could you please upgrade to the new version and see if it helps?
Looking better :)
2021-02-22 18:55:55 DEBUG (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Loaded automation automation.dim_lights_based_on_sun_elevation with state True from state storage last state <state automation.dim_lights_based_on_sun_elevation=on; last_triggered=2021-02-21T17:18:50.089371+00:00, mode=queued, current=0, max=10, id=1613922705498, friendly_name=Dim lights based on sun elevation @ 2021-02-22T16:38:36.263255+00:00> 2021-02-22 18:56:05 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Initialized trigger Dim lights based on sun elevation 2021-02-22 18:56:05 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Running automation actions 2021-02-22 18:56:05 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: choice 2: Running automation actions 2021-02-22 18:56:05 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: choice 2: Executing step call service
Not seeing anything else in the log file though, is that because we've already passed the 5.5 degrees mark when the automation should start?
Oh no, I lied, looks like it's doing something now:
2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Running automation actions 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Running automation actions 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Choose at step 1: default: Running automation actions 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Choose at step 1: default: Choose at step 1: choice 1: Running automation actions 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Choose at step 1: default: Choose at step 1: choice 1: Executing step call service 2021-02-22 19:03:45 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG: skip_event: False allowance_value: 254.0 affected_entities: ['light.living_room_light_51']
elevation: -14.7 (5.5, -30) last elevation: -13.48 new brightness: 110 last brightness: 119
current_states: [{'entity_id': 'light.living_room_light_51', 'state': 'on', 'brightness': 51}]
force_turn_on: False force_turn_off: False
entities: ['light.living_room_light_51']
turn_on_entities: []
dim_entities: ['light.living_room_light_51']
turn_off_entities: []
Triggered by: state from: (elevation: -13.48, azimuth: 271.69) to: (elevation: -14.7, azimuth: 273.28) 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Choose at step 1: default: Choose at step 2: choice 3: Running automation actions 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Choose at step 1: default: Choose at step 2: choice 3: Executing step call service 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Running automation actions 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Running automation actions 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Choose at step 1: default: Running automation actions 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Choose at step 1: default: Choose at step 1: choice 1: Running automation actions 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Choose at step 1: default: Choose at step 1: choice 1: Executing step call service 2021-02-22 19:03:45 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG: skip_event: True allowance_value: 254.0 affected_entities: []
elevation: -14.7 (5.5, -30) new brightness: 110
current_states: [{'entity_id': 'light.living_room_light_51', 'state': 'on', 'brightness': 51}]
force_turn_on: False force_turn_off: False
entities: ['light.living_room_light_51']
turn_on_entities: []
dim_entities: []
turn_off_entities: []
Triggered by: event entity_id: ['light.living_room_light_51'] service_data_length: 3 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.living_room_light_51'], 'brightness': 110, 'transition': 0}} 2021-02-22 19:03:45 INFO (MainThread) [homeassistant.components.automation.dim_lights_based_on_sun_elevation] Dim lights based on sun elevation: Choose at step 1: default: Choose at step 1: default: Choose at step 2: default: Running automation actions
Ok, I feel I should have picked this up from the readme, but with the automation configured as in the screenshots above, the light should have come on when the sun drops below 5.5 at 100%, and then by the time the sun has dropped to below 30, the brightness should be 1%? I'm not seeing any changes in dimming level so far....
If you turn off the light and back on, the automation should set the brightness calculated from the current sun elevation, as well as setting it every time the elevation changes.
However it will only automatically turn on or off the light of the previous state was within the elevation when the light shall be on/off and the new state is not.
I find this weird from your log
elevation: -14.7 (5.5, -30)
new brightness: 110
current_states: [{'entity_id': 'light.living_room_light_51', 'state': 'on', 'brightness': 51}]
It set the brightness to 51 despite saying new brightness 110
Can you check the developer tools to see what the current brightness is and if it changes when you turn off and on the light?
Before doing anything
Switching light off
Switching light on
Ah, it is actually dimming, just in small decrements. It went from 102 to 93 just now.
Ah, it is actually dimming, just in small decrements. It went from 102 to 93 just now.
Does it work as expected?
It looks strange in the log though. I have to check that it actually log the correct values.
Ah, it is actually dimming, just in small decrements. It went from 102 to 93 just now.
If you have the SSH addon installed you can run this command: tail -f /config/home-assistant.log
then have a look at the output and manually update the elevation in Developer Tools by setting the state after editing the elevation attribute.
Pay attention to the value new_brightness in the log file and check if it's the same value as the debug log say it should be.
I'm happy to close this. It starts at the maximum % I have set, and finishes at the minimum % that I have set. I don't understand the change allowance, but with it set to 100% it works fine. Would be nice to get a reverse switch at some point, so it starts at the minimum % and finishes at the maximum %, but that's not for this thread.
I've only just started to use this blueprint as an automation, but noticed this right after a server reload tonight
Logger: homeassistant.components.automation.dim_lights_based_on_sun_elevation Source: components/automation/init.py:373 Integration: Automation (documentation, issues) First occurred: 22:38:45 (1 occurrences) Last logged: 22:38:45
Error rendering variables: TypeError: can't multiply sequence by non-int of type 'float'
I can try setting debug on, but not until tomorrow...