Hello!
my rules doesn’t work anymore, I tried to test it by many actions but unfortunately doesn’t work
The code of the rules and items configurations would help!
Switch Gateway_AddDevice { channel="mihome:gateway:7811dcaf1aa1:joinPermission" }
Switch Gateway_LightSwitch <light> { channel="mihome:gateway:7811dcaf1aa1:brightness" }
Dimmer Gateway_Brightness <slider> { channel="mihome:gateway:7811dcaf1aa1:brightness" }
Color Gateway_Color <rgb> { channel="mihome:gateway:7811dcaf1aa1:color" }
Dimmer Gateway_ColorTemperature <heating> { channel="mihome:gateway:7811dcaf1aa1:colorTemperature" }
Number Gateway_AmbientLight <sun> { channel="mihome:gateway:7811dcaf1aa1:illumination" }
Number Gateway_Sound <soundvolume-0> { channel="mihome:gateway:7811dcaf1aa1:sound" }
Switch Gateway_SoundSwitch <soundvolume_mute> { channel="mihome:gateway:7811dcaf1aa1:enableSound" }
Dimmer Gateway_SoundVolume <s oundvolume> { channel="mihome:gateway:7811dcaf1aa1:volume" }
// Xiaomi Window Switch
Switch Alarm <Alarm>
Contact WindowSwitch_Status "Door[%s]" <door> { channel="mihome:sensor_magnet:158d0001c0fb9b:isOpen" }
// minimum 30 seconds
Number WindowSwitch_AlarmTimer <clock> { channel="mihome:sensor_magnet:158d0001c0fb9b:isOpenAlarmTimer" }
DateTime WindowSwitch_LastOpened "[%1$tY-%1$tm-%1$td %1$tH:%1$tM]" <clock-on> { channel="mihome:sensor_magnet:158d0001c0fb9b:lastOpened" }
Number WindowSwitch_Battery <battery> { channel="mihome:sensor_magnet:158d0001c0fb9b:batteryLevel" }
Switch WindowSwitch_BatteryLow <energy> { channel="mihome:sensor_magnet:158d0001c0fb9b:lowBattery" }
rule "Xiaomi Window Switch"
when
Item WindowSwitch_Status changed
then
if (WindowSwitch_Status.state == OPEN) {
sendCommand(Gateway_SoundVolume, 2)
sendCommand(Gateway_Sound, 11)
Thread::sleep(2000) /* wait for 2 seconds */
sendCommand(Gateway_Sound, 10000)
sendCommand(Gateway_SoundVolume, 0)
} else {
sendCommand(Gateway_Sound, 10000)
sendCommand(Gateway_SoundVolume, 0)
}
end
You cannot query the state of an item straight away after it’s changed because the event bus is still updating the state
A quick and sirty way to do it is to sleep a little bit to wait for the bus to catch up
Also you should use the items sendCommand
method instead of the action.
rule "Xiaomi Window Switch"
when
Item WindowSwitch_Status changed
then
Thread::sleep(50)
if (WindowSwitch_Status.state == OPEN) {
Gateway_SoundVolume.sendCommand(2)
Gateway_Sound.sendCommand(11)
Thread::sleep(2000) /* wait for 2 seconds */
Gateway_Sound.sendCommand(10000)
Gateway_SoundVolume.sendCommand(0)
} else {
Gateway_Sound.sendCommand(10000)
Gateway_SoundVolume.sendCommand(0)
}
end
I tried to test my rules by using some actions like send notification or send command to another item but
rule "Xiaomi Window Switch"
when
Item WindowSwitch_Status changed
then
if (WindowSwitch_Status.state == OPEN) {
playSound(doorbell)
sendCommand(Gateway_LightSwitch, ON)
sendBroadcastNotification("The door is OPEN")
} else {
}
end
Same issue, you are trying to check the item state before is has actually updated
The rule will start running but the event bus hasn’t changed the item state yet
Try changing the trigger to received update
instead of change
rule "Xiaomi Window Switch"
when
Item WindowSwitch_Status received update
then
and again use the method instead of the action:
Gateway_LightSwitch.sendCommand(ON)
I tried this syntax but didn’t work
rule "Xiaomi Window Switch"
when
Item WindowSwitch_Status received update
then
if (WindowSwitch_Status.state == OPEN) {
Gateway_LightSwitch.sendCommand(ON)
} else {
}
end
Try:
if (WindowSwitch_Status.state.toString == "OPEN") {
Thank you for replying
I tried this but no response too
if (WindowSwitch_Status.state.toString == "OPEN") {
Can you post your logs when you open the window, please?
There are sometimes errors in other rules which prevent openHAB from loading the rules file at all.
Take a look at openhab.log, maybe there is a line similar to this:
2017-11-17 16:32:39.248 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'goodnight.rules' has errors, therefore ignoring it:
at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:254) [42:org.apache.felix.scr:2.0.12]
at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:227) [42:org.apache.felix.scr:2.0.12]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482) [?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415) [?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) [?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:903) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:156) [?:?]
at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) [?:?]
at org.eclipse.osgi.container.Module.start(Module.java:467) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1620) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1600) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1571) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1514) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) [?:?]
2018-03-25 07:47:53.529 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'ioniq.things', using it anyway:
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
2018-03-25 07:47:53.543 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'ioniq.things'
==> /var/log/openhab2/events.log <==
2018-03-25 07:47:53.824 [.ItemChannelLinkAddedEvent] - Link 'Gateway_Sound-mihome:gateway:7811dcaf1aa1:sound' has been added.
2018-03-25 07:47:53.830 [.ItemChannelLinkAddedEvent] - Link 'WindowSwitch_Status-mihome:sensor_magnet:158d0001c0fb9b:isOpen' has been added.
2018-03-25 07:47:53.841 [.ItemChannelLinkAddedEvent] - Link 'Gateway_LightSwitch-mihome:gateway:7811dcaf1aa1:brightness' has been added.
2018-03-25 07:47:53.852 [.ItemChannelLinkAddedEvent] - Link 'WindowSwitch_Battery-mihome:sensor_magnet:158d0001c0fb9b:batteryLevel' has been added.
2018-03-25 07:47:53.855 [.ItemChannelLinkAddedEvent] - Link 'Gateway_AddDevice-mihome:gateway:7811dcaf1aa1:joinPermission' has been added.
2018-03-25 07:47:53.858 [.ItemChannelLinkAddedEvent] - Link 'Gateway_Brightness-mihome:gateway:7811dcaf1aa1:brightness' has been added.
2018-03-25 07:47:53.860 [.ItemChannelLinkAddedEvent] - Link 'Gateway_SoundSwitch-mihome:gateway:7811dcaf1aa1:enableSound' has been added.
2018-03-25 07:47:53.863 [.ItemChannelLinkAddedEvent] - Link 'Gateway_AmbientLight-mihome:gateway:7811dcaf1aa1:illumination' has been added.
2018-03-25 07:47:53.866 [.ItemChannelLinkAddedEvent] - Link 'WindowSwitch_LastOpened-mihome:sensor_magnet:158d0001c0fb9b:lastOpened' has been added.
2018-03-25 07:47:53.869 [.ItemChannelLinkAddedEvent] - Link 'WindowSwitch_AlarmTimer-mihome:sensor_magnet:158d0001c0fb9b:isOpenAlarmTimer' has been added.
2018-03-25 07:47:53.874 [.ItemChannelLinkAddedEvent] - Link 'WindowSwitch_BatteryLow-mihome:sensor_magnet:158d0001c0fb9b:lowBattery' has been added.
2018-03-25 07:47:53.876 [.ItemChannelLinkAddedEvent] - Link 'Gateway_ColorTemperature-mihome:gateway:7811dcaf1aa1:colorTemperature' has been added.
2018-03-25 07:47:53.879 [.ItemChannelLinkAddedEvent] - Link 'Gateway_SoundVolume-mihome:gateway:7811dcaf1aa1:volume' has been added.
2018-03-25 07:47:53.882 [.ItemChannelLinkAddedEvent] - Link 'Gateway_Color-mihome:gateway:7811dcaf1aa1:color' has been added.
2018-03-25 07:47:53.891 [.ItemChannelLinkAddedEvent] - Link 'Plug_Power-mihome:sensor_plug:158d0001b8faf1:loadPower' has been added.
2018-03-25 07:47:53.898 [.ItemChannelLinkAddedEvent] - Link 'Plug_Consumption-mihome:sensor_plug:158d0001b8faf1:powerConsumed' has been added.
2018-03-25 07:47:53.901 [.ItemChannelLinkAddedEvent] - Link 'Plug_Active-mihome:sensor_plug:158d0001b8faf1:inUse' has been added.
2018-03-25 07:47:53.904 [.ItemChannelLinkAddedEvent] - Link 'Plug_Switch-mihome:sensor_plug:158d0001b8faf1:power' has been added.
==> /var/log/openhab2/openhab.log <==
2018-03-25 07:47:58.606 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-03-25 07:47:59.339 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2018-03-25 07:47:59.494 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-03-25 07:47:59.687 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2018-03-25 07:48:00.063 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-03-25 07:48:00.211 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-03-25 07:48:00.218 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'ioniq'
2018-03-25 07:48:06.768 [ERROR] [penhab.io.transport.mqtt.MqttService] - Error starting broker connection
org.eclipse.paho.client.mqttv3.MqttException: MqttException
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:38) [229:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:664) [229:org.openhab.io.transport.mqtt:1.11.0]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.net.NoRouteToHostException: No route to host (Host unreachable)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:?]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:?]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:?]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
at java.net.Socket.connect(Socket.java:589) ~[?:?]
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:70) ~[?:?]
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650) ~[?:?]
... 1 more
==> /var/log/openhab2/events.log <==
2018-03-25 07:48:07.726 [hingStatusInfoChangedEvent] - 'mihome:bridge:7811dcaf1aa1' changed from UNINITIALIZED to INITIALIZING
2018-03-25 07:48:07.743 [hingStatusInfoChangedEvent] - 'mihome:sensor_magnet:158d0001c0fb9b' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2018-03-25 07:48:07.748 [hingStatusInfoChangedEvent] - 'mihome:sensor_motion:158d0001abc558' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2018-03-25 07:48:07.755 [hingStatusInfoChangedEvent] - 'mihome:sensor_plug:158d0001b8faf1' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2018-03-25 07:48:07.770 [hingStatusInfoChangedEvent] - 'mihome:gateway:7811dcaf1aa1' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2018-03-25 07:48:07.775 [hingStatusInfoChangedEvent] - 'mihome:sensor_switch:158d0001ae6eb6' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
==> /var/log/openhab2/openhab.log <==
2018-03-25 07:48:07.946 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.thing.internal.BridgeImpl with key 'mihome:bridge:7811dcaf1aa1' already exists! Failed to add a second with the same UID!
2018-03-25 07:48:07.952 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.thing.internal.ThingImpl with key 'mihome:gateway:7811dcaf1aa1' already exists! Failed to add a second with the same UID!
2018-03-25 07:48:07.967 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.thing.internal.ThingImpl with key 'mihome:sensor_motion:158d0001abc558' already exists! Failed to add a second with the same UID!
==> /var/log/openhab2/events.log <==
2018-03-25 07:48:07.971 [hingStatusInfoChangedEvent] - 'mihome:sensor_ht:158d0001XXXXXX' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
==> /var/log/openhab2/openhab.log <==
2018-03-25 07:48:07.972 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.thing.internal.ThingImpl with key 'mihome:sensor_plug:158d0001b8faf1' already exists! Failed to add a second with the same UID!
2018-03-25 07:48:07.975 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.thing.internal.ThingImpl with key 'mihome:sensor_magnet:158d0001c0fb9b' already exists! Failed to add a second with the same UID!
2018-03-25 07:48:07.979 [WARN ] [ore.common.registry.AbstractRegistry] - org.eclipse.smarthome.core.thing.internal.ThingImpl with key 'mihome:sensor_switch:158d0001ae6eb6' already exists! Failed to add a second with the same UID!
==> /var/log/openhab2/events.log <==
2018-03-25 07:48:08.005 [hingStatusInfoChangedEvent] - 'mihome:86sw2:158d0001XXXXXX' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2018-03-25 07:48:08.812 [hingStatusInfoChangedEvent] - 'mihome:bridge:7811dcaf1aa1' changed from INITIALIZING to ONLINE
2018-03-25 07:48:08.874 [hingStatusInfoChangedEvent] - 'mihome:sensor_magnet:158d0001c0fb9b' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2018-03-25 07:48:08.883 [hingStatusInfoChangedEvent] - 'mihome:gateway:7811dcaf1aa1' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2018-03-25 07:48:08.894 [hingStatusInfoChangedEvent] - 'mihome:sensor_plug:158d0001b8faf1' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2018-03-25 07:48:08.900 [hingStatusInfoChangedEvent] - 'mihome:sensor_switch:158d0001ae6eb6' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2018-03-25 07:48:08.903 [hingStatusInfoChangedEvent] - 'mihome:sensor_motion:158d0001abc558' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2018-03-25 07:48:08.936 [hingStatusInfoChangedEvent] - 'mihome:sensor_plug:158d0001b8faf1' changed from INITIALIZING to ONLINE
2018-03-25 07:48:08.969 [hingStatusInfoChangedEvent] - 'mihome:gateway:7811dcaf1aa1' changed from INITIALIZING to ONLINE
2018-03-25 07:48:08.985 [hingStatusInfoChangedEvent] - 'mihome:sensor_motion:158d0001abc558' changed from INITIALIZING to ONLINE
2018-03-25 07:48:08.990 [hingStatusInfoChangedEvent] - 'mihome:sensor_magnet:158d0001c0fb9b' changed from INITIALIZING to ONLINE
2018-03-25 07:48:08.996 [hingStatusInfoChangedEvent] - 'mihome:sensor_switch:158d0001ae6eb6' changed from INITIALIZING to ONLINE
2018-03-25 07:48:09.001 [hingStatusInfoChangedEvent] - 'mihome:sensor_ht:158d0001XXXXXX' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2018-03-25 07:48:09.008 [hingStatusInfoChangedEvent] - 'mihome:86sw2:158d0001XXXXXX' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2018-03-25 07:48:09.011 [hingStatusInfoChangedEvent] - 'mihome:sensor_ht:158d0001XXXXXX' changed from INITIALIZING to OFFLINE
2018-03-25 07:48:09.016 [hingStatusInfoChangedEvent] - 'mihome:86sw2:158d0001XXXXXX' changed from INITIALIZING to OFFLINE
2018-03-25 07:48:09.146 [vent.ItemStateChangedEvent] - Plug_Active changed from NULL to OFF
2018-03-25 07:48:09.150 [vent.ItemStateChangedEvent] - Gateway_Color changed from NULL to 113,97,100
2018-03-25 07:48:09.153 [vent.ItemStateChangedEvent] - Gateway_LightSwitch changed from NULL to OFF
2018-03-25 07:48:09.155 [vent.ItemStateChangedEvent] - WindowSwitch_Battery changed from NULL to 81
2018-03-25 07:48:09.158 [vent.ItemStateChangedEvent] - Plug_Switch changed from NULL to OFF
2018-03-25 07:48:09.160 [vent.ItemStateChangedEvent] - Gateway_Brightness changed from NULL to 0
2018-03-25 07:48:09.163 [vent.ItemStateChangedEvent] - Plug_Power changed from NULL to 0
2018-03-25 07:48:09.165 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from NULL to 730
2018-03-25 07:48:09.168 [vent.ItemStateChangedEvent] - WindowSwitch_BatteryLow changed from NULL to OFF
==> /var/log/openhab2/openhab.log <==
2018-03-25 07:48:13.584 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename `ioniq.sitemap` does not match the name `our_home` of the sitemap - please fix this as you might see unexpected behavior otherwise.
2018-03-25 07:48:13.694 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 07:48:13.699 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Gateway_ColorTempreture' for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 07:48:13.704 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Gateway_ColorTempreture' for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 07:48:13.707 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Gateway_ColorTempreture' for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 07:48:14.330 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename `ioniq.sitemap` does not match the name `our_home` of the sitemap - please fix this as you might see unexpected behavior otherwise.
2018-03-25 07:48:17.926 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename `ioniq.sitemap` does not match the name `our_home` of the sitemap - please fix this as you might see unexpected behavior otherwise.
==> /var/log/openhab2/events.log <==
2018-03-25 07:48:20.610 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 5
2018-03-25 07:48:20.622 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from NULL to 5
2018-03-25 07:48:21.945 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 0
2018-03-25 07:48:21.955 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 5 to 0
2018-03-25 07:48:22.133 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 0
2018-03-25 07:48:22.277 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 0
2018-03-25 07:48:22.501 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 0
2018-03-25 07:48:25.006 [ome.event.ItemCommandEvent] - Item 'Alarm_Master' received command ON
2018-03-25 07:48:25.013 [vent.ItemStateChangedEvent] - Alarm_Master changed from NULL to ON
2018-03-25 07:48:26.412 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 0
2018-03-25 07:48:26.607 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 0
2018-03-25 07:48:26.744 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 0
2018-03-25 07:48:28.365 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 5
2018-03-25 07:48:28.371 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 0 to 5
2018-03-25 07:48:28.529 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 10
2018-03-25 07:48:28.541 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 5 to 10
2018-03-25 07:48:28.636 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 15
2018-03-25 07:48:28.643 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 10 to 15
2018-03-25 07:48:28.694 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 20
2018-03-25 07:48:28.703 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 15 to 20
==> /var/log/openhab2/openhab.log <==
2018-03-25 07:48:33.423 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename `ioniq.sitemap` does not match the name `our_home` of the sitemap - please fix this as you might see unexpected behavior otherwise.
2018-03-25 07:48:33.455 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 07:48:33.459 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Gateway_ColorTempreture' for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 07:48:33.464 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Gateway_ColorTempreture' for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 07:48:33.468 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Gateway_ColorTempreture' for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 07:48:37.230 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename `ioniq.sitemap` does not match the name `our_home` of the sitemap - please fix this as you might see unexpected behavior otherwise.
==> /var/log/openhab2/events.log <==
2018-03-25 07:48:40.846 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 25
2018-03-25 07:48:40.855 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 20 to 25
2018-03-25 07:48:41.159 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 30
2018-03-25 07:48:41.168 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 25 to 30
2018-03-25 07:48:41.380 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 35
2018-03-25 07:48:41.387 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 30 to 35
2018-03-25 07:48:42.502 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 30
2018-03-25 07:48:42.507 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 35 to 30
2018-03-25 07:48:42.672 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 25
2018-03-25 07:48:42.677 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 30 to 25
2018-03-25 07:48:42.835 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 20
2018-03-25 07:48:42.846 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 25 to 20
2018-03-25 07:48:43.004 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 15
2018-03-25 07:48:43.013 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 20 to 15
2018-03-25 07:48:43.197 [ome.event.ItemCommandEvent] - Item 'Alarm_MasterTimeMins' received command 10
2018-03-25 07:48:43.205 [vent.ItemStateChangedEvent] - Alarm_MasterTimeMins changed from 15 to 10
2018-03-25 07:48:44.522 [ome.event.ItemCommandEvent] - Item 'Alarm_Master' received command OFF
2018-03-25 07:48:44.530 [vent.ItemStateChangedEvent] - Alarm_Master changed from ON to OFF
2018-03-25 07:48:45.266 [ome.event.ItemCommandEvent] - Item 'Alarm_Master' received command ON
2018-03-25 07:48:45.275 [vent.ItemStateChangedEvent] - Alarm_Master changed from OFF to ON
2018-03-25 07:50:39.350 [vent.ItemStateChangedEvent] - Gateway_Color changed from 113,97,100 to 0,0,0
2018-03-25 07:50:39.356 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 730 to 704
2018-03-25 07:53:57.684 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 704 to 773
2018-03-25 07:55:58.369 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 773 to 838
2018-03-25 07:57:17.182 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 838 to 887
2018-03-25 07:57:53.082 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 887 to 947
2018-03-25 07:58:28.976 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 947 to 1007
2018-03-25 07:58:58.900 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 1007 to 1068
2018-03-25 07:59:58.756 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 1068 to 1134
2018-03-25 08:01:53.453 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 1134 to 1191
2018-03-25 08:02:16.395 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 1191 to 1247
2018-03-25 09:02:07.266 [vent.ItemStateChangedEvent] - Gateway_AmbientLight changed from 1247 to 1292
==> /var/log/openhab2/openhab.log <==
2018-03-25 15:20:49.898 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename `ioniq.sitemap` does not match the name `our_home` of the sitemap - please fix this as you might see unexpected behavior otherwise.
2018-03-25 15:20:49.980 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename `ioniq.sitemap` does not match the name `our_home` of the sitemap - please fix this as you might see unexpected behavior otherwise.
2018-03-25 16:14:49.388 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename `ioniq.sitemap` does not match the name `our_home` of the sitemap - please fix this as you might see unexpected behavior otherwise.
2018-03-25 16:14:49.436 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 16:14:49.441 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Gateway_ColorTempreture' for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 16:14:49.448 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Gateway_ColorTempreture' for widget org.eclipse.smarthome.model.sitemap.Slider
2018-03-25 16:14:49.453 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Gateway_ColorTempreture' for widget org.eclipse.smarthome.model.sitemap.Slider
Wow! That’s a bit of a mess, you have errors galore!
Your myhone things ar duplicated for one
rename ioniq.siremap
to our_home.sitemap
And I can’t find WindowSwitch_Status
Delete the thing
For the xiaomi things, links them through paperUI OR in the item file NOT BOTH
Thank you
i have made some edit anf find that
2018-03-27 01:59:48.603 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'ioniq.rules' has errors, therefore ignoring it: [9,5]: no viable alternative at input '}'
[17,1]: no viable alternative at input 'end'
2018-03-27 01:59:48.740 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'ioniq.rules' has errors, therefore ignoring it: [9,5]: no viable alternative at input '}'
[17,1]: no viable alternative at input 'end'
What does it mean?
yes i found this problem what should I do?
Setup VS Code and it will show you what the errors are… while you type them. Worst case, post the first 20 or so lines of ioniq.rules.
You’re mistaken… when an item is changed or updated, the event bus is already behind us. It’s the received command trigger where you need to use receivedCommand instead of the state.
That appears to mean there is a syntax error in your file. There might be an extra brace or end/begin keyword somewhere. You’ll have to carefully check your rules code to make sure all braces and rules are correctly ended and started.
Hi Ahmed_Saad,
for me this works great:
rule "Xiaomi Window Wohnzimmer Dimming Closed"
when
Item XiaomiKontaktsensorBadFenster_IsOpen changed from OPEN to CLOSED
then
and
rule "Xiaomi Window Wohnzimmer Dimming Opened"
when
Item XiaomiKontaktsensorBadFenster_IsOpen changed from CLOSED to OPEN
then
This needs two rules but at least it works VERY reliable, I can even open/close the window continuously and the rules keep firing.
You can use one rule for that:
rule "Xiaomi Window BadFenster"
when
Item XiaomiKontaktsensorBadFenster_IsOpen changed
then
if (previousState != NULL) {
if (XiaomiKontaktsensorBadFenster_IsOpen.state == OPEN) {
// do stuff here
}
else if (XiaomiKontaktsensorBadFenster_IsOpen.state == CLOSED) {
// do stuff here
}
}
else
logInfo ("badFenster","BadFenster initialized to {}",XiaomiKontaktsensorBadFenster_IsOpen.state)
end
As you can see, this rule’s behavior is exactly the same as your two rules (apart from the logInfo() when previousState was NULL, which your rules don’t account for at all).