Closed linuxlurak closed 7 years ago
The only way to debug it is to turn off your light, and set a time a wait, and see.
Can you share your configuration with me, then maybe I can see what if wrong :)
Thanks for your reply!
My configs are:
input_boolean:
!include custom_components/wecker_weiteres_setting.yaml
input_select:
!include custom_components/wecker_zeit_setting.yaml
clockalarm:
name: Wecker
entity_id: light.ugdiele
brightness: 255
color: [255 200 115]
color_temp: 370
I double checked the entity_id just now. It's correctly set.
Those yaml files with german names content your input_boolean.yaml (wecker_weiteres_settings.yaml) and input_select.yaml (wecker_zeit_setting.yaml). Content is not touched. Directly downloaded from github. Only renamed.
They are loaded sucessfully:
The input booleans and selects are grouped like this:
group:
security:
[cut out, not of interest here]
settings:
view: yes
entities:
- group.wecker_optionen
wecker_optionen:
name: Weckeroptionen
entities:
- input_select.transition_time
- input_select.wake_up_time
- input_boolean.automation_on_off
- input_boolean.alarm_on_off
- input_boolean.monday
- input_boolean.tuesday
- input_boolean.wednesday
- input_boolean.thursday
- input_boolean.friday
- input_boolean.saturday
- input_boolean.sunday
I see your code has a lot of output printing (log.error(''); log.info('')). I don't remember anything in my logs. Perhaps I have to insert some more log.info().
For completeness I post my logger config here:
logger:
default: debug
logs:
homeassistant.components.media_player.squeezebox: critical
homeassistant.components.zwave: error
homeassistant.components.clockalarm: debug
Thanks for your Inputs!
The "name" entry is not supposed to be there, but it doesn't seems like it does anything.
You can remove the input_boolean.automation_on_off
and input_boolean.wake_up_time
those are just some leftovers and are not used anymore.
Are you using any other input_booleans than those from the clockalarm ?
and could you try to paste the output from hass when you start it ?
I don't know much about the logger function, but I have not done anything for my code should react on logger: debug function as you posted.
Still not working. I'll delete those inputs you mentioned. And I'll add some log.info() to test if the script loads at all.
I'm not sure if homeassistant.components.clockalarm: debug
works... HASS-documentation is quiet poor... And yaml or it's implementation by HASS is a pain in the a..
I'll check the logs and let you know. As it works on your system without any error the problem is most likely a wrong config by me.
As I understand it the python scripts in custom_components don't have to be executable. Did you set the execute flag on your script? (chmod +x clockalarm.py
?)
@linuxlurak You did clone the last edit from @nvanggaard , did you?
But indeed, Hass documentation sucks. I really want to move my WASP-in-a-box algorithm to a custom component, but with this documantation it is not worth my time :(
@linuxlurak It sounds the entity_id is wrong. If you in HA go to services and write the following: domain: light service: toggle service data(JSON,optional): {"entity_id":"light.ugdiele"} Does it then toggle your light?
EDIT: Just looked at your config again, and you are using different amount of spaces for indent, isn't that the problem?
@nvanggaard Indeed, @linuxlurak the problem seems to be this:
input_boolean: !include custom_components/wecker_weiteres_setting.yaml input_select: !include custom_components/wecker_zeit_setting.yaml
While it should be:
input_boolean: !include custom_components/wecker_weiteres_setting.yaml
input_select: !include custom_components/wecker_zeit_setting.yaml
and the files should be named: input_boolean.yaml and input_boolean.yaml
It's not a good idea to change the file names, as the names of the selectors are hard coded.
Thanks for your inputs @nvanggaard and @Ornias1993!
Those file names are not hardcoded as far as I can see in clockalarm.py. The names are modified in configuration.yaml accordingly and result is ok -> check the posted picture above where the inputs show up. But thanks for this thought anyways!
My config looks like this now:
configuration.yaml:
input_boolean:
# wecker_weiteres_settings:
!include custom_components/wecker_weiteres_setting.yaml
input_select:
# wecker_zeit_settings:
!include custom_components/wecker_zeit_setting.yaml
clockalarm:
entity_id: light.livingone
brightness: 255
color: [255 200 115]
color_temp: 370
I checked on the entity_id as you @nvanggaard supposed. It gets toggled on and of.
After restarting HASS my logs show this:
**root@homeautomation:~# tail -f /var/log/syslog | grep clockalarm**
Jan 1 17:48:10 homeautomation hass[16809]: INFO:homeassistant.loader:Loaded clockalarm from custom_components.clockalarm
Jan 1 17:48:13 homeautomation hass[16809]: INFO:homeassistant.bootstrap:Setting up clockalarm
Jan 1 17:48:13 homeautomation hass[16809]: INFO:custom_components.clockalarm:entity_id: light.livingone
Jan 1 17:48:13 homeautomation hass[16809]: INFO:custom_components.clockalarm:Brightness is set to: 255
Jan 1 17:48:13 homeautomation hass[16809]: INFO:custom_components.clockalarm:Color is set to: ['255 200 115']
Jan 1 17:48:13 homeautomation hass[16809]: INFO:custom_components.clockalarm:Color temp is set to: 370
Jan 1 17:48:13 homeautomation hass[16809]: INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=clockalarm>
Jan 1 17:48:24 homeautomation hass[16809]: INFO:custom_components.clockalarm:No alarm for today
Jan 1 17:49:24 homeautomation hass[16809]: INFO:custom_components.clockalarm:No alarm for today
Jan 1 17:50:26 homeautomation hass[16809]: INFO:custom_components.clockalarm:No alarm for today
So loaded nicely and clockalarm nows it has nothing to do at the moment since default values are: saturday and sunday (as today) no alarm has to go on.
I then set up the alarm in the web-ui of HASS: transistion time: 3 minutes; alarm time 17:55; and sunday on:
But nothing happens neither in the logs nor with the light itself. Perhaps it does not run again after first run (where it remarks it is sunday)?
It does run multiple times, otherwise it would not say No alarm for today
more than once.
For some reason it enters the if statement on line 69:
if hass.states.get('input_boolean.' + WEEKDAY[datetime.datetime.today().weekday()]).state == 'off':
So the input_boolean is definitely initialized correctly!
Try to remove it from the group, to keep it as simple as possible.
Ok, I'll remove from the group. I followed @Ornias1993 advise too. No change till now. I report back after a test without the group.
Debugging HASS is ...
Ha! I catched this one by debugging another automation...
Jan 2 01:38:55 homeautomation hass[24363]: ERROR:homeassistant.core:Invalid service data for light.turn_on: expected int for dictionary value @ data['rgb_color']. Got ['255 200 115']
Those values are exact the same as in initial configure.yaml (see above).
It sounds like, you are having:
rgb_color = ['255 200 155']
Instead of:
rgb_color = [255 200 155]
You can try to remove the rgb_color from your configuration and it will use the default one.
My config (as above) has no ' ' in it... This is kind of logger thing to add ' '. see:
clockalarm:
entity_id: light.livingone
brightness: 255
color: [255 200 115]
color_temp: 370
But I try it without this setting.
Try putting you light settings into a scene and use my fork to execute the scene...
It limits the code concerning colors severely, so if that works we can be sure the problems is into that part of the current build
@Linuxlurak, @nvanggaard and i cleaned the code a LOT...
I suggest creating a scene and using the current version. You should not have any problems with the color anymore, due to out code not pushing lighting values anymore.
@nvanggaard, i think we can consider these issues all closed at the moment, due to them all not being related to current master branch?
@linuxlurak, @Ornias1993 is right, the code is almost rewritten, try out the new code, where you have to make a scene, and the clock alarm will then turn on the scene.
How to make a scene: https://home-assistant.io/components/scene/
If you still are having trouble let us know!
Can you guide me towards a way I can check if this custom component works? I set the time but my hue bulbs do nothing...
Thank you!