EvTheFuture / homeassistant-blueprints

Blueprints for Home Assistant
GNU General Public License v3.0
11 stars 9 forks source link

Failed to start #1

Closed FamTurri closed 3 years ago

FamTurri commented 3 years ago

Hi, I'm new to the forum and I wanted to ask why when the automation starts it gives me this error?

Logger: homeassistant.components.automation.dim_lights_based_on_sun_elevation Source: helpers/script.py:1138 Integration: Automazione (documentation, issues) First occurred: 19:48:36 (2 occurrences) Last logged: 19:48:36

Dim lights based on sun elevation: Choose at step 1: choice 1: Error executing script. Service not found for call_service at pos 1: Unable to find service logger.set_level Dim lights based on sun elevation: Error executing script. Service not found for choose at pos 1: Unable to find service logger.set_level

EvTheFuture commented 3 years ago

Can you see the service on development tools?

IMG_20210123_225243_137 IMG_20210123_225245_886

FamTurri commented 3 years ago

Hi EV, No, I can't see the service. how should i start the "logger" service

EvTheFuture commented 3 years ago

Hi EV, No, I can't see the service. how should i start the "logger" service

Interesting. Do you have logger: in your configuration.yaml?

Screenshot_20210123-231124_1

FamTurri commented 3 years ago

no, i can't find it in my file

20210123_235855

EvTheFuture commented 3 years ago

I'm curious to see if you add it, if the service will be exposed or why the service is missing.

Are you using HassOS?

FamTurri commented 3 years ago

Yes i use HassOS. I try to add the service

EvTheFuture commented 3 years ago

Can I ask, have you checked debug on the automation?

If yes, you can also try to unckeck it. The error will persist when starting home assistant, but it should at least work

FamTurri commented 3 years ago

nothing, always error. this is the log.......

Dettagli registro (ERROR) Logger: homeassistant.components.automation.dim_lights_based_on_sun_elevation Source: core.py:1395 Integration: Automazione (documentation, issues) First occurred: 0:30:14 (1 occurrences) Last logged: 0:30:14

While executing automation automation.dim_lights_based_on_sun_elevation Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 404, in async_trigger await self.action_script.async_run( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1026, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 707, in async_run await super().async_run() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 242, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 250, in _async_step await getattr( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 596, in _async_choose_step await self._async_run_script(script) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 670, in _async_run_script await self._async_run_long_action( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 419, in _async_run_long_action long_task.result() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1026, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 242, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 250, in _async_step await getattr( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 457, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1395, in async_call raise ServiceNotFound(domain, service) from None homeassistant.exceptions.ServiceNotFound: Unable to find service logger.set_level

EvTheFuture commented 3 years ago

Yes, it's because the service logger.set_level doesn't exist for some reason.

Have you activated Advanced Mode on the user you are logged in as?

image

FamTurri commented 3 years ago

Yes, activate. (Italian language)

20210124_004150

EvTheFuture commented 3 years ago

I've successfully replicated the problem. It occur when the logger component has not been activated.

Trying to figure out a way to detect this.

As a work around add the following to your configuration.yaml

logger:
  default: info
FamTurri commented 3 years ago

Hi Hv, I succeeded, I added the following code in the configuration.yaml file

logger: default: info logs: custom_components.hacs: debug hacs: debug queueman: debug AIOGitHubAPI: debug

Now I try your automation if it works and let you know.

EvTheFuture commented 3 years ago

logger: default: info logs: custom_components.hacs: debug hacs: debug queueman: debug AIOGitHubAPI: debug

Now I try your automation if it works and let you know.

I think it should be enough with

logger:

Or possibly

logger:
  default: info
FamTurri commented 3 years ago

Only "logger: " not work

EvTheFuture commented 3 years ago

Only "logger: " not work

How about

logger:
  default: info
FamTurri commented 3 years ago

Yes only "default: info" does not give me errors

FamTurri commented 3 years ago

The automation starts but does not turn on the light. how can i do further checks?

EvTheFuture commented 3 years ago

The automation starts but does not turn on the light. how can i do further checks?

If you have checked the checkbox that shall force the light on, it will only turn on the lamp when the elevation of the sun changes from being above the threshold you have specified to a state where the elevation is below that threshold.

The reason for this is in case you manually switch of the light, the automation will not keep turning it on until the next day.

You can go to the developer console and check the current elevation of the entity sun.sun and set the start elevation to something lower just to make sure it works as expected.

FamTurri commented 3 years ago

I have set the automations to automatic, the light does not turn on. I installed the "log viewer" addon and this is what happens

image

image

image

EvTheFuture commented 3 years ago

In order for it to work the sun need to be above 0 degrees and exactly when it changes tons or lower it should turn on.

What you can do to test this is to go to developer tools, search for sun.sun och click on it.

Update elevation to 1 and rising to false and click on set state.

Then change the elevation to -1 and click set state.

See if the light turns on or ifnyöu see something in the log?

I will push a work around for the logging as well

On Sun, 24 Jan 2021, 22:12 premiums, notifications@github.com wrote:

I have set the automations to automatic, the light does not turn on. I installed the "log viewer" addon and this is what happens

[image: image] https://user-images.githubusercontent.com/77048912/105643483-048f5e80-5e88-11eb-8321-9a376106f356.png

[image: image] https://user-images.githubusercontent.com/77048912/105643605-bdee3400-5e88-11eb-8d60-59de176bacee.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EvTheFuture/homeassistant-blueprints/issues/1#issuecomment-766432924, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP2CYG4CIVKB4OWI3J6WXHDS3SEKFANCNFSM4WP6ZKLA .

EvTheFuture commented 3 years ago

I have set the automations to automatic, the light does not turn on. I installed the "log viewer" addon and this is what happens

image

image

image

My BAD!

Can you please try the latest version I just pushed here?

FamTurri commented 3 years ago

Hello Ev, strange, with the new version the automation is not created

image

EvTheFuture commented 3 years ago

Hello Ev, strange, with the new version the automation is not created

image

Just a quick thought, have you selected the light entity or the light device?

It looks like it is the device which does not work. It need to be the entity_id of the light entity or group.

FamTurri commented 3 years ago

I loaded the previous version and automation is created.

the device has been tested with another automation and is functioning.

image

image

FamTurri commented 3 years ago

https://user-images.githubusercontent.com/77048912/105760842-982d6180-5f52-11eb-9ff2-846f58975b1e.mp4

EvTheFuture commented 3 years ago

I loaded the previous version and automation is created.

the device has been tested with another automation and is functioning.

image

image

I'll take a look. Thanks for the feedback.

EvTheFuture commented 3 years ago

@FamTurri I'm really sorry. I must have been super tired yesterday. I just pushed a corrected version cb8fb3b

EvTheFuture commented 3 years ago

@FamTurri Can you when you have the time confirm that the latest version is working?

FamTurri commented 3 years ago

hi Ev, don't worry. now automation is created, but still does not turn on the light

EvTheFuture commented 3 years ago

That is super weird. It works for me.

Have you tried the trick i suggested to manually update the elevation of the sun.sun entity?

FamTurri commented 3 years ago

This is the "log" of your routine (the light off) image This is the "log" of another routine (the light on) image I am not an expert, but it seems that it does not call the service image

FamTurri commented 3 years ago

https://user-images.githubusercontent.com/77048912/105905063-49e79380-6022-11eb-9dd2-26e42f78ff2f.mp4

EvTheFuture commented 3 years ago

video2.mp4

Excellent with a video.

Yes that is as expected. The execute button shall only be used to activate/deactivate debugging. It will not work with the lights on/off properly.

The only thing that will turn on and off the lights is when a state change trigger the automation and the sun.sun's elevation attribute has changed from a value that is greater then when the light shall turn on, to a value that is lowe (or equal) to when the light shall turn on (and vice versa for off).

But for that you need to activate the automations. It looks like they are inactivated in your video!?

To test it, first make sure the automations are activated. Then you go to developer tools -> states Search for the sun

Update the values as follows: Rising: false Elevation: 50

Click set state.

Then immediately update elevation to -50 and click set state again.

This should trigger the light to turn on.

EvTheFuture commented 3 years ago

@FamTurri Can you when you have the time confirm that the latest version is working?

FamTurri commented 3 years ago

does not work. I don't know if it's my problem, I see that the sensors don't update anymore.

however, even if I set 50 -50, the light does not turn on

EvTheFuture commented 3 years ago

does not work. I don't know if it's my problem, I see that the sensors don't update anymore.

however, even if I set 50 -50, the light does not turn on

I tried yesterday on a completely new system and it worked out of the box (debug turned off).

Did you double check that the automations are active? In the recording they were inactive.

IMG_20210129_060828_751

FamTurri commented 3 years ago

the new system you have installed is Hassio with hacs enabled? Please, share me the automation and configuration files of your new system and how you set up your automation

EvTheFuture commented 3 years ago

the new system you have installed is Hassio with hacs enabled? Please, share me the automation and configuration files of your new system and how you set up your automation

It has HACS enabled, but nothing installed from HACS other than the "Lovelace Swipe Navigation" frontend.

This is the generated automation

- id: '1611861887282'
  alias: Dim living room window lamp based on sun elevation
  description: ''
  use_blueprint:
    path: EvTheFuture/dim_lights_based_on_sun_elevation.yaml
    input:
      transition_time: '2.5'
      target_lights:
        entity_id: light.living_room_window_lamp
      min_brightness: 30
      turn_on: true
      start_elevation_setting: 5
      end_elevation_setting: -10
      turn_off: true
      end_elevation_rising: '5'
      start_elevation_rising: -5

I just added the blueprint in the Lovelace Blueprint importing tool from this URL: https://github.com/EvTheFuture/homeassistant-blueprints/blob/2abdb8f938050e1930f888630a538512b8315089/blueprints/dim_lights_based_on_sun_elevation.yaml

And then created the automation. Light turns on (haven't tested turn off on this system yet since the sun is still below the horizon :) )

Edit: I can now confirm that the light was turned off now when the sun rose above 5° elevation.

FamTurri commented 3 years ago

I'm sorry, but if I set the height of the sun why do you put automatic turn on?

I don't follow...

If you check turn on, the light will be switched on when a state change happen and the sun's elevation is equal to or below the value you set and the last state of the sun's elevation was higher than the value you have set in the automation.

FamTurri commented 3 years ago

Hi Ev, I want to inform you that the routine works. Now I have to configure it. I want to ask you if I have to turn it on at a precise elevation of the sun, should I activate the "Turn on lights automatically" function?

EvTheFuture commented 3 years ago

Hi Ev, I want to inform you that the routine works. Now I have to configure it. I want to ask you if I have to turn it on at a precise elevation of the sun, should I activate the "Turn on lights automatically" function?

When you turn on the light, the automation will always update the brightness of the light to match the elevation of the sun.

If you turn on the light in the middle of the day it will be adjusted to the brightest setting. If you turn it on at midnight (or when the sun is below the end elevation setting) it will be the most dim.

The always turn on feature will turn on the light automatically for you when the elevation cross over your start setting. That is the only thing it will do. This is if you have a window lamp for instance and you want to to be lit during the night.

If you manually change the brightness at any point the automation will no longer update the brightness until you turn off and on the light again.

I hope this made it more clear?

FamTurri commented 3 years ago

ok clear