HA_Desktop_Companion

you are looking on camera app but it can be any app in that folder :slight_smile:

So, I will jump on this issue with the camera…

@Hellis81, could you please provide me a bit more info? (I’m sorry if I’m asking for something you already answered, but I couldn’t follow all the messages here).

  1. What is the problem? The HA_Desktop_Companion reports “Camera in use” while the camera is not in use or the opposite? Or something else?
  2. As @JonatanRek mentioned, the application is looking for all the sub-keys under ´Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam´. Could you please look all the sub-keys for one with LastUsedTimeStop = 0?
  3. If you don´t find this, could you please do a similar search under ´Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam´ (if you right-click on any key you should have an option to switch between Local Machine and Current User.

Thanks for your help here.

Here is teams:

And camera app:

Here is Edge:

All three is off.

There is none that has 0. All have an end time
Some doesn’t have start and end time:

There are only three that has LastUsedTime, its Camera, NonPackaded\msedge and NonPackaded\Teams and all three show an endtime that is not 0.

When I start HA_desktop for the first time and have the camera off then it correctly displays it as off, if I switch it on then it stays on forever. Even if I Quit HA_Desktop and reopen it will not change.

In local machine there is four apps. All are off (not 0).

The problem is that it can only switch to on and then it stays on. And this switch can only happen once.l

1 Like

Thank you very much for the detailed information. It will help a lot.
I come back as soon I find something.

By the way, what about other sensors? Like Microphone in use, CPU temperature, Free RAM, etc? Are those updating properly?

Thank you weary much for cooperation :slight_smile:

1 Like

Microphone is also stuck on on. CPU is unknown, but RAM works as expected

EDIT It has been stable and resumed after hibernation several times. Seems to be very stable.

Sorry, just to clarify here… when you said that it’s stable, are you talking about the RAM only or are Camera in use and Microphone in use also working as expected and stable?

I’m talking about it not crashing and the values that does work, they work.

2 Likes

Hi, New version with all those upper mentioned fixes :slight_smile: thanks to @EdwardTFN

1 Like

Same thing with the webcam and microphone.
I just looked in the sensors file to see what the differences is between now and “Lets fix all bugs” which was working.

public static bool queryConsetStore(string category = "webcam")
has become:
public static bool queryConsentStore(string consent_category)

So apart from the variable there is also the spelling of the function. Is all calls to this function also updated?
And then there is the try catch. But the rest seems to be the same or at least same outcome from the code.

there is different store entirely as describe :up: by @EdwardTFN you need to look in to dev branch not to master.

The category string still the same it is defined by OS. just a random question since it is working correctly form isn’t possible that it is some issue with some of OS updates ? and another one vas it working correctly in past since register reading code was not changed from pint of view what is reading in registers ?

As far as I remember there has not been any updates since back then.
But I run “Lets fix all bugs” now, then the sensors in my “not debug” computer will populate and the microphone and webcam works just as it should.

Somewhere between “Lets fix all bugs” and now there has been changes that has broken it.
I realize that the new version looks in essentially four places, but that doesn’t matter. It still doesn’t work.
The only changes I have found so far is the above listed.
I have not yet found what is calling the querycode.

Looking back in lets fix all bugs, in mainwindow.xlam.cs there was:

            var cameraConsent = Sensors.queryConsetStore("webcam");
            ApiConnectiom.HASendSenzorData("camera_in_use", Sensors.convertToType(cameraConsent));

            var microphoneConsent = Sensors.queryConsetStore("microphone");
            ApiConnectiom.HASendSenzorData("microphone_in_use", Sensors.convertToType(microphoneConsent));

These lines are not in the latest version.

Yes because now it is dependent on your conf…yaml file that is why it is not barcoded any more. Error is actually in network traffic saver code. @I and @EdwardTFN we were both looking in bad place!

can you try this version ?

EDIT: you not fount anywhere in code any query function since thy are dynamically called based on content of .ymal file (is is similar to PowerShell’s $$)

This one works!

2 Likes

Perfect changes will be included in next stable release :slight_smile:

1 Like

Are there any other issues on your computer ? like some values are read incorrectly etc ?

After some changes in the configuration.yaml then it seems correct.
It didn’t display the temperature and the battery state array was in the incorrect order for my states.

It’s just the ipinfo.io thing that I posted on GitHub as far as I can see that is not working as expected. It’s super stable now, it has been running for days

temperature is expected since each manufacturer is using different wmic path it can be corrected on your site in Yaml what is wrong with battery state can you post an example so i can fix it ?

i will look in to ipinfo.io

Battery state.

  - platform: wmic
    wmic_path: Win32_Battery
    wmic_selector: BatteryStatus
    wmic_namespace: \\root\CIMV2
    value_map: "Fully Charged|Discharging|On AC|Low|Critical|Charging|Charging and High|Charging and Low|Undefined|Partially Charged"
    name: Battery State
    unique_id: battery_state
    icon: "mdi:battery-minus"
    entity_category: "diagnostic"
    device_class: battery

So I switched orders on the value map.
The wmic reports a numeric value and I just unplugged the computer and looked at what number it was then made sure the Discharging was at that position in the “array”, and the same with On AC.