My Scene Workflow

I figured out my problem - I wasn’t specifying the color method. Duh. Using map helped get rid of the hidden items; I forgot to use the index so I had to delete a few lights, but I’ll remember that next time.

I haven’t changed my password because I’m still struggling with encryption and don’t want to add any variables but I’ll try that soon and get back to you with the error.

Glad you got this working at least - hopefully someone can help you with the SSL piece :slight_smile:

Yeah, once you do it right, it’s sweet. I just set up one of my presets on the Hue app and then “gen” it. I copied the command down so I can copy and paste it each time I want to generate scenes. I just did four of them in a few minutes where it would have taken me 30 minutes at least.

I also renamed my scenes to be a bit more Alexa friendly. I have haaska running and if I ever get the SSL thing worked out, I’m going to try my hand at intents. I gave another look at you Friday afternoon post and the docs and I’m not as put off as I was before.

Thanks again for this great program!

1 Like

I’d be interested to hear any tips on how you got hasska to work for you - I probably gave up too easily. Glad 'genning is working for you!

I followed the steps in @brusc’s video, but Ben left some stuff out. When you set up AWS and the other services, you have to stop the video and if you full screen it, you can see the stuff he forgot to mention. Also, he uses a test example that he said he would put below the video, but he must have forgotten so once again, I paused the screen and copied it. It’s only one or two fields, but they make the difference.

Yeah… sorry about that. The HAASKA video isn’t the greatest. I did it retrospectively which is never a good idea. Sorry if I missed some things. :thumbsdown: You can definitely pause to pick up the missing info. The info on the HAASKA page is also great, too, so check that for a second source.

The link to the test is in this github issue linked below the vid. I might have added it later so sorry if it wasn’t there when you needed it, @rpitera.

@aimc, let me know if you need any help! Happy to do what I can. Sorry HAASKA is such a pain… I blame Amazon for that one. Maybe Google Home will do a little better… if they ever put out an API… :grimacing:

Thanks brusc -

Yes Hasska itself is awesome, it’s just the Amazon piece that is less than stellar. I have about 15 lights and as many scenes and Alexa just could never pick the right one. I have a lot more control with the second method so I will stick with it for now at least.

Hi,
I try to figure out what the standard light recipes are from my hue’s (read/concentrate/relax/stimulate) and I try to use scenegen. But I am not getting further. Can someone please give me some clues?
this is what I get now:
./scenegen.py http://192.168.1.12:8123
name: My New Scene
entities:
Traceback (most recent call last):
File “./scenegen.py”, line 94, in
main()
File “./scenegen.py”, line 88, in main
output_attrs(state, args)
File “./scenegen.py”, line 25, in output_attrs
parts = state[“entity_id”].split(".")
TypeError: string indices must be integers

Working fine for me - it would seem that there is something unexpected in your Home Assistant state - or at least something I haven’t come across on my system. If you would help me debug I’ll try and get a fix out to you.

Could you add this line to scenegen.py at line 25:

print(state)

So it looks exactly like this:

def output_attrs(state, args):
  print(state)
  parts = state["entity_id"].split(".")
  type = parts[0]

Make sure there are spaces in front of the print not tabs. Then run it and send me the output, either here or via a PM,

Thanks!

@bart - Another user ran into this and helped me debug it - you probably didn’t specify your password. If that is not it, I am just about to release a new version with better error reporting.

1 Like

Just pushed a new version with improved error checking after @MikeCranium graciously helped me track down an error that should have been obvious if my code checked for it!

Version 1.1

  • Add better error checking for Home Assistant errors
2 Likes

Thanks! I didn’t had time to try. Am on holiday now.

Would be great if you put in your readme a short explanation for install for noobs. I found out I had to clone your git and then something else (which I now forgot).
And with password you mean the Api key?

Next week I am going to test it.

Thanks for the feedback, I’ll see what I can do :slight_smile:

EDIT: Done!

Version 1.2

  • Add installation instructions
1 Like

After installation according your GitHub page, I had to : sudo chmod 755 scenegen.py , and then it did work!!! Thanks!! Very useful for the hue lights

Cool! I’ll add that step to the instructions.

Nice find Mike! BTW, what was the error; just curious.

Also, did you fix the API input to allow extra characters like “!”? I had to change my API password for this reason - not sure if you remember me mentioning this.

1 Like

Hi Rob -

The problem was I was checking for errors in the actual call to HA (e.g. wrong IP Address or port), but there are a class of errors that the API itself can return (e.g. unauthorized) - I wasn’t checking for these and assuming all was well when I had no data to work with.

Regarding the funny characters - that isn’t something I can do anything about. The way the Linux shell works is that it intercepts certain characters like >, <, " and a bunch of others that mean things specific to the shell, I don’t ever get to see them, the shell intercepts them and since they weren’t intended for it, the shell gets confused. The way around this if you want to include shell-unfriendly characters in a parameter is to enclose them in single quotes, then the shell ignores them and passes them straight through to the script as parameters, e.g.,

$ some_command 'f$unk<y>""argument'

1 Like

Thanks, I was just curious. As far as the other thing, I’m living fine with it. Just thought if it was an easy fix, maybe it could be implemented. But knowing you, it probably would have been implemented already if it was!

No, sadly, there is no way around using the single quotes, it is a basic attribute of the way the Unix/Linux shell works and has done for the last 40 years!

I just set this up and hit the following issues so I’m adding this here to save the next guy. This info is earlier in this thread as well.
Can you update the installation docs?

-- sudo chmod 755 scenegen.py
-- ./scenegen.py http://localhost:8123/api/states? -k <API_PASSWORD>    ( password can't contain special characters.. mine originally has a ! )


the API_PASSWORD is from configuration.yaml

http:
  api_password: <API_PASSWORD>
1 Like