[SOLVED] MailTimer Switch not working properly

  • Platform information:
    • Hardware: Raspberry Pi , Arduino Uno, nRF24L01
    • OS: Openhabian 4.14.79-v7+ #1159
    • Java Runtime Environment: Java™ SE Runtime Environment (build 1.8.0_201-b09)
      *Java HotSpot™ Client VM (build 25.201-b09, mixed mode)
    • openHAB version:2.4.0-1
    • I am using MySensors via Serial Gateway through the nRF24

Hello guys, I am new to openhab and have learned a lot from the community so far, so thank you all for the great tutorials and help you provide on here! but it seems like I hit a brick wall here and I may need some help :slight_smile: As this happened twice in a row now, and would like to know why this is happening.

A little information about what I am doing:
I am trying to monitor two temperature sensors, and if they go above 30 degrees, I get an email alert, so far so good & I have been successful in doing so, however once I started introducing a timer switch in home.items, and once I added it to HABpanel, things started to get crazy, my node stopped communicating with the gateway properly! and had to completely remove my nodes from OpenHab, and even give the same sensors and same Arduino a different node ID for it to reinitialize. Also reinstalled MySensors… not sure which exactly fixed the issue to be honest…
.
.
.
I will only include the code for 1 of the sensors to minimize confusion, but I had all the rules in the same file. each with its own rule name.

home.items file: please note this is the only switch that is added via the home.items file, everything else is done through PaperUI & HABPanel.

Switch MailTimer_10Mins_Freezer { expire="10m, command=OFF" }

AlertSwitch.rules file:

rule "FreezerAbove30"
when
    Item Freezer_Temp_Temperature received update
    then
    if (Freezer_Temp_Temperature.state > 30|°C && Freezer_Rule_Switch.state != OFF && MailTimer_10Mins_Freezer.state != ON) {
        sendMail("myemail@gmail.com","Freezer Temprature Warning", "The Temprature in the Freezer is: " +Freezer_Temp_Temperature.state.toFullString)
        MailTimer_10Mins_Freezer.sendCommand(ON)
    }
end

I was able to get the email alert button to function properly, however that was before I added the rules for the 10 minute timer switch, which by the way does trigger when temprature goes above 30, however right after this happens, everything breaks :frowning: :frowning:

I apologize in advance for the obnoxious long names, and no my freezer and fridge will not be set at 30 degrees Celsius :wink:

Maybe the parser has trouble with QuantityTpe and AND. Please try

   if (Freezer_Rule_Switch.state != OFF && MailTimer_10Mins_Freezer.state != ON && Freezer_Temp_Temperature.state > 30|°C) {

or

   if (Freezer_Rule_Switch.state != OFF && MailTimer_10Mins_Freezer.state != ON)
        if(Freezer_Temp_Temperature.state > 30|°C) {

instead.

What are you expecting the rule and timer item to do exactly?
At the moment this timer does nothing apart from expiring

If I got ir right, the idea is to avoid more than one Mail in ten Minutes :slight_smile:

Thanks, away for now. Will have a look in the morning reading rules on a phone screen is not ideal.

Yes exactly, however I want the ability to toggle the option off as well, thats why I added the switch in HABPanel.

I will be demonstrating this to multiple people, so I must be able to toggle the 10 minute timer to off as well.

Isn’t it weird though that, running the above rules, breakers my connection with the node, and I am having to reinitialize the sensors, and use a different node_ID

I tried disabling the .rules file and commenting out the switch from my home.items file, rebooted the RPi3 and still didn’t work.

I am going to try your suggestion above, will report back when I try it.

Thank you

Hello again guys,

so it seems like I am stuck now, can’t get the node back online even though I tried everything I did last time :confused:

The line that keeps showing up and I am mostly considered about is this:
[WARN ] [.discovery.MySensorsDiscoveryService] - Cannot automatic discover thing node: 30, child: 255 please insert it manually

2019-02-25 02:20:18.531 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.0.18:8080

2019-02-25 02:20:18.534 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.0.18:8443

2019-02-25 02:20:19.220 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui

2019-02-25 02:20:19.245 [DEBUG] [org.openhab.binding.mysensors       ] - BundleEvent STARTING - org.openhab.binding.mysensors

2019-02-25 02:20:19.252 [DEBUG] [org.openhab.binding.mysensors       ] - BundleEvent STARTED - org.openhab.binding.mysensors

2019-02-25 02:20:19.502 [DEBUG] [org.openhab.binding.mysensors       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=353, service.bundleid=216, service.scope=bundle, component.name=org.openhab.binding.mysensors.factory.MySensorsHandlerFactory, component.id=212} - org.openhab.binding.mysensors

2019-02-25 02:20:19.856 [INFO ] [b.core.service.AbstractActiveService] - Expire Refresh Service has been started

2019-02-25 02:20:20.183 [DEBUG] [nsors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge

==> /var/log/openhab2/events.log <==

2019-02-25 02:20:20.191 [hingStatusInfoChangedEvent] - 'mysensors:bridge-ser:1d520754' changed from UNINITIALIZED to INITIALIZING

==> /var/log/openhab2/openhab.log <==

2019-02-25 02:20:20.259 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist.

2019-02-25 02:20:20.264 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Cache (given_ids) content: [0, 1, 2, 3, 5, 6, 7, 8, 10]

2019-02-25 02:20:20.295 [DEBUG] [col.serial.MySensorsSerialConnection] - Enabling connection watchdog

2019-02-25 02:20:20.300 [DEBUG] [col.serial.MySensorsSerialConnection] - Connecting to /dev/ttyUSB30 [baudRate:115200]

2019-02-25 02:20:20.312 [DEBUG] [org.openhab.binding.mysensors       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=364, service.bundleid=216, service.scope=singleton} - org.openhab.binding.mysensors

2019-02-25 02:20:20.314 [DEBUG] [.discovery.MySensorsDiscoveryService] - Starting MySensors discovery scan

2019-02-25 02:20:20.316 [DEBUG] [nsors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE!

2019-02-25 02:20:21.380 [DEBUG] [col.serial.MySensorsSerialConnection] - Serial port event listener started

2019-02-25 02:20:21.382 [DEBUG] [col.serial.MySensorsSerialConnection] - Successfully connected to serial port.

2019-02-25 02:20:21.409 [WARN ] [col.serial.MySensorsSerialConnection] - Skipping I_VERSION connection test, not recommended...

2019-02-25 02:20:21.420 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 255;3;0;14;Gateway startup complete.

2019-02-25 02:20:21.431 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [0,1,2,3,5,6,7,8,10]

2019-02-25 02:20:21.434 [INFO ] [col.serial.MySensorsSerialConnection] - Successfully connected to MySensors Bridge.

==> /var/log/openhab2/events.log <==

2019-02-25 02:20:21.437 [hingStatusInfoChangedEvent] - 'mysensors:bridge-ser:1d520754' changed from INITIALIZING to ONLINE

==> /var/log/openhab2/openhab.log <==

2019-02-25 02:20:21.440 [WARN ] [rsAbstractConnection$MySensorsReader] - Exception on reading from connection

java.text.ParseException: class java.lang.NumberFormatException : For input string: "Gateway startup complete."

	at org.openhab.binding.mysensors.internal.protocol.message.MySensorsMessage.parse(MySensorsMessage.java:342) ~[216:org.openhab.binding.mysensors:2.4.0.201812040738]

	at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection$MySensorsReader.run(MySensorsAbstractConnection.java:338) [216:org.openhab.binding.mysensors:2.4.0.201812040738]

	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

2019-02-25 02:20:21.462 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;0;0;18;2.3.1

2019-02-25 02:20:21.496 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Presentation Message received

2019-02-25 02:20:22.296 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [0,1,2,3,5,6,7,8,10]

2019-02-25 02:20:22.301 [WARN ] [.discovery.MySensorsDiscoveryService] - Cannot automatic discover thing node: 0, child: 255 please insert it manually

2019-02-25 02:20:22.306 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 30;255;0;0;17;2.3.1

2019-02-25 02:20:22.309 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Presentation Message received

2019-02-25 02:20:22.316 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [0,1,2,3,5,6,7,8,10,30]

2019-02-25 02:20:22.321 [WARN ] [.discovery.MySensorsDiscoveryService] - Cannot automatic discover thing node: 30, child: 255 please insert it manually

2019-02-25 02:20:22.326 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 30;255;3;0;6;0

2019-02-25 02:20:22.330 [DEBUG] [rs.internal.gateway.MySensorsGateway] - I_CONFIG request received from M, answering: (is imperial?)false

2019-02-25 02:20:22.335 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 30;255;3;0;11;Temperature Sensor

2019-02-25 02:20:22.342 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 30;255;3;0;12;1.1

2019-02-25 02:20:22.342 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 30;255;3;0;6;M

bundle:list in karaf


START LEVEL 100 , List Threshold: 50
 ID │ State    │ Lvl │ Version                │ Name
────┼──────────┼─────┼────────────────────────┼───────────────────────────────────────────────────────────────────────────────────
 20 │ Active   │  80 │ 5.3.1.201602281253     │ OSGi JAX-RS Connector
 21 │ Active   │  80 │ 2.7.0.v20170129-0911   │ Gson: Google Json Library for Java
 22 │ Active   │  80 │ 18.0.0                 │ Guava: Google Core Libraries for Java
 23 │ Active   │  80 │ 3.0.0.v201312141243    │ Google Guice (No AOP)
 24 │ Active   │  80 │ 3.18.1.GA              │ Javassist
 26 │ Active   │  80 │ 3.5.5                  │ JmDNS
 28 │ Active   │  80 │ 1.0.0                  │ Units of Measurement API
 30 │ Active   │  80 │ 1.1.0.Final            │ Bean Validation API
 31 │ Active   │  80 │ 2.0.1                  │ javax.ws.rs-api
 32 │ Active   │  80 │ 3.2.0.v201101311130    │ ANTLR Runtime
 35 │ Active   │  80 │ 3.2.1                  │ Commons Collections
 36 │ Active   │  80 │ 1.1                    │ Commons Exec
 37 │ Active   │  80 │ 2.2.0                  │ Commons IO
 38 │ Active   │  80 │ 2.6                    │ Commons Lang
 47 │ Active   │  80 │ 4.2.1                  │ Apache Karaf :: OSGi Services :: Event
 63 │ Active   │  80 │ 4.6.0                  │ Apache XBean OSGI Bundle Utilities
 64 │ Active   │  80 │ 4.6.0                  │ Apache XBean :: Classpath Resource Finder
 65 │ Active   │  80 │ 2.12.0.v20160420-0247  │ EMF Common
 66 │ Active   │  80 │ 2.12.0.v20160420-0247  │ EMF Ecore
 67 │ Active   │  80 │ 2.11.0.v20160420-0247  │ EMF Change Model
 68 │ Active   │  80 │ 2.12.0.v20160420-0247  │ EMF XML/XMI Persistence
 69 │ Active   │  80 │ 3.8.0.v20160509-1230   │ Common Eclipse Runtime
 70 │ Active   │  80 │ 3.6.100.v20160223-2218 │ Extension Registry Support
 80 │ Active   │  80 │ 9.4.11.v20180605       │ Jetty :: Proxy
 94 │ Active   │  80 │ 0.4.1.v20180515-1321   │ org.eclipse.lsp4j
 95 │ Active   │  80 │ 0.4.1.v20180515-1321   │ org.eclipse.lsp4j.jsonrpc
 96 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome OAuth2Client
 97 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Config Core
 98 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Configuration Discovery
 99 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Configuration mDNS Discovery
100 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Config Dispatcher
101 │ Active   │  75 │ 0.10.0.oh240           │ Eclipse SmartHome Config XML
102 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Core
103 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Core Audio
104 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Core Binding XML
105 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Core ID
106 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Core Persistence
107 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Scheduler Service
108 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Core Semantics
109 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Core Thing
110 │ Active   │  75 │ 0.10.0.oh240           │ Eclipse SmartHome Core Thing XML
111 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Transformation Service
112 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Core Voice
113 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Console
114 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Console for OSGi runtime Karaf
115 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome HTTP Interface Bundle
116 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome JavaSound I/O, Fragments: 183
117 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Monitor
118 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Net I/O Bundle
119 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome REST Interface Bundle
120 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Core REST API
121 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome REST mDNS Announcer
122 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome REST Interface JAX-RS optimization Bundle
123 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Sitemap REST API
124 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome SSE REST API
125 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Voice REST API
126 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Bonjour/MDS Service Discovery Bundle
127 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Web Audio Support
128 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Model Core
129 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Item Model
130 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Item Model IDE
131 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Item Model Runtime
132 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Language Server
133 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Persistence Model
134 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Persistence Model IDE
135 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Persistence Runtime
136 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Rule Model
137 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Rule Model IDE
138 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Rule Runtime
139 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Script
140 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Script Model IDE
141 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Script Runtime
142 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Sitemap Model
143 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Sitemap Model IDE
144 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Sitemap Runtime
145 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Thing Model
146 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Thing Model IDE
147 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Thing Model Runtime
148 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Json Storage Service
149 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome UI
150 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome UI Icons
151 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Classic IconSet
152 │ Active   │  80 │ 2.14.0.v20180522-1629  │ Xtend Runtime Library
153 │ Active   │  80 │ 2.14.0.v20180522-1629  │ Xtend Macro Interfaces
154 │ Active   │  80 │ 2.14.0.v20180522-1821  │ Xtext
155 │ Active   │  80 │ 2.14.0.v20180522-1833  │ Xtext Common Types
156 │ Active   │  80 │ 2.14.0.v20180522-1821  │ Xtext IDE Core
157 │ Active   │  80 │ 2.14.0.v20180522-1821  │ Xtext Utility
158 │ Active   │  80 │ 2.14.0.v20180522-1833  │ Xbase Model
159 │ Active   │  80 │ 2.14.0.v20180522-1833  │ Xbase Generic IDE Services
160 │ Active   │  80 │ 2.14.0.v20180522-1629  │ Xbase Runtime Library
175 │ Active   │  80 │ 1.9.6                  │ MIME streaming extension
177 │ Active   │  80 │ 6.2.0                  │ org.objectweb.asm
178 │ Active   │  80 │ 6.2.0                  │ org.objectweb.asm.commons
179 │ Active   │  80 │ 6.2.0                  │ org.objectweb.asm.tree
180 │ Active   │  90 │ 2.4.0                  │ openHAB Core
181 │ Active   │  80 │ 2.4.0                  │ openHAB Karaf Integration
183 │ Resolved │  80 │ 2.4.0                  │ openHAB Sound Support, Hosts: 116
184 │ Active   │  80 │ 2.4.0                  │ openHAB Dashboard UI
189 │ Active   │  80 │ 1.0.2                  │ Units of Measurement Common Library
190 │ Active   │  80 │ 1.0.8                  │ Units of Measurement Implementation for Java SE
196 │ Active   │  80 │ 2.4.0                  │ HomeBuilder User Interface
199 │ Active   │  80 │ 3.14.0                 │ nrjavaserial
200 │ Active   │  80 │ 3.15.0.OH2             │ nrjavaserial
201 │ Active   │  80 │ 3.3.0                  │ Commons Net
202 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Configuration USB-Serial Discovery
203 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Configuration USB-Serial Discovery Linux sysf Scanning
204 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Config Serial
205 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Serial Transport
206 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Serial Transport for RXTX
207 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Serial Transport extension for RXTX RFC2217
208 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Basic UI, Fragments: 210
209 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Paper UI, Fragments: 212
210 │ Resolved │  75 │ 2.4.0                  │ openHAB Basic UI Fragment, Hosts: 208
211 │ Active   │  80 │ 2.4.0                  │ HABPanel User Interface
212 │ Resolved │  75 │ 2.4.0                  │ openHAB Paper UI Theme Fragment, Hosts: 209
213 │ Active   │  80 │ 1.2.0                  │ Paho MQTT Client
214 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome MQTT Transport Bundle
216 │ Active   │  80 │ 2.4.0.201812040738     │ MySensors Binding
217 │ Active   │  80 │ 1.6.0                  │ Commons Codec
218 │ Active   │  80 │ 4.2.3                  │ Apache HttpClient OSGi bundle
219 │ Active   │  80 │ 4.2.3                  │ Apache HttpCore OSGi bundle
220 │ Active   │  80 │ 3.1.0.7                │ Apache ServiceMix :: Bundles :: commons-httpclient
221 │ Active   │  80 │ 1.13.0                 │ openHAB Mail Action
222 │ Active   │  80 │ 2.4.0                  │ openHAB 1.x Compatibility Layer
223 │ Active   │  80 │ 1.13.0                 │ openHAB Expire Binding
224 │ Active   │  80 │ 1.13.0                 │ openHAB InfluxDB Persistence bundle

Thanks guys for the help, I spent a few days troubleshooting this, and couldn’t get it to work!

Unfortunately I only figured it out after I removed “openhabian” and went ahead with a full manual install of OpenHab :)…

The issue is a little embarrassing, but I will share it anyway, IT WAS A LOSE DATA SENSOR WIRE!!! :frowning: but heey, I ended up with a fresh install :slight_smile:

btw, my rules code worked fine, I didn’t test the other yet but I will as they look better and easier to read.

1 Like

If it should work, always check the hardware first