yes it was the solution
Hi everybody,
i try to connect my desktop-pc with iobroker via mqtt. My first try was Eventghost, its nice, butâŠthe mqtt client there is junky and works just half of the time. The other time it produces errorlogs.
So i thougt, lets try iotlink and iâm happy the mqtt seems to be more stable.
Now, after installation and configuration it works how i need it, exept one thing:
I wish to send my monitor in sleep mode. In the commands addon this is possible via:
mqtt.0.iotlink.workgroup.mainframe.commands.displays.off
and
mqtt.0.iotlink.workgroup.mainframe.commands.displays.on
This is working but has a strange behavior.
First problem: Why are there two datapoints for it? I think a âscreenoffâ=true/false should be enough?
Second Problem: Those two Datapoints are switching on every switching flank, so if i want to use them, i first have to determine was the old state is.
Third Problem: It seems, that there is no Datapoint which tells me, the monitor is sleeping or not.
Isnt it possible to make this work like the mute function? There is an info datapoint and an switch datapoint with true/false - perfect.
Any suggestions?
@alexslx Unfortunately, the service crashes randomly after a while. This also happened with 1.x and now also on latest 2.x version, so itâs not an issue introduced in 2.x.
[2020-01-17 00:38:12 +01:00][ERROR][IOTLinkService.Service.WebSockets.Server.WebSocketServer]: Error while trying to disconnect client: System.Net.WebSockets.WebSocketException (0x80004005): Die 'System.Net.WebSockets.ServerWebSocket'-Instanz kann nicht fĂŒr die Kommunikation verwendet werden, da sie in den Zustand 'Aborted' gewechselt ist. ---> System.Net.WebSockets.WebSocketException (0x80004005): Der empfangene Nachrichtentyp 'Text' ist nach dem Aufruf von WebSocket.CloseAsync ungĂŒltig. WebSocket.CloseAsync sollte nur verwendet werden, wenn vom Remoteendpunkt keine weiteren Daten erwartet werden. Verwenden Sie stattdessen 'WebSocket.CloseOutputAsync', um weiterhin Daten empfangen zu können, den Ausgabechannel jedoch zu schlieĂen.
bei System.Net.WebSockets.WebSocketBase.<CloseAsyncCore>d__56.MoveNext()
bei System.Net.WebSockets.WebSocketBase.ThrowIfAborted(Boolean aborted, Exception innerException)
bei System.Net.WebSockets.WebSocketBase.ThrowIfConvertibleException(String methodName, Exception exception, CancellationToken cancellationToken, Boolean aborted)
bei System.Net.WebSockets.WebSocketBase.<CloseAsyncCore>d__56.MoveNext()
--- Ende der StapelĂŒberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bei IOTLinkService.Service.WebSockets.Server.WebSocketServer.<DisconnectClient>d__10.MoveNext()
[WORKGROUP\DESKTOP-VPALK8A][2020-01-17 00:38:12 +01:00][CRITICAL][IOTLink.Program]: Critical Unhandled Exception: System.InvalidOperationException: Die Sammlung wurde geĂ€ndert. Der Enumerationsvorgang kann möglicherweise nicht ausgefĂŒhrt werden.
bei System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
bei System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
bei System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
bei IOTLinkService.Service.WebSockets.Server.WebSocketServer.<DisconnectClient>d__10.MoveNext()
--- Ende der StapelĂŒberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
bei System.Threading.ThreadPoolWorkQueue.Dispatch()
Screen commands can be improved for sure. Iâll take a look on it.
Hi, sorry for your problem. This is known issue for me because of underlaying library used to communicate between the Windows Service and Client Addon used to issue commands to your current running user. Iâll try to improve on this but as it is now it should be reconnecting after any fatal errors.
@All
Iâll try to improve discovery and âundiscoveryâ more. Also, pull requests are always appreciated.
NEED HELP:
If someone can help me writing a better and user-friendly documentation I would love that help. Sometimes I feel it is too much complicated for new users as Iâm too technical
@alexslx It does not reconnect after this unfortunately. The service will show as stopped in the Service Control Manager until manually restarted.
Hi,
Iâve released version v2.0.3 with some fixes related to service crashing and sleep/hibernate.
@lkhdas
You can try the new version as well.
I have an issue where when I restart Home Assistant the values from my servers are not populated until I RDP to my servers and restart the service. If the values change they are updated but this may not happen for a long period or at all. Is there a way to send a command to those servers from a button on home assistant to restart the service? Is there a better or different way to accomplish this?
I did look for an answer to this but couldnât find one.
Thank you for the extremely useful application.
Yes, there is a refresh command.
Let me link the wiki page:
You can use it with the start event from HA:
- id: IOTLink_Startup
alias: IOTLink Startup
trigger:
- platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: "{prefix}/{domainName}/{machineName}/refresh"
payload: ""
PERFECT! Thank you!
Hi,
I have a problem where the service always crashes after around 2 mins. I can initally see the sensors and values in Home Assistant, and they were discovered automatically, but then no updates after the service has stopped. I have Mosquitto on the same Windows machine as IOT Link.
Here is the config:
credentials:
username:
password:
tcp:
enabled: true
hostname: 127.0.0.1
port: 1883
secure: false
websocket:
enabled: false
uri:
secure: false
messages:
qos: 1
retain: false
lwt:
enabled: false
qos: 1
retain: true
connectMsg: "ON"
disconnectMsg: "OFF"
discovery:
enabled: true
topicPrefix: homeassistant
domainPrefix: false
clientId: homeserver
prefix: IOTLink
cleanSession: true
logging:
enabled: true
level: 4
addons:
enabled: true
and here is the log file:
[WORKGROUP\HOMESERVER][2020-02-16 17:00:23 +01:00][INFO][IOTLink.IOTLinkService]: Windows Service is started.
[WORKGROUP\HOMESERVER][2020-02-16 17:00:23 +01:00][INFO][IOTLinkService.Service.Engine.MQTT.MQTTClient]: Trying to connect to broker: tcp://127.0.0.1:1883 (Try: 1).
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/shutdown
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/reboot
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/logoff
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/lock
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/hibernate
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/suspend
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/run
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/displays/on
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/displays/off
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/volume/set
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/volume/mute
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/notify
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/send-keys
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/playpause
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/stop
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/next
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkService.Service.Engine.ServiceAddonManager]: Addon Commands has subscribed to topic commands/media/previous
[WORKGROUP\HOMESERVER][2020-02-16 17:00:24 +01:00][INFO][IOTLinkService.Service.Engine.ServiceAddonManager]: Loading addon: commands
[WORKGROUP\HOMESERVER][2020-02-16 17:00:26 +01:00][INFO][IOTLinkAddon.Service.WindowsMonitorService]: System monitor is activated.
[WORKGROUP\HOMESERVER][2020-02-16 17:00:27 +01:00][INFO][IOTLinkService.Service.Engine.ServiceAddonManager]: Loading addon: windowsmonitor
[WORKGROUP\HOMESERVER][2020-02-16 17:00:28 +01:00][SYSTEM][IOTLinkService.Service.Engine.MQTT.MQTTClient]: ALL YOUR MQTT TOPICS WILL START WITH iotlink/WORKGROUP/homeserver/
[WORKGROUP\HOMESERVER][2020-02-16 17:00:28 +01:00][INFO][MQTTnet.Client.MqttClient]: Connection established successfully.
[WORKGROUP\HOMESERVER][2020-02-16 17:01:53 +01:00][ERROR][IOTLinkService.Service.WebSockets.Server.WebSocketServer]: Error while trying to disconnect client: System.Net.WebSockets.WebSocketException (0x80004005): Instansen System.Net.WebSockets.ServerWebSocket kan inte anvÀndas för kommunikation eftersom den har gÄtt över till lÀget Aborted. ---> System.Net.WebSockets.WebSocketException (0x80004005): Den mottagna meddelandetypen Text Àr ogiltig nÀr WebSocket.CloseAsync har anropats. WebSocket.CloseAsync ska bara anvÀndas om inga fler data förvÀntas frÄn fjÀrrslutpunkten. AnvÀnd WebSocket.CloseOutputAsync i stÀllet om du vill fortsÀtta att kunna ta emot data men stÀnga utdatakanalen.
vid System.Net.WebSockets.WebSocketBase.<CloseAsyncCore>d__56.MoveNext()
vid System.Net.WebSockets.WebSocketBase.ThrowIfAborted(Boolean aborted, Exception innerException)
vid System.Net.WebSockets.WebSocketBase.ThrowIfConvertibleException(String methodName, Exception exception, CancellationToken cancellationToken, Boolean aborted)
vid System.Net.WebSockets.WebSocketBase.<CloseAsyncCore>d__56.MoveNext()
--- Slut pÄ stackspÄrningen frÄn föregÄende plats dÀr ett undantag utlöstes ---
vid System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
vid IOTLinkService.Service.WebSockets.Server.WebSocketServer.<DisconnectClient>d__10.MoveNext()
[WORKGROUP\HOMESERVER][2020-02-16 17:01:53 +01:00][CRITICAL][IOTLink.Program]: Critical Unhandled Exception: System.InvalidOperationException: MÀngden har Àndrats. Det gÄr inte att köra upprÀkningsÄtgÀrden.
vid System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
vid System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
vid System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
vid IOTLinkService.Service.WebSockets.Server.WebSocketServer.<DisconnectClient>d__10.MoveNext()
--- Slut pÄ stackspÄrningen frÄn föregÄende plats dÀr ett undantag utlöstes ---
vid System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
vid System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
vid System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
vid System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
vid System.Threading.ThreadPoolWorkQueue.Dispatch()
Any idea what can be the problem?
- Within ServiceLog, Iâm getting spammed with:
[WORKGROUP\ZUES][2020-02-16 11:20:29 -07:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgents() - Initialized
[WORKGROUP\ZUES][2020-02-16 11:20:29 -07:00][TRACE][IOTLinkService.Service.Engine.ServiceMain]: StartAgents() - Windows Session Found. SessionId: 2 StationName: Console Username: guice IsActive: True
[WORKGROUP\ZUES][2020-02-16 11:20:29 -07:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgent() - Initialized. SessionId: 2 Username: [redacted]
[WORKGROUP\ZUES][2020-02-16 11:20:29 -07:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: GetAgents() - Initialized
[WORKGROUP\ZUES][2020-02-16 11:20:29 -07:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: GetAgents() - Agent Found. SessionId: 2 PID: 10092 Username: [redacted] CommandLine: IOTLinkAgent.exe --agent ws://localhost:9799
[WORKGROUP\ZUES][2020-02-16 11:20:29 -07:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgent() - Agent Found. SessionId: 2 PID: 10092 Username: [redacted] CommandLine: IOTLinkAgent.exe --agent ws://localhost:9799
[WORKGROUP\ZUES][2020-02-16 11:20:29 -07:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgent() - Agent instance is already running for this user. Skipping.
(note, this is with log level 10)
Is this normal? Over and over. âInstance is already running. Skippingâ
Second question:
- Do the logs rotate automatically?
One more:
I just tried the Notification function. It works, almost. Iâm getting THREE notifications per single call. Any clues as to why?
Thanks for this excellent program. Ever since I updated to the latest version v2.0.3 I am getting this error in my logs and the Idle Time sensor no longer works. The other sensors do work. Can I provide any additional info?
Thanks
[WORKGROUP\DDS-ASUS][2020-02-16 23:59:10 -05:00][ERROR][IOTLinkAddon.Service.WindowsMonitorService]: SendAllInformation - Error: System.Management.ManagementException: Not found
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementScope.InitializeGuts(Object o)
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObject.Initialize(Boolean getObject)
at System.Management.ManagementBaseObject.get_Properties()
at System.Management.ManagementBaseObject.GetPropertyValue(String propertyName)
at IOTLinkAPI.Platform.Windows.WindowsAPI.LastBootUpTime()
at IOTLinkAPI.Helpers.PlatformHelper.LastBootUpTime()
at IOTLinkAddon.Service.Monitors.UptimeMonitor.GetMonitorItems(Configuration config, Int32 interval)
at IOTLinkAddon.Service.WindowsMonitorService.ExecuteMonitor(IMonitor monitor)
at IOTLinkAddon.Service.WindowsMonitorService.SendAllInformation()
looks like iâm getting the same errors on version v2.0.3
has this been resolved ?
ta
LeeB
[BERRYS\SATURN][2020-02-25 11:01:49 +08:00][INFO][IOTLink.IOTLinkService]: Windows Service is started.
[BERRYS\SATURN][2020-02-25 11:01:49 +08:00][CRITICAL][IOTLink.Program]: Critical Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at IOTLinkAPI.Configs.MqttConfig.DiscoveryConfig.FromConfiguration(Configuration config)
at IOTLinkAPI.Configs.MqttConfig.FromConfiguration(Configuration config)
at IOTLinkService.Service.Engine.MQTT.MQTTClient.Init()
at IOTLinkService.Service.Engine.ServiceMain.SetupMQTTHandlers()
at IOTLinkService.Service.Engine.ServiceMain.StartApplication()
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.ServiceProcess.ServiceBase.Run(ServiceBase[] services)
at IOTLink.Program.Main(String[] args)
fixed it , uninstalled and reinstalled âŠ
I have uninstalled and reinstalled a bunch of times but still get the same error messages. Too bad as this used to work.
Working great and love the new HA Discovery option.
Is there a way to grab external IP or to detect if a alternate network adaptor is connected? I would like to use this to create a sensor to monitor if my VPN is connected.
[WORKGROUP\CY-PC][2020-03-14 21:13:17 +00:00][ERROR][IOTLinkService.Service.Loaders.AssemblyLoader]: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Cannot load Counter Name data because an invalid index '' was read from the registry.
at System.Diagnostics.PerformanceCounterLib.GetStringTable(Boolean isHelp)
at System.Diagnostics.PerformanceCounterLib.get_NameTable()
at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
at System.Diagnostics.PerformanceCounterLib.CounterExists(String category, String counter, Boolean& categoryExists)
at System.Diagnostics.PerformanceCounterLib.CounterExists(String machine, String category, String counter)
at System.Diagnostics.PerformanceCounter.InitializeImpl()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName)
at IOTLinkAddon.Service.Monitors.CPUMonitor..ctor()
at IOTLinkAddon.Service.WindowsMonitorService..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at IOTLinkService.Service.Loaders.AssemblyLoader.LoadAssemblyDLL(AddonInfo& addonInfo)
[WORKGROUP\CY-PC][2020-03-14 21:13:17 +00:00][SYSTEM][IOTLinkService.Service.Engine.MQTT.MQTTClient]: ALL YOUR MQTT TOPICS WILL START WITH iotlink/workgroup/cy-pc/
[WORKGROUP\CY-PC][2020-03-14 21:13:17 +00:00][INFO][MQTTnet.Client.MqttClient]: Connection established successfully.
Seems to get LWT and Status and a few others but almost every other MQTT status via mqttlens or HA doensât work. any ideas?
Firstly, awesome bit of software - thanks very much
Iâm struggling to ârunâ programs using the run command. My script is:
my_computer_switch_to_tv:
alias: "My Computer - Switch to TV"
sequence:
- service: mqtt.publish
data:
topic: "iotlink/workgroup/adampc/commands/run"
payload: '{ "command": "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\AMD Catalyst Control Center\\TV.lnk", "args": "", "path": "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\AMD Catalyst Control Center", "user": "", "visible": true, "fallback": true }'
Which throws up the error:
[WORKGROUP\ADAMPC][2020-03-18 21:39:16 +11:00][ERROR][IOTLinkAPI.Platform.Windows.WindowsAPI]: WindowsAPI::Run() - CreateProcessAsUser failed. Error Code: 193
If I substitute the example run google chrome (from here: https://gitlab.com/iotlink/iotlink/-/wikis/Addons/Commands), it works fine (opens chrome with " https://iotlink.gitlab.io
" tab open).
Am I not able to run a shortcut? Otherwise I tried this (where the shortcut is point to), with no luck:
payload: '{ "command": "C:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static\\CLI.exe", "args": "Start Load profilename="TV"", "path": "C:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static\\", "user": "", "visible": true, "fallback": true }'
Edit: Did it! Didnât realise that you can only run .exe (and command line files?). The last one worked for me removing the " around âTVâ.