mariusmotea / diyHue

Philips Hue emulator that is able to control multiple types of lights
Other
627 stars 107 forks source link

WakeUp, Sleep, and Timer not working #153

Closed am0815 closed 6 years ago

am0815 commented 6 years ago

Those functions are not working with my setup which consists of a RPi 3 and multiple ESP8266 attached to regular 5050 RGB, WS2811 and SK6812 LED strips. I can set the timer in the Philips Hue iOS App but nothing is happening (e.g. the lights stay on when I setup a shutdown timer). If relevant, here's the corresponding part in my config.json: https://pastebin.com/MFZhiM2v Or am I wrong and those functions aren't working with diyHue at all?

mariusmotea commented 6 years ago

Such task can be debugged if you run manually the HueEmulator.py script and provide the output when you setup one of these actions. I believe you have some errors there that can help me to understand what go wrong. These functions where tested by me only on Android application, but behaviour must be identical with iOS app. Second thing you can do is to deploy latest script https://pastebin.com/f8SsLv5b (if you receive an error on module import try sudo pip install requests)

am0815 commented 6 years ago

As you wrote it should work on Android, I got myself the Android App and executed the HueEmulator.py script manually and tracked a timer setup on both Android and iOS. Android: https://pastebin.com/WjhT4Aq0 iOS: https://pastebin.com/rNDZ0CUp It indeed works with Android but not with iOS. As far as I can see the App behaviour is slightly different from each other. Note, that I also attached the execute command at the end, which triggers after the timer is hitting 0. Your pastebin seems to be expired.

mariusmotea commented 6 years ago

Your output was very helpful to understand the issue.

"state":{"flag":false} and "config":{"on":true} are missing on iOS. modelid is also different, but this is not important. I create a test version that automatically create state key in case is not present, hope this will fix the issue. New code is here https://pastebin.com/6SHR22u8

Please note that this run in python 3 and require requests module (sudo pip3 install requests)

am0815 commented 6 years ago

Thanks for the test version, I installed python 3 and the request module. I then started the HueEmulator3.py and got the following output:https://pastebin.com/uakh2qPq Unfortunately it doesn't seem to work right now. But I will further look into it soon.

mariusmotea commented 6 years ago

did you erased the current task, because that logical sensor must be recreated? During creation if state key is not provided then it will be created empty. you can check config.json file to see the current status (stop the service first if you want to perform changes). it will work if you add manually in this sensor attributes "state":{"flag":false} ? I recommend to backup config file before doing any changes.

am0815 commented 6 years ago

Yes, I started over with a complete new config.json from the Git Repo. After timer creation in the iOS App I manually added "state":{"flag":false} to the sensor attributes, as it was empty. I then started the timer via START in the App, but after the timer hit 0 nothing happened. Output after starting the timer with corresponding execute command was: https://pastebin.com/YMmbdNAq

mariusmotea commented 6 years ago

can you provide the config file after you create and execute the schedule one time? I need to contain also the rule and the scene to simulate on my env.

am0815 commented 6 years ago

Sure, this is it after setting up a timer on 2 lights, manually adding "state":{"flag":false} and starting it from the app: https://pastebin.com/6ntE4kPf

mariusmotea commented 6 years ago

ok, i found the issue, i believe the username must be restricted to 32 characters. user creates is this: "470a0c52e89555f73b11904c84af61924c487816" but when it try to execute the scheduler, the user will not match because is shrieked to only 32 characters /api/470a0c52e89555f73b11904c84af6192/sensors/1/state".

i will try to fix this today

mariusmotea commented 6 years ago

i hope with this commit the issue will be fixed

Update: you need to start from scratch with default config because your current used has more than 32 characters. Or you can delete the username from config->whitelist and a new one will be created automatically with 32 characters.

am0815 commented 6 years ago

Unfortunately not. The user is now correct in config.json with 32 characters, but execution yields this output: https://pastebin.com/590JUkmQ Another issue i figured out with Android: Wake and Timer works fine, but when trying to setup Sleep or a Schedule the App crashes. Will post corresponding output soon. Thanks for your effort so far! Great project.

mariusmotea commented 6 years ago

Ok, this is new issue. I'm at work, cannot do tests, but i believe i found the issue. Try this: https://pastebin.com/raw/z4AbSAXH

mariusmotea commented 6 years ago

ok, i arrived home, made some tests, found other issues. Now for Android is working ok, please check iPhone as well.

mariusmotea commented 6 years ago

Closed as there was no feedback.