Actions in paper UI

So for bindings I choose them in paper UI, then I can go to configure to set tokens etc… However this seems not to be possible for actions, is this something in the pipeline for OH?

If then go into openhab-conf directory and find the xxxxxx.cfg file, this file is read only for some reason for the openhab user and it also seems not to fill in the settings I made in paper UI, can anyone confirm this?

I recently tried to add the mail and pushover action, but I can not get them to work.
Do I need to restart OH?

Also in the mail.cfg file its unclear if username, password etc should be written “user” or simply user, like refresh interval I assume should just be 5000. it does not state it clearly here :
http://docs.openhab.org/addons/actions/mail/readme.html

So maybe we should update the doc to give examples for username , password so that users knows if it should be with or without " ! I am pretty sure it should be with ", but I tried both and still could not get it to work, so I guess I need to do a reboot, however finding a time slot for that is not always easy!

which exactly is the conf dir that you are using? (is it /etc/openhab2/ or something else?)

The cfg files within OPENHAB_CONF/services/ folder will not be modified by PaperUI since these are usually for compat1x addons which are not configurable from PaperUI.

Example: mail.cfg (Action addon) for using google’s mail servers (you need a gmail account of course):

hostname=smtp.gmail.com
port=587
username=youruser@gmail.com
password=yourpass
from=youruser@gmail.com
tls=true

There is no refresh interval setting for mail.cfg.

I am lost :slight_smile:
In general: don’t use (any) quotation marks when you set config parameters. There are some exceptions of course.
Also (in general), no need to reboot when you configure a cfg file for an addon. OH2 will load the changes auto-magically.

Bonus: Sample OPENHAB_CONF/rules/email.rules:

rule	"All Email notifications"
	when
		Item	P06_Large_LED	changed	from	OFF	to ON
	then
		sendMail("someone@somewhere.com", "HomeR Update", "Office Large LED was switched ON")
end
1 Like

http://docs.openhab.org/addons/actions/mail/readme.html3 there it says “smtp.gmail.com” so I guess thats wrong and that config files dont uses java syntax for strings integers and so on… that all is plain text without “”

Thanks flor clarification, it should be reflected somewhere in the documentation…

Thats the location of mail.cfg and pushover.cfg

So where is the files from paperui stored? And how can I modify them in a text editor?

I still can not get actions to work, I get these fail codes:

For Pushover I get invalid token, does it not work with the trial token? For mail I have no idea…

2017-08-11 11:41:44.582 [ERROR] [rg.openhab.action.mail.internal.Mail] - Could not send e-mail to 'skatun@gmail.com'.
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:587
	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
	at org.apache.commons.mail.Email.send(Email.java:1448)
	at org.openhab.action.mail.internal.Mail.sendMail(Mail.java:157)
	at org.openhab.action.mail.internal.Mail.sendMail(Mail.java:89)
	at org.openhab.action.mail.internal.Mail.sendMail(Mail.java:67)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_121]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_121]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_121]
	at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_121]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1085)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1060)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:991)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:114)[129:org.eclipse.smarthome.model.script:0.9.0.b4]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:901)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:864)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:223)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:459)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:243)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:463)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:243)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:189)[145:org.eclipse.xtext.xbase:2.9.2.v20160428-1452]
	at org.eclipse.smarthome.model.script.runtime.internal.engine.ScriptImpl.execute(ScriptImpl.java:77)[130:org.eclipse.smarthome.model.script.runtime:0.9.0.b4]
	at org.eclipse.smarthome.model.script.engine.ScriptExecutionThread.run(ScriptExecutionThread.java:42)[129:org.eclipse.smarthome.model.script:0.9.0.b4]
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. q23sm73737lfq.92 - gsmtp
	at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2057)
	at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1580)
	at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1097)
	at javax.mail.Transport.send0(Transport.java:195)
	at javax.mail.Transport.send(Transport.java:124)
	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
	... 32 more
2017-08-11 11:41:45.234 [WARN ] [org.openhab.io.net.http.HttpUtil    ] - Method failed: HTTP/1.1 400 Bad Request
2017-08-11 11:41:45.241 [ERROR] [ab.action.pushover.internal.Pushover] - Received error message from Pushover: <?xml version="1.0" encoding="UTF-8"?>
<response>
  <token>invalid</token>
  <errors>
    <error>application token is invalid</error>
  </errors>
  <status>0</status>
  <request>da64aac8-be63-4251-820b-17baae79af3f</request>
</response>

The paperui configs are not stored in a text editable file.

For gmail, have you got tls=true set in /etc/openhab2/services/mail.cfg?

Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. q23sm73737lfq.92 - gsmtp at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2057)

This is my non working mail.cfg

The SMTP server hostname, e.g. “smtp.gmail.com

hostname=smtp.gmail.com

# the SMTP port to use (optional, defaults to 25 (resp. 587 for TLS/SSL))
port=587

# the username and password if the SMTP server requires authentication
username=hskghjkakjghaksdkg
password=kdsjhbkvhsdkv

# The email address to use for sending mails
from=skat....n@gmail.com

# set to "true", if STARTTLS is enabled (not required) for the connection
# (optional, defaults to false)
tls=true

# set to "true", if SSL negotiation should occur on connection
# do not use both tls=true and ssl=true
# (optional, defaults to false)
ssl=false

# set to "true", if POP before SMTP (another authentication mechanism)
# should be enabled. Username and Password are taken from the above
# configuration (optional, default to false)
#popbeforesmtp=

# Character set used to encode message body
# (optional, if not provided platform default is used)
#charset=

Just checking, you’re setting username as your full email address?

No two factor enabled on your gmail account? (I strongly recommend doing that, nothing to do with openhab just good practice! :wink: Tho you’d then need to create a specific app password for openhab)

Just configured my system for gmail, been meaning to do it anyway.

hostname=smtp.gmail.com
port=587
username=<my address>@gmail.com
password=<app specific password>
from=openhab@<my domain - gmail allowed to send for this domain>
tls=true

So the only difference is, I don’t specify ssl=false. Try removing that line totally and see if theres any difference? Might be a bug in the code.

Hmm, Its seems to be something with authentication:

Caused by: javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials 19sm462949ljf.31 - gsmtp

On my gmail account I do have two point verification, could that be the issue?

If you’ve got two factor, then you need to set up an application password to use. You can do that here:

https://myaccount.google.com/apppasswords

This will generate a pretty complicated random password that you can put into your config file. From the same web page you can also delete it if it gets compromised.

The app password did the trick! Thanks. We should add this note to the documentation!