isaacrlevin / presencelight

PresenceLight is a solution to broadcast your various statuses to light bulbs.
MIT License
419 stars 77 forks source link

Errors trying to use Remote API feature with Philips Hue #826

Closed MarcusBluestein closed 7 months ago

MarcusBluestein commented 1 year ago

I am trying to run PresenceLight in a cloud virtual machine and have it control the lights in my home office. I am successful clicking the "Login to Hue Cloud" button, but nothing happens when I press either "Get Hue Lights" or "Get Hue Groups" buttons. I see the errors below in the logs. Is this a bug or am I doing something wrong?

{"Timestamp":"2023-07-27T08:00:57.8067245-04:00","Level":"Error","MessageTemplate":"Error Occured Processing Access Token for Remote Bridge - RemoteHueService:GetAccessToken Line: 109","Exception":"System.UnauthorizedAccessException: Access to the path 'C:\Program Files\WindowsApps\37828IsaacLevin.197278F15330A_5.6.11.0_x64zfcjmmeb3zeaa\PresenceLight\huetoken.cache' is denied.\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)\r\n at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)\r\n at System.IO.File.WriteToFileAsync(String path, FileMode mode, String contents, Encoding encoding, CancellationToken cancellationToken)\r\n at PresenceLight.Core.RemoteHueService.GetAccessToken()","Properties":{"SourceContext":"PresenceLight.Core.RemoteHueService","LineNumber":109,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\Lights\RemoteHueServices\RemoteHueService.cs","MemberName":"GetAccessToken","Application":"PresenceLight"}} {"Timestamp":"2023-07-27T08:00:57.8269236-04:00","Level":"Error","MessageTemplate":"Error Occured Registering Remote Bridge - RemoteHueService:RegisterBridge Line: 182","Exception":"System.UnauthorizedAccessException: Access to the path 'C:\Program Files\WindowsApps\37828IsaacLevin.197278F15330A_5.6.11.0_x64zfcjmmeb3zeaa\PresenceLight\huetoken.cache' is denied.\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode)\r\n at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)\r\n at System.IO.File.WriteToFileAsync(String path, FileMode mode, String contents, Encoding encoding, CancellationToken cancellationToken)\r\n at PresenceLight.Core.RemoteHueService.GetAccessToken()\r\n at PresenceLight.Core.RemoteHueService.RegisterBridge()","Properties":{"SourceContext":"PresenceLight.Core.RemoteHueService","LineNumber":182,"FilePath":"D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\Lights\\RemoteHueServices\\RemoteHueService.cs","MemberName":"RegisterBridge","Application":"PresenceLight"}} {"Timestamp":"2023-07-27T08:00:57.8292437-04:00","Level":"Error","MessageTemplate":"Error Occured Getting Cloud Hue Api Key","Exception":"System.UnauthorizedAccessException: Access to the path 'C:\\Program Files\\WindowsApps\\37828IsaacLevin.197278F15330A_5.6.11.0_x64__zfcjmmeb3zeaa\\PresenceLight\\huetoken.cache' is denied.\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode)\r\n at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)\r\n at System.IO.File.WriteToFileAsync(String path, FileMode mode, String contents, Encoding encoding, CancellationToken cancellationToken)\r\n at PresenceLight.Core.RemoteHueService.GetAccessToken()\r\n at PresenceLight.Core.RemoteHueService.RegisterBridge()\r\n at PresenceLight.Core.RemoteHueServices.RegisterBridgeHandler.Handle(RegisterBridgeCommand command, CancellationToken cancellationToken)\r\n at PresenceLight.Razor.Pages.HueSetup.LoginRemoteApi()","Properties":{"SourceContext":"PresenceLight.Razor.Pages.HueSetup","Application":"PresenceLight"}}

isaacrlevin commented 7 months ago

@MarcusBluestein are you still having this issue?

MarcusBluestein commented 7 months ago

Yes I am. If you want logs and for me to try anything let me know.

And if it matters, I am trying to run the application on Windows 365 VM for work and have it talk to my home lights.

Marcus Bluestein | Kraft & Kennedy, Inc. +1 (212) 692-5602 | @.***

On Jan 17, 2024, at 1:08 PM, Isaac Levin @.***> wrote:



@MarcusBluesteinhttps://github.com/MarcusBluestein are you still having this issue?

— Reply to this email directly, view it on GitHubhttps://github.com/isaacrlevin/presencelight/issues/826#issuecomment-1896332746, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AX7S2HVBWQ7UZYJST5FX4KTYPAHN3AVCNFSM6AAAAAA2Z76KQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJWGMZTENZUGY. You are receiving this because you were mentioned.Message ID: @.***>

MarcusBluestein commented 7 months ago

I made sure I was on the latest version (5.6.120) and tried again. Still not working. I clicked the button to login to Hue Cloud, logged in, it said to go back to the application and nothing happens. I can click the Get Hue Lights and Get Hue Groups buttons, but nothing happens.

image
isaacrlevin commented 7 months ago

Can you try the nightly version? I made some changes and published a new version

MarcusBluestein commented 7 months ago

Nothing seemed different after I installed the nightly version. Here are the logs:

{"Timestamp":"2024-01-18T06:51:46.6774570-05:00","Level":"Information","MessageTemplate":"Load Settings Initialized - MainWindow.xaml:LoadSettings Line: 127","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":127,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"LoadSettings","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:51:47.6689257-05:00","Level":"Information","MessageTemplate":"Load Settings Successfull - MainWindow.xaml:LoadSettings Line: 137","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":137,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"LoadSettings","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:51:47.7152288-05:00","Level":"Information","MessageTemplate":"Light Mode Set: Graph - MainWindow.xaml:CallGraph Line: 180","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":180,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"CallGraph","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:51:48.7528540-05:00","Level":"Information","MessageTemplate":"Light Mode: Graph","Properties":{"SourceContext":"PresenceLight.Razor.Components.Pages.Index","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:07.4627133-05:00","Level":"Information","MessageTemplate":"Getting Graph Data: Profile, Image, Presence - GraphWrapper:GetBatchContent Line: 96","Properties":{"SourceContext":"PresenceLight.Core.GraphWrapper","LineNumber":96,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\GraphServices\GraphWrapper.cs","MemberName":"GetBatchContent","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:12.9145627-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:18.0714901-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:23.2296365-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:24.0234228-05:00","Level":"Information","MessageTemplate":"Cloud Hue Login Initialized","Properties":{"SourceContext":"PresenceLight.Razor.Components.Pages.HueSetup","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:28.3184166-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:31.0054862-05:00","Level":"Error","MessageTemplate":"Error Occurred Processing Access Token for Remote Bridge - RemoteHueService:GetAccessToken Line: 427","Exception":"System.UnauthorizedAccessException: Access to the path 'C:\Program Files\WindowsApps\37828IsaacLevin.197278F15330A.Nightly_5.7.1.0_x64jvewcxq8vj8qt\PresenceLight\huetoken.cache' is denied.\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)\r\n at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)\r\n at System.IO.File.WriteToFileAsync(String path, FileMode mode, String contents, Encoding encoding, CancellationToken cancellationToken)\r\n at PresenceLight.Core.RemoteHueService.GetAccessToken() in D:\a\presencelight\presencelight\src\PresenceLight.Core\Lights\RemoteHueServices\RemoteHueService.cs:line 420","Properties":{"SourceContext":"PresenceLight.Core.RemoteHueService","LineNumber":427,"FilePath":"D:\a\presencelight\presencelight\src\PresenceLight.Core\Lights\RemoteHueServices\RemoteHueService.cs","MemberName":"GetAccessToken","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:31.0294973-05:00","Level":"Error","MessageTemplate":"Error Occurred Registering Remote Bridge - RemoteHueService:RegisterBridge Line: 145","Exception":"System.UnauthorizedAccessException: Access to the path 'C:\Program Files\WindowsApps\37828IsaacLevin.197278F15330A.Nightly_5.7.1.0_x64jvewcxq8vj8qt\PresenceLight\huetoken.cache' is denied.\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode)\r\n at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)\r\n at System.IO.File.WriteToFileAsync(String path, FileMode mode, String contents, Encoding encoding, CancellationToken cancellationToken)\r\n at PresenceLight.Core.RemoteHueService.GetAccessToken() in D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\Lights\\RemoteHueServices\\RemoteHueService.cs:line 420\r\n at PresenceLight.Core.RemoteHueService.RegisterBridge() in D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\Lights\\RemoteHueServices\\RemoteHueService.cs:line 109","Properties":{"SourceContext":"PresenceLight.Core.RemoteHueService","LineNumber":145,"FilePath":"D:\\a\\presencelight\\presencelight\\src\\PresenceLight.Core\\Lights\\RemoteHueServices\\RemoteHueService.cs","MemberName":"RegisterBridge","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:31.0317867-05:00","Level":"Error","MessageTemplate":"Error Occurred Getting Cloud Hue Api Key","Exception":"System.UnauthorizedAccessException: Access to the path 'C:\\Program Files\\WindowsApps\\37828IsaacLevin.197278F15330A.Nightly_5.7.1.0_x64__jvewcxq8vj8qt\\PresenceLight\\huetoken.cache' is denied.\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)\r\n at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode)\r\n at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)\r\n at System.IO.File.WriteToFileAsync(String path, FileMode mode, String contents, Encoding encoding, CancellationToken cancellationToken)\r\n at PresenceLight.Core.RemoteHueService.GetAccessToken() in D:\a\presencelight\presencelight\src\PresenceLight.Core\Lights\RemoteHueServices\RemoteHueService.cs:line 420\r\n at PresenceLight.Core.RemoteHueService.RegisterBridge() in D:\a\presencelight\presencelight\src\PresenceLight.Core\Lights\RemoteHueServices\RemoteHueService.cs:line 109\r\n at PresenceLight.Core.RemoteHueServices.RegisterBridgeHandler.Handle(RegisterBridgeCommand command, CancellationToken cancellationToken) in D:\a\presencelight\presencelight\src\PresenceLight.Core\Lights\RemoteHueServices\RegisterBridge\RegisterBridgeHandler.cs:line 18\r\n at PresenceLight.Razor.Components.Pages.HueSetup.LoginRemoteApi() in D:\a\presencelight\presencelight\src\PresenceLight.Razor\Components\Pages\HueSetup.razor:line 179","Properties":{"SourceContext":"PresenceLight.Razor.Components.Pages.HueSetup","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:33.4801736-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:38.0689904-05:00","Level":"Information","MessageTemplate":"Get Hue Lights Initialized","Properties":{"SourceContext":"PresenceLight.Razor.Components.Pages.HueSetup","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:38.5123308-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:39.5623692-05:00","Level":"Information","MessageTemplate":"Get Hue Groups Initialized","Properties":{"SourceContext":"PresenceLight.Razor.Components.Pages.HueSetup","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:41.9404113-05:00","Level":"Information","MessageTemplate":"Settings Saved from Hue Page","Properties":{"SourceContext":"PresenceLight.Razor.Components.Pages.HueSetup","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:42.8109593-05:00","Level":"Information","MessageTemplate":"Get Hue Lights Initialized","Properties":{"SourceContext":"PresenceLight.Razor.Components.Pages.HueSetup","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:43.3147324-05:00","Level":"Information","MessageTemplate":"Get Hue Groups Initialized","Properties":{"SourceContext":"PresenceLight.Razor.Components.Pages.HueSetup","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:43.6746992-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:48.8240202-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:53.9128975-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}} {"Timestamp":"2024-01-18T06:52:58.9483887-05:00","Level":"Information","MessageTemplate":"PresenceLight Running in Teams Mode - MainWindow.xaml:InteractWithLights Line: 575","Properties":{"SourceContext":"PresenceLight.MainWindow","LineNumber":575,"FilePath":"D:\a\presencelight\presencelight\src\DesktopClient\PresenceLight\MainWindow.xaml.cs","MemberName":"InteractWithLights","Application":"PresenceLight"}}

isaacrlevin commented 7 months ago

ok try now :)

MarcusBluestein commented 7 months ago

It works! Thank you so much for fixing it and creating such an awesome application.

Marcus Bluestein | Kraft & Kennedy, Inc. +1 (212) 692-5602 | @.***


From: Isaac Levin @.> Sent: Thursday, January 18, 2024 5:30 PM To: isaacrlevin/presencelight @.> Cc: Bluestein, Marcus @.>; Mention @.> Subject: Re: [isaacrlevin/presencelight] Errors trying to use Remote API feature with Philips Hue (Issue #826)

Reopened #826https://github.com/isaacrlevin/presencelight/issues/826.

— Reply to this email directly, view it on GitHubhttps://github.com/isaacrlevin/presencelight/issues/826#event-11530729014, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AX7S2HRBP7H4UTBSYXJL2YDYPGO7FAVCNFSM6AAAAAA2Z76KQWVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGUZTANZSHEYDCNA. You are receiving this because you were mentioned.Message ID: @.***>

isaacrlevin commented 7 months ago

Great, I will close when it gets pushed to the Windows Store