Local Files in Rule 4.0

Up to 1GB

Take a look at this:

It may be of some use in this regard.

Marco

I think you're crossing the point where writing an app is the better tool. RM is great, but it's not designed to be a general purpose programming language. If you haven't already, it's probably time to start looking into groovy apps if you feel the need to parse JSON for your rules.

1 Like

"Now all I need is some way to send email via my SMTP provider from the HE, and I'll have zero dependencies."

If you happen to have a RPI online, you can do this with this approach:

I have to dig, there is a Linux command line tool that sends email. I wonder if it would work.

I need to look it up again.

Yeah I saw that approach. I don't have a RPi (not that it would be difficult to set one up), but I do have a NAS that I can send commands to with Telnet. That's what I do now, and my emails go via curl on my NAS to my SMTP server. I could do something similar on a RPi, too, or set up Node/sendmail on my NAS.

What I want to do is get rid of the Telnet, and send SMTP (over SSL/TLS) from the HE.

curl

Kind like:

echo 'To: ${emlTo}\nSubject: ${emlSubject}\nFrom: ${emlFrom}\nContent-Type: text/plain;\n${state.EmailBody}' | curl --url 'smtps://${emlServer}:${emlPort}' --ssl-reqd --mail-from '${emlFrom}' ${mailRcpts}--upload-file '-' --user '${emlUsername}:${emlPassword}'

Here's a really ugly hack of some things that use Telnet to run curl, which sends the email:

I'd like this too. Heck, my printer can send email using SMTP via my google.com account, so it shouldn't be too high a workload for the hub to send email.

Yes, you can cobble together a solution with a raspberry pi, but it's easy to make security mistakes. And black hats just love open mail relays.

So can we use local files to store cookies from an http get/post and then send that cookie with a subsequent http get post?

There are tons of small thing I could do with RM provided I can logon and get a cookie first.

I don't think so. I don't believe RM is going to let you grab a header value like that. You also don't need a file for this, I think a variable is probably the better storage mechanism. Either way, I think an App is probably what you want here which can definitely do what you're saying (and store it in a variable, apps don't support files)

Im just trying to avoid learning groovy

Understood. Unfortunately though, while RM is powerful, it's not a replacement for a full featured programming language. So while you can make a call to an HTTP endpoint, you can't really parse the results out to pull out a specific cookie out of a header like that.

Is there anyway to call a binary if I upload it to the hub ?

What do you mean by a binary? An exe file? An image? If you just go to the URL of the file it will open/download

Binary/Executable

Yes it will let you upload an exe. You could then download it by clicking the link to the /local/ folder, Is that what you're asking?

No, I'm wondering if you can execute it from groovy or rule machine?

No. The Hubitat isn't even a Windows machine, there is no way for it to run an EXE. Further that would be a very bad thing. It would be a HUGE security hole.

1 Like

Even the abillity to say capture and use cookie for this rule would allow me to log into a sessorn and make a secondary call after login.

I don't need to see or manipulate the cookie. Just be able to use it on subsequent calls.

I might make a formal feature request.

Same here. I have a doorbell sound setup which now plays locally

1 Like