awawa-dev / HyperHDR

Highly optimized open source ambient lighting implementation based on modern digital video and audio stream analysis for Windows, macOS and Linux (x86 and Raspberry Pi / ARM).
http://www.hyperhdr.eu/
MIT License
1.05k stars 110 forks source link

Hue Entertainment Wizard is not saving. #119

Closed discoluc closed 3 years ago

discoluc commented 3 years ago

Bug report, debug log and your config file (FULL LOGS ARE MANDATORY)

Steps to reproduce

Using the Wizard for HUE Entertainment as described in your manual. The Entertainment Group is created in HUE App, and then in the wizard the position of the hue lamps is chosen. But the SAVE button is not working.

What is expected?

When the SAVE button of the Wizard is pressed the Wizard should close and show a successful message.

What is actually happening?

Nothing happens

System

HyperHDR Server:

HyperHDR Server OS:

awawa-dev commented 3 years ago

In fact few days ago I tested it to create new tutorial (https://github.com/awawa-dev/HyperHDR/wiki/Quick-start), it worked so could not reproduce the problem. Check your browser 'Inspect' console if you have any Javascript errors when you try to save the configuration. image

DasPhero commented 3 years ago

I have the same problem. I can't save the Hue light configuration and if I have an Hue instance enabled hyperion crashes every minute or so and reboots. image

awawa-dev commented 3 years ago

Before release it was tested again today: on macOS (local, safari), windows (local, edge/firefox), Rpi4 (remote from Windows edge/firefox). Started from fresh settings so please remove your old config and test again. Can't exclude it can be a problem for some configurations but still can't reproduce it.

DasPhero commented 3 years ago

This may be a stupid question, but where do I find the config. I couldn't see it in the /etc folder.

awawa-dev commented 3 years ago

no problem: /home/pi/.hyperhdr folder (may be hidden)

DasPhero commented 3 years ago

This is weird. There is no such file in my (pi users) home dir. Even with the -alh flag.

awawa-dev commented 3 years ago

check logs: the location is written in first lines maybe you run it on different user

DasPhero commented 3 years ago

I've found an SQLite Database mentioned in the logs. Is this the one you meant?

awawa-dev commented 3 years ago

paste here that line please

DasPhero commented 3 years ago

2021-09-15T18:02:54.310Z [DB] Database opened: /.hyperhdr/db/hyperhdr.db

It also in the only .hyperhdr folder I could find. Aside from the db it is empty image

awawa-dev commented 3 years ago

don't know how hyperhdr is started here but clearly there is no home folder for it as it creates its config in the main directory. if hyperhdr process is not running start it: sudo systemctl start hyperhdr@pi.service

awawa-dev commented 3 years ago

The crash is caused by being unable to write to a DB file (empty file) unrelated to Philips Hue under such circumstances. The database must exist (even in the read-only mode). Have you succeeded run it on pi user with an access to its home folder?

DasPhero commented 3 years ago

I tried to delete db file and after a reboot it has deleted all my configurations. After reconfiguring everything hue still doesn't work. I guess because I haven't startet it properly? I got the commands to start it from a video. sudo apt install ./HyperHDR-[Version]-Linux-\$(uname -m\).deb sudo sed -i '/^User/d' /etc/systemd/system/hyperhdr\@.service sudo systemctl daemon-reload sudo service hyperhdr@pi restart sudo service hyperhdr@pi status Maybe thats the reason it is not in the home directory.

After redoing the config I also have the problem that there are occasional white flashes (using WS2812B Strips). But I think that is another problem and might be a configuration issue. Nonetheless I don't think that this belongs in this thread 😅

awawa-dev commented 3 years ago

Oh dear... maybe the script is for Hyperion or for very old HyperHDR 😉 For Raspberry Pi OS sudo apt install ./<packagename>.deb is enough. Random white flashing usually indicates some voltage issue (or missing voltage level shifter). Don't use USB grabber for now, start with only 1 instance of WS2812B without Philips, test LED strip using effects (rainbow effect and static dark/bright colors).

DasPhero commented 3 years ago

The strip was running fine thats why I tried to integrate the Hue lamps aswell.

Voltage issues? You mean not enough voltage? I adjusted the powersupply (5v - 100W) to output exactly 5V using the potentiometer. And the wattage should be more than sufficient, even when also running the PI from it.

awawa-dev commented 3 years ago

Not the wattage for power supplying but the voltage for the data line. I explained it here: Voltage level shifter and here why not RPi. I left the option for using ws2812b directly (even upgraded rpi_ws281x library) but that solution is no longer supported by us: https://github.com/awawa-dev/HyperHDR#faq ...too many problems..

DasPhero commented 3 years ago

Thats sad to hear, as I just spent a chunk of money for this setup and it worked for like 2 hours. What is your recommended setup (strip brand, etc.. ) to get it running with 1 (later maybe multiple) led strip and the hue api? My Current Setup: AVR - HDMI Capture card (Output to TV) - USB to PI - PI Pin for data The strip and the PI are fed by the same powersupply as I read that they need a common ground.

awawa-dev commented 3 years ago

If you Rpi doesn't have its own power supply but it is fed by common powersupply then the voltage probable won't be stable enough for RPi on dynamic changes of the LED strip link . In such cases dmesg must be verified for 'undervoltage detected'

The strip and the PI are fed by the same powersupply as I read that they need a common ground.

If they are fed by the same power-supply then you don't need a common ground. If you use separate power suppliers then you need it (just connect ground from LED strip to one of the Rpi grounds on the GPIO).

If you want to stay with your current setup then add at least the voltage level shifter: from the above link or better use professional one SN74AHCT125N . Both solutions are very cheap.

DasPhero commented 3 years ago

Can you tell me how I can build the project to try a workaround in the JS files? (Using a debian linux machine and creating a package for the PI3 (v7l). Sadly I am not as acquainted with make-ing packages and applications. Or is there another easier "debug" way where I can exchange the JS files without having to rebuild the whole thing over and over?

awawa-dev commented 3 years ago

I'm not following...what kind of workaround?

DasPhero commented 3 years ago

Maybe I switched the topic too fast. A workaround for the root problem of this thread (Saving the hue config) I know that it works on your machine, thats why I wanted to debug the config file access and try if I can get it running on my PI. And as the error occurs in the JS side of the code I wanted to tinker with it to find out what went wrong.

awawa-dev commented 3 years ago

It worked on many of my machines and different OS/arch: only the Philips bridge and lamps were the same 😉 it's JS code, so you can modify and test them on debian: it builds quite fast if you change only these files.

DasPhero commented 3 years ago

That leads to my previous question 😉 What command do I need to run to build the code? 😃

awawa-dev commented 3 years ago

Ah, that. It's in wiki https://github.com/awawa-dev/HyperHDR/wiki/Compiling-HyperHDR

DasPhero commented 3 years ago

I compiled it and ran it using my normal debian user. Configuring and controlling the hue lights went smoothly.

Now there is a "but". You earlier said that hyperhdr cannot find the configuration file in this specific instance because it is not located in the user directory. Trying to confirm this i reran the compiled service as root user and got a similiar error message image The message itself differs a bit, but it seems like it is the same code.

If running the service as normal user works why not run it as the pi user? (rhetorical question) As I described earlier the commands I used to start the service had an unusual line in it sudo sed -i '/^User/d' /etc/systemd/system/hyperhdr\@.service which I didn't run anymore because you told me its outdated 😄

After struggeling for some time because the led strip didn't light up at all I found out why this line seems to be important. It removes the user information from the service config so that the service is started as root user. Why is this important? Using the WS2812b strip fed by the GPIO18 pin the application needs root permissions to be able to send signals through this pin.

So there seems to be a conflict. The application struggles locating the config file when run as a root user, but cannot control the GPIO18 pin as unprivileged user. Do you have an idea on how to play around this? It is my first PI project so I don't know how the pins work in detail. It might be enough to put the pi user in the root group, but from a security aspect this might not ideal.

awawa-dev commented 3 years ago

One of many rpi_ws281x problems but HyperHDR can be run as root and has no problem with that on Raspberry Pi OS, we just need to do it gently and properly 😉 from FAQ On your system it cannot access its home folder, instead it fallback to the main folder and it's now a big problem: because it's non-writable (banned by Linux). HyperHDR relay on an access to DB file and that file must exists or be created. Without that it's in unpredictable state where almost nothing will work (will try to use default settings but it will be unusable).

DasPhero commented 3 years ago

That link seems to be the last missing puzzle piece as the application now works with the strip and the hue lights. Thank you for your quick responses

discoluc commented 3 years ago

hi back to topic :D If I press on SAVE I get the following errors:

image
awawa-dev commented 3 years ago

Did you start from fresh start (deleting old config)?

awawa-dev commented 3 years ago

Also need screenshots from every step from the wizard beginning (you can hide your philips hue key and id). Another round of tests show that everything is OK so can't reproduce it without much more details.

awawa-dev commented 3 years ago

@snikcers since everything indicates that your configuration for Philips Hue is broken try that trick: change your instance LED driver from Philips Hue to Debug->File, save it, restart HyperHDR service (not browser), after you start HyperHDR then change LED driver back to Philips Hue, run the wizard again.

DasPhero commented 3 years ago

@snikcers Thats the same error I had. How did you install and run the hyperhdr service? And where is your .hyperhdr folder located?

awawa-dev commented 3 years ago

I suspect the path that broke Philips Hue configuration was definitely not in way of mentioned HyperHDR manual and that's why we can't received more details and I can not reproduce the problem either in the way it was described ;) OK, but I think I know now the way and suspect the missing logs that are mandatory (and I could stopped there) could lead to the source much earlier so it's another setback for reporting the issue and waste of my time trying figuring out what's happening without details ;) If I do something about it? No, creating tutorials is a hard work for me... of course it can be ignored but all I can do is to leave above workaround for resetting broken settings due to experiments for help if someone left the path. And for Philips Hue I created even two detailed, similar tutorials so no one can blame me for the lack of documentation in that matter.

gogui63 commented 2 years ago

Hi same error here : Logs from console :

Uncaught TypeError: sc.smoothing is undefined
    beginWizardHue http://192.168.20.20:8090/js/wizard.js:1135
    jQuery 2
        dispatch
        handle

image

I see nothing in HyperHDR logs

My setup : Fresh install on raspberry pi 3B+ Same error on HyperHDR 17 (stable) and last beta 18_beta3

awawa-dev commented 2 years ago

Definitely not same issue. Your global configuration is broken (missing smoothing component) and for some reason can't be repaired by HyperHDR json utility. Full configuration is needed AND full logs (you can remove username/Clientkey from both files). Also try to enable smoothing and run the wizard again.

gogui63 commented 2 years ago

Smoothing seems to be enabled : image

My HyperHDR configuration : https://pastebin.com/seQ6dGj9 Logs : https://pastebin.com/YdWNeNh6

JS error on chrome :

wizard.js:1135 Uncaught TypeError: Cannot set properties of undefined (setting 'enable')
    at HTMLButtonElement.<anonymous> (wizard.js:1135:24)
    at HTMLButtonElement.dispatch (jquery.min.js:2:43064)
    at v.handle (jquery.min.js:2:41048)
awawa-dev commented 2 years ago

Thanks. This is the problem in your configuration and it happens only for instance hyperhdr_instance=2 (0 and 1 are fine):

{
    "config": "{}",
    "hyperhdr_instance": 2,
    "type": "smoothing"
},

Empty smoothing configuration. Are you sure you have enabled smoothing for instance number 2 (Philips Hue instance)?

gogui63 commented 2 years ago

Yes , sur that been enabled : image

awawa-dev commented 2 years ago

Try to change some settings in the smoothing, save them and reload the page. See if the changes are still there. If so then re-run the Hue wizard.

awawa-dev commented 2 years ago

control - F5 to reload

gogui63 commented 2 years ago

I have many error like this :

2022-06-06T09:18:35.044Z [LEDDEVICE] (ProviderRestApi.cpp:211) POST: [http://192.168.2.11:80/api] [{"devicetype":"hyperhdr#1654507100872","generateclientkey":true}]
2022-06-06T09:18:35.545Z [LEDDEVICE] (ProviderRestApi.cpp:240) POST exit: [http://192.168.2.11:80/api] [{"devicetype":"hyperhdr#1654507100872","generateclientkey":true}]
2022-06-06T09:18:35.546Z [LEDDEVICE] Reply.httpStatusCode [408 Timeout] - Check if target IP is valid and your network status

I rebooted, force refresh , updated smoothing My raspberry is on the same vlan of my hue bridge

awawa-dev commented 2 years ago

This is the network related problem only. Timeout is set to 500ms. You can curl that address from Rpi as well.

gogui63 commented 2 years ago

You right, i needed to turn off my first instance to allow connection between bridge and HyperHDR ... I don't know why my network is slowing when I used my ambilight (I have a strong network hardware - UDM Pro with U6-Lite)

Now philips Hue instance is OK (the "bug" was probably in smoothing settings ...)

BTW Thanks for support !

awawa-dev commented 2 years ago

Great. I will take a look in the configuration problem anyway: HyperHDR should fix it anyway on its own.

gogui63 commented 2 years ago

Oh no I spoke too soon, I can click to Save ... but noothing was saved, the LED Hardware screen reloaded but without saving anything , it displays a "file" instance so a default instance ... Strange Logs : https://pastebin.com/yz8105QK

screencast-192 168 20 20_8090-2022 06 06-11_43_41

awawa-dev commented 2 years ago

Logs are fine. Check browser log output for errors (must enable console 'preserve logs' or something like that otherwise reloading page will clear them).

awawa-dev commented 2 years ago

Checked your configuration:

[SETTINGSMGR] Config Fix: [root].effects.disable: Create property: disable with value: 
[SETTINGSMGR] Config Fix: [root].effects.paths: Create property: paths with value: $ROOT/custom-effects
[SETTINGSMGR] Config Fix: [root].foregroundEffect.color: Create property: color with value: 255
[SETTINGSMGR] Config Fix: [root].foregroundEffect.duration_ms: Create property: duration_ms with value: 3000
[SETTINGSMGR] Config Fix: [root].foregroundEffect.effect: Create property: effect with value: Rainbow swirl fast
[SETTINGSMGR] Config Fix: [root].foregroundEffect.enable: Create property: enable with value: True
[SETTINGSMGR] Config Fix: [root].foregroundEffect.type: Create property: type with value: effect
[SETTINGSMGR] Config Fix: [root].rawUdpServer.enable: Create property: enable with value: False
[SETTINGSMGR] Config Fix: [root].rawUdpServer.port: Create property: port with value: 5568
[SETTINGSMGR] Config Fix: [root].rawUdpServer.priority: Create property: priority with value: 109
[SETTINGSMGR] Config Fix: [root].smoothing.continuousOutput: Create property: continuousOutput with value: False
[SETTINGSMGR] Config Fix: [root].smoothing.enable: Create property: enable with value: True
[SETTINGSMGR] Config Fix: [root].smoothing.lowLightAntiFlickeringTimeout: Create property: lowLightAntiFlickeringTimeout with value: 0
[SETTINGSMGR] Config Fix: [root].smoothing.lowLightAntiFlickeringTreshold: Create property: lowLightAntiFlickeringTreshold with value: 0
[SETTINGSMGR] Config Fix: [root].smoothing.lowLightAntiFlickeringValue: Create property: lowLightAntiFlickeringValue with value: 2
[SETTINGSMGR] Config Fix: [root].smoothing.time_ms: Create property: time_ms with value: 150
[SETTINGSMGR] Config Fix: [root].smoothing.type: Create property: type with value: alternative
[SETTINGSMGR] Config Fix: [root].smoothing.updateFrequency: Create property: updateFrequency with value: 50

As you can see HyperHDR detected empty smoothing and fixed it at the startup. Something very, very wrong is happening to your system and probably settings can't be save to the db. All the later problems probably have the same cause.

gogui63 commented 2 years ago

I'll check logs later (it's time to lunch here :) ) I think my pi is end of life .. fresh SD card was not enought.

awawa-dev commented 2 years ago

First: check if the system is read only. That crucial information was missing in your HyperHDR logs, but it's present after start.

gogui63 commented 2 years ago

System is RW :

pi@raspberrypi:~ $ grep " ro[ ,]" /proc/mounts

Nothing was returned

Console logs :

wizard.js:936 {devices: Array(1), ledDeviceType: 'philipshue'}
wizard.js:944 Device: {ip: '192.168.20.11', port: 80}
wizard.js:947 Host: 192.168.20.11:80
wizard.js:1180 29: link not pressed
wizard.js:1180 28: link not pressed
wizard.js:1180 27: link not pressed
wizard.js:1180 26: link not pressed
wizard.js:1180 25: link not pressed
wizard.js:1180 24: link not pressed
wizard.js:1180 23: link not pressed
wizard.js:1180 22: link not pressed
wizard.js:1180 21: link not pressed
wizard.js:1180 20: link not pressed
wizard.js:1180 19: link not pressed
wizard.js:1180 18: link not pressed
wizard.js:1180 17: link not pressed
wizard.js:1180 16: link not pressed
wizard.js:1180 15: link not pressed
Navigated to http://192.168.20.20:8090/
DevTools failed to load source map: Could not load content for chrome-extension://hnmpcagpplmpfojmgmnngilcnanddlhb/browser-polyfill.min.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
DevTools failed to load source map: Could not load content for http://192.168.20.20:8090/js/lib/bootstrap.bundle.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for chrome-extension://iaijiochiiocodhamehbpmdlobhgghgi/content/index.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
VM1697:1          GET http://192.168.20.20:8090/i18n/fr-FR.json 404 (Not found !)
(anonymous) @ VM1697:1
send @ jquery.min.js:2
ajax @ jquery.min.js:2
S.<computed> @ jquery.min.js:2
getJSON @ jquery.min.js:2
jsonMessageLoader @ jquery.i18n.messagestore.js:113
load @ jquery.i18n.messagestore.js:57
load @ jquery.i18n.messagestore.js:77
load @ jquery.i18n.js:158
load @ jquery.i18n.js:156
initTrans @ settings.js:38
(anonymous) @ settings.js:64
e @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout (async)
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
B @ jquery.min.js:2

I changed the language to English, but without more success. I have no errors in the console.