IOT Link - Windows Management using MQTT

I there a way to make a MQTT Switch for the screen on/iff command? DOon’t want to use scripts but create a MQTT switch

Does v2.2.2 correct the issue of sensors going to “unknown” after your PC resumes from sleep? I had that issue even on 2.2.1, but I think 2.2.2 fixes it. I just updated so I’ll test for a few days and see if it fixes things.

fyi, I still have that same problem with 2.2.2

1 Like

I’m on 2.2.2 so…no it doesn’t fix it.
I tested a few short periods of sleep and it works fine, but it never works after being asleep overnight. I always have to restart the service.

I can’t say for sure, but I believe that prior to 2.2.2 my sensors would say “unavailable” and after 2.2.2 they now say “unknown”

1 Like

Ah I see. Well I suppose, in the meantime, I’ll continue to use Task scheduler to restart the IOTLink service when the computer wakes from sleep

1 Like

@kalyway101 I’ve been trying to do this but can’t get around the fact that it needs admin privileges to run. Do you have a step by step for this?

I have a batch file with
net stop iotlink && net start iotlink
and task created that runs on unlock.

If I manually run the task it works but it doesn’t work when I unlock the pc.
image

2 Likes

I have “Run whether user is logged on or not” instead of “Run only when user is logged on”. For my trigger, I chose it to be restarted “On workstation unlock of any user”.

I just have a button in the Lovelace UI that changes/lets me lock my PC via the MQTT commands so this setup works well for me

Same config I had but it didn’t work until I changed 2 settings after googling.
“Start In (optional)” had to be set and “Wake the computer to run this task”.
No clue why either of those would need to be set for this to work (especially since it worked fine when I manually ran the task) but I can’t complain since it now works :man_shrugging:

2 Likes

hi can somebody guide me with IOT Link installation? I have done everything but my mqtt is not integrating my PC

Is your MQTT broker running OK in home assistant ?
Do you have other MQTT devices that are working OK ?
Have you pointed IOTLink configuration to your MQTT broker ?

Have you checked the logs from IOT Link?

I have just installed IOT Link and I have all the sensors added in Home Assistant, however the one thing I wanted to report on was whether the PC was asleep or not.

There is a Power Status but when I set the PC to sleep the next time it refreshes all the statuses too Unavailable. It goes too unavailable when I power it off also. Perhaps I am misunderstanding the status.

Is there any way I can get the sensor to give the state SLEEP or OFF when the machine sleeps or is shut down?

I don’t believe there is a way to know if the pc is asleep or powered off. Since no services are running (including the IOT service) when the pc is asleep/off, there is no way to report status of any kind. This is why it goes to “unavailable”.

You could create your own template sensor and have it report “unavailable” as “asleep” or anything else you want…but again, there would be no way to distinguish “off” vs “sleep”.

1 Like

I was hoping that the service would publish its final power command as the PC was executing it, but perhaps that was wishful thinking. I will have a play with template sensors as I haven’t really used those.

Great app I Just find out about it, very usefull, but there’s a strange bug hapening to me, The mouse cursor keeps desapering and appearing and decending on screen, very annoying, when I stop The service The issue stops.

I have this issue too. Currently restarting the service on wake using Task Scheduler.

Opened an issue in gitlab: Disconnecting from MQTT server after sleep/wake. Not reconnecting. Having "MQTTClientManager::OnMQTTDisconnectedHandler() - DUPLICATED Disconnected Event" (#118) · Issues · IOT Link / IOT Link Service · GitLab
Please post your logs if you experience this issue too.

Perhaps this happens to machines with several network interface? I have this on a laptop that has both lan and wifi connected.

Hi all,
yesterday I successfully installed this integration for my 3 laptops.
Right now although 2 of them are on they are unavailable in HA?
What should I look for?
(yesterday all day all were working fine)

Stop the service and then start it gain, see if that makes them show up again. Were the laptops sleeping? If so read above there are issues with sleep mode some workarounds also above.

Yes, probably that was the problem. I tried to find a workaround but I couldn’t.
Today this is the case for 2/3 of the laptops in the house.

Workaround is use the windows task scheduler to restart the iot service on every resume