Due to the last myopenhab-cloud problem:
I was wondering if there is any chance to get the cloud connection status displayed within a sitemap or to trigger a mail notification from within a rule?
Due to the last myopenhab-cloud problem:
I was wondering if there is any chance to get the cloud connection status displayed within a sitemap or to trigger a mail notification from within a rule?
The easiest way to display it on a sitemap would be use the Webview element to display http://status.openhab.org/check/359410.
Thanks for your answer but as we saw today, the output of
http://status.openhab.org/check/359410
is not reliable⦠So I was thinking if there is the other way round - to check if the OH cloud-connector is onlineā¦
Ah, I misunderstood. Youāre looking for your OH server to somehow indicate whether or not itās able to connect to the openHAB cloud. I was reading you the other way around.
Yes right! Yesterday the web-status-page showed everything ok but the openhab-cloud-connector got disconnected⦠As I can see the status-messages in the logfile, I was wondering, if itās possible to get the status into an itemā¦
You should be able to query the status page openHAB Cloud - Events (myopenhab.org) from inside a rule using your myopenhab credentials, then parse the contents. Eventually even using the HTTP binding.
To get the online status you may check if this script works: Myopenhab connection state - #12 by Wolfgang_S
After a hint from Ritch, I am now using the logreader-binding to see when cloud gets disconnected. That fits my needs as I wanted to know when the cloud connection gets interrupted (no matter if itās a local or a remote problem)
Sure! I am just in the migration phase to OH3.1 but I guess it will work the same way like in OH2.5.
So first of all I created a logreader thing:
And as Custom Patterns I used this string (please note the pipe-sign between the 2 strings):
Disconnected from the openHAB Cloud service|Connected to the openHAB Cloud service
I also increased the Refresh Rate from 1000 to 10000 milliseconds as this should be enough and events less than 10 seconds shouldnāt create panic.
Basically you need only 2 items - one for the custom event string and the other one is just a virtual switch to display the connection status:
String LogReaderLastCustomEvent "Last custom event [%s]" <error>
{channel="logreader:reader:openhabcloud:lastCustomEvent"}
Switch OpenHAB_CLOUD_connected "OH Cloud Connected [%s]" <network>
And a simple rule which triggers after a custom event string appeared:
rule "LogReader OpenHAB-Cloud"
when
Channel "logreader:reader:openhabcloud:newCustomEvent" triggered
then
if (LogReaderLastCustomEvent.toString.contains("Disconnected from")) {
postUpdate(OpenHAB_CLOUD_connected, OFF)
LineMessage.sendCommand ("Openhab Cloud disconnected")
}
if (LogReaderLastCustomEvent.toString.contains("Connected to")) {
postUpdate(OpenHAB_CLOUD_connected, ON)
LineMessage.sendCommand ("Openhab Cloud connected")
}
end
!!! Please take care to NOT log the LogReaderLastCustomEvent-String with logInfo - you would run into an endless loop (trust me, I know āsomebodyā who did this ) !!!
Finally a small item in the sitemap:
Text item=OpenHAB_CLOUD_connected valuecolor=[=="OFF"="red",=="ON"="green"]
Here is the result:
A side note:
Thanks!
This got my attention: how do you send to WhatsApp from within OH ?