Using External Information


#1

1) Give a description of the problem
Hi, i am wondering if WebCoRE has a way to read files on a computer or if anyone knows of a Hubitat plugin to read a .txt files on a computer. This way i could set a piston to do different things based on out side information. This will be useful as i have a webscrapping bot relaying information about firecalls as i am volunter firefighter and need a way to hook that application into WebCoRE.

I guess what i am asking is, if anyone knows of a way to get infromation from outside of WebCoRE or hubitat into it.

2) What is the expected behaviour?
Have my .exe output a .txt files, WebCoRE in anyway reads the information from that .txt and can set a variable to the text information. Dosent need to happen form a .txt file i could set it up to be something else.

3) What is happening/not happening?
Finding a way to do this :frowning:


#2

I use the free app called EventGhost to get data from my PC into webCoRE.

Honestly though, any program that can make a web request should be able to pass variables directly to webCoRE by adding arguments to the end of a piston’s External URL.


#3

If you go this route, here are a couple of posts that showcase data going both ways.

  • webCoRE > EventGhost
  • EventGhost > webCoRE

#4

This sounds perfect,

I had someone else sugest the same application. I downloaded it and it seems very complicated. Adding varibales to the end of the External URL is the way i would love to do it as the external URL is how i currently trigger the piston.

Ill look into this a little more and ask if i need some more help

Thanks a bunch.


#5

For the record, there is no need to worry about any Device Handlers or SmartApps…
… and the only required plugin in EventGhost is “Webserver”.

(although “Speech” is cool too if you want your PC to occasionally speak)


#6

Speech would be awesome, i could have it read out the call information, only problem would be that i plan on hosting this all on a VPS eventualy and so that would go out the window.


#7

I have not tested on a VPS:
inbound triggers, (webCoRE to EventGhost) …

I would imagine that:
outbound triggers, (EventGhost to webCoRE) should not be a problem.


#8

I’d be interested in checking out the text file and the keywords/phrases you’re looking for.


#9


https://gyazo.com/5148c8922b543d4c3e844876421e335d

https://gyazo.com/3bf73c3d03200a44b0f346248178515a

Thats the premis of them.

All i need is the code.txt type.txt and formatted.txt

Dont need to look for any keywords or phrases, just the whole string.


#10

My two cents?

If your “webscrapping bot” can make web requests, then I would go directly from that app to a piston’s External URL. (totally bypassing EventGhost). I’d let webCoRE handle the incoming variables, and decide which path to take afterwards.


#11

Do you have any idea on how i could do this?

Its a simple VB.NET application. Iv honestly got no idea on how to add variables to a External URL request. Is it something inside of WebCoRE or something inside of my VB app? I just dont understand how i send Data through the External URL.


#12

Quick answer:

After the URL, you can add anything in this format:
?description=data
or
?event=currentEvent&info=currentInfo


By adding arguments to the end of your External URL, it will be seen in that piston.
(notice the ending in the example below)

https://api.smartthings.com/api/token/123abc/smartapps/installations/456def/execute/:789abc:?PcLocked=false

In a piston, you can:
Set variable string = $args.PcLocked
… and in this case, the variable called “string” would be set to “false”.

You can see more details at the earlier link.


#13

Thankyou that makes alot more sense.

I have the variables correctly set up in a WC piston. Activating the normal Execute URL shows a null value for the variables (as expected). However once i add: ?code=CODE1
To the end of the URL it displays this:

Its reading the arument as part of the token.

Im sorry to be such a pain!


#14

Your piston has to be told what to look for.

In this case, something like:

define
    string code = (no value set)
end define

execute
    Set variable code = $args.code
end execute

The string variable named “code” will be set to CODE1


#15

Yes, i have these set in the piston. Thats why i am so confused.
Should have attached an image.


https://gyazo.com/a23b31c32c228f2c554e6e5ed2b8b0f6


#16

I just noticed you lost a colon in your URL… Right after the 21

pic


#17

Just tried that and it still thinks that it is apart of the Token. Returning the same error.


#18

OKokok so i worked it out.

Turns out the access token is an argument in its self.

Therefor i needed to use &code=____ as the token started the arguments


#19

Hey,

I would just like to thank you sooo much. Just had my application send a cutom URL and send information to WebCore. This is honestly a life saver. Cant thank you enough.


#20

Awesome! Glad I was able to help!