[OBSOLETE] Host Pinger (IP based Online State / Presence)

Sorry I don’t know what you mean? If you don’t want host pinger to turn the devices on and off then don’t put them in host pinger?

If you just want to report on state then add the host pinger virtual devices instead?..

It makes no sense to add kuku devices to host pinger?

Sorry I have been so slow to respond. Life!

The PCs I am trying to interact with are added using the DTH (“Turn this Device On/Off With Status”). Also, as a note, I too find that the devices turn on/off randomly, which is what started me trying to restrict the ability to turn off the PC. For no reason, it would shut down. FYI - there is nothing else with the ability to shut down the PC outside of being on the PC and asking it to shut down.

Random shutdowns were not an issue until attempting to use EG & HP.

Again, I appreciate all fo the help.

No problem :slight_smile:

Assuming that by “the DTH” you mean the Host Pinger DTH… and not a DTH that actually controls your computer, then there is no way that the DTH or the HP app can directly shut down or turn on your computers… although I assume what you actually mean here is that the DTH is showing as offline when it’s online? If that’s the case are you sure that the PC has not gone to sleep… this may force the network card in to power save sleep mode? (you should be able to change this in device manager)… Also I assume you are not using a wireless card… if so loss of connectivity could impact online status…

Hopefully that helps, but if not if you could clarify your question :wink:

I apologize. I posted earlier. The details of what I am trying to accomplish are listed above.

You had asked: “What do you have under “Turn This Device On/Off with Status” in the host pinger app? you should either have a switch or hostPinger virtual DTH?”

So I was responding to that question, as I have not had success resolving the refresh issue with the status.

The secondary comments I included in my last post were to speak to the other posters experience. I know the host pinger cannot shutdown the pc. EventGhost is what is doing the shutting down, but the host pinger behavior does appear to be part of the equation. If I turn off the host pinger the problem with the ghost shutdowns goes away. It could be coincidental and I didn’t spend much time digging into it. I went straight to trying to prevent the ghost shutdowns from occurring, which is the source of my original post.

In any case, I really am just hoping to figure out how to get the host pinger to read the actual state of the machine, without having to restart the host pinger to force a refresh of the status. I apologize if I am using the incorrect terms in trying to resolve this.

No that’s fine, I just wasn’t clear on what your issue currently is…

So the Host Pinger DTH should always reflect the actual state of the device +/- the number of seconds you have set this to refresh in the config.config file, that’s entirely it’s purpose! This should not require a restart as this DTH does not alter state unless requested by the host pinger exe…

If you however have another switch to toggle the power state, then you would need to build a core rule to state if the dummy switch changes state then after x seconds check the state of the host Pinger DTH, if on then switch the dummy switch on…

Make sense?

I’m not sure if this is a result of changes to Mono or Ubuntu since this post was last updated, but I was unable to get this running solidly in the background using the above instructions. When running:

mono STHostPinger.exe &

the process would stop waiting to write tty-output. You can detect this by running jobs -l In order to keep mono running I needed to change the starting command to:

mono STHostPinger.exe < /dev/null &

However, that wrote all messages to the active terminal. Which is fine if you’re on the console, but if you’re running things over SSH as soon as your session closes, the process ends. It would also not start on boot reliably with the above. In order to get this running reliably on boot and working properly I created a dedicated user for most of my SmartThings tasks and granted this user its own crontab. I then saved the config.config file and the STHostPinger.exe file in a common directory and added the following to that user’s crontab. This allows the job to start at reboot as a non-root process, and logs all changes to the default console (the screen) on the Linux host. You will need to update your path as required:

@reboot mono /SmartThingsCommon/STHP/STHostPinger.exe < /dev/null > /dev/tty0 &

1 Like

Hi Robbie, thanks for sharing your issue and the solution! I’m sure it will be useful to some people :slight_smile:

I’ve also updated the first post to link to yours!

1 Like

I wanted to use this but wasn’t into installing and using special programs to get the EXE to work so I wrote up a little python script to mimic the functionality of the exe.
It takes the same settings, but can be configured from a web interface as well.

Note: there is not security implemented - do not open the server up to the internet

1 Like

Great work! I’m on my phone at the moment… but when I’m next on the computer and remember to do so I’ll update the first post!

Thanks!

Awesome, glad to help.
Also, I was wondering if this is a bug or maybe something went a bit wrong with my install of Host Pinger.
When I add a virtual device it works and adds the device but it gives an error. Looking at the logs and the smartapp the error seems to be because on the delete page the inputs are set to
required:true
I set them to required: false in my install and it stopped the error, just wondering if it also broke something else possible?

It could be a bug introduced when SmartThings updated the app, it happens sometimes when they put in extr validation… if setting to false works then I expect that’s how it should be set, I’d need to double check the code though I wrote it quite a while back :slight_smile:

I guess its nice thats all that got broken by those funny samsung folks, well, just for your reference if you get the time or feel frisky :stuck_out_tongue: its in the pageDevDetails(params) method.

So I’ve just had a look at this in work and I can’t replicate the issue…

The reason I have the required flag it that it allows me to set the item as green or red based on online status…

As I’m not getting the same issue, I assume in that case you are on Android, is that correct?

Also in your GitHub you are linking to a fork of my version, but my version has a couple of subsequent fixes after the fork… is there something in the fork that is needed for yours to work, I think the fork is only amendments to the exe?

For reference my link is:

As an aside… I’ve not seen the fork before - but looks like there are some really good changes in there though! Clearly not someone fumbling through code like me :slight_smile:
When I’ve got some time, I’ll download the fork and give it a go… if I can understand what’s going on and Craig is fine with it I’ll merge it back in to the main project…

I’ve also updated the first post with links to your script… Any changes let me know…

Also I meant to ask… do you know specifically which required flag was causing the issue… if not I’ll try an replicate on an android device this evening… the required flag isn’t required, but it does look better, I may switch out for an icon instead if it’s causing issues…

I’ve fixed this now and up on github, hitting back didn’t show the error but hitting done did… at least on android… I didn’t re-check my iPhone might have just hit back on that screen :slight_smile:

You are corrrect, It was on android where I had the isssue. Ill update and check it out later this evening
And I will change that link as soon as I get a chance that was my mistake, Ill be honest I am terrible with git and many times if its git related I will find a way to get something wrong haha

Also, thanks for adding my link to the first post, I hope its useful for some people

1 Like

I got it mostly working on my rpi3. But after the initial check the interval just shows checking with empty result. So the script is only being executed once and not updating anymore after the initial check.

Did I forgot something?

Assuming it is showing the current state of what you are monitoring then the screen will only update when that device updates state…

Ah ok, so in the shell if I run STHostPinger in the begin he will show: send request, status : ONLINE.

Subsequent poll will only give response message if the state changes, else I will see nothing. Correct?

Thanks

This is how it works for me. Simplicity at its finest!

1 Like