This is my first post in this community. A few years ago I started with mosquitto/zigbee2MQTT/openHABv2 on a Virtual Machine (CentOS7).
Now I planned to migrate to OH3.
Therefore I prepared a clean install of a new VM (Rocky9.1), borrowed the “Sonoff Zigbee 3.0 USB Dongle Plus” from my OH2 environment, reused the pan_id.
In the new OH3 environment, I created new files, but these are all based on the ones in my OH2 environment.
MQTT.things containing two things, a switch and a bulb, (and ofcourse zigbeeMQTT)
default.items, containing some details of these things.
ohb3_switch.rules
switch_action.js (transform)
So, this is a very clean and minimalistic environment.
By means of “mosquitto_pub” I am able to switch on/off the light, so this proves a functioning zigbee network.
By means of the UI of openHAB 3.4.2, I can switch on/off the light, so this proves a connection between openHAB, mqtt and zigbee.
But when I press the physical switch, I can see in the logfile the event: payload ‘{“action”:“left”,…}’,
At this point I would expect the rules file to be triggered. The rules file contains three trigger-conditions: received update left, received command left, changed
but nothing happens.
After updating the rules file, the karaf console shows: updated: UNINITIALIZED, updated: INITIALIZING, updated: IDLE
Ofcourse I read a lot, I searched a lot, but until now I don’t have a clue.
Anyone any idea?
No, the only logging for this Item is: [INFO ] [openhab.event.ItemRemovedEvent ] - Item ‘schakelaar_50action’ has been removed.
during shutdown of openhab
OH3 runs on a separate virtual machine, that means that I restart openhab and the VM every time that I continue ‘developing’ the migration from OH2 to OH3.
** the end device isn’t publishing the message*
Having two implementations of OpenHAB, the first: my “production”-state OH2 environment, and second: my “development”-state OH3 environment, I move one bulb, one switch and the only one zigbee_usb_dongle from OH2 to OH3 environment and vice versa.
That proves that the end device is publishing messages as it is functioning after it has been placed back in the OH2 environment.
the Broker thing is misconfigured
In my first post I wrote: By means of the UI of openHAB 3.4.2, I can switch on/off the light, so this proves a connection between openHAB, mqtt and zigbee.
I assumed a correct configuration of the Broker thing. Do you agree?
the channel is misconfigured and there is no item channel link or the link is wrong
I think that my previous remark is also valid for these two possibilities?
Besides this, I compared my OH3 and OH2 systems and I noticed that I did not “add-on” the Javascript-Transformation and the JSONPath-Transformation. Even after adding these add-ons nothing changed.
In the file log4j2.xml, I changed “Logger level=INFO” to DEBUG. I could not find relevant information.
var loginfo_rulefile = String::format( "%26s", "ohb3_switch_to_ON.rules" )
rule "switch_to_ON"
when
Item schakelaar_50action received update left
or
Item schakelaar_50action received update single_left
or
Item schakelaar_50action received command left
or
Item schakelaar_50action changed
then
var loginfo_rulename = String::format( "%-54s, ", "RULE=switch_to_ON" )
HOB_burolampState.sendCommand( ON )
logInfo( loginfo_rulefile, loginfo_rulename + "switched to ON" )
end
It sounds like you’re having trouble getting your physical switch to trigger the rules file in your OH3 environment. You’ve confirmed that your zigbee network and mqtt are working correctly, and you’re able to switch the light on/off via the UI. However, when you press the physical switch, the rules file isn’t triggered even though it contains trigger conditions for the “left” action. Updating the rules file causes it to go through the UNINITIALIZED, INITIALIZING, and IDLE stages in the karaf console, but still no luck. It’s difficult to diagnose the issue without more information, but one possibility could be that the physical switch isn’t properly sending the “left” action to OH3.
Yesterday I started from scratch with a new VM, this time not Rocky9 but Rocky8.5 because Rocky9 is not yet supported (GitHub - nodesource/distributions: NodeSource Node.js Binary Distributions).
Murphy was there too: The only test switch in my OH3 environment suffered from an almost empty battery. Battery replaced and two other switches added to OH3, one Ikea, one Xiaomi, just to eliminate issues with a specific switch.
Results so far:
In my new OH3@Rocky8 environment I have exactly the same issue: Rules do not get triggered.
My conclusion to date is: I must have missed an important step…
What could that be???
About ON versus “ON”: A quick scan in OH2 rules: I have used both. I remember that in specific cases the quotes are required.
About the logs:
The file events.log shows only events about startting/stopping openhab and events when manipulating light from the UI, like switching on/off and sliding the dimmer.
2023-04-01 12:09:27.189 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HOB_burolampBrightness' changed from 37 to 35
2023-04-01 12:09:27.379 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HOB_burolampBrightness' received command 34
2023-04-01 12:09:27.382 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HOB_burolampBrightness' predicted to become 34
2023-04-01 12:09:27.383 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HOB_burolampBrightness' changed from 35 to 34
2023-04-01 12:09:27.796 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HOB_burolampBrightness' received command 31
2023-04-01 12:09:27.798 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HOB_burolampBrightness' predicted to become 31
2023-04-01 12:09:27.800 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HOB_burolampBrightness' changed from 34 to 31
2023-04-01 12:09:27.997 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HOB_burolampBrightness' received command 29
2023-04-01 12:09:27.998 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HOB_burolampBrightness' predicted to become 29
2023-04-01 12:09:28.002 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HOB_burolampBrightness' changed from 31 to 29
2023-04-01 12:09:38.903 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HOB_burolampBrightness' received command 4
2023-04-01 12:09:38.905 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HOB_burolampBrightness' predicted to become 4
2023-04-01 12:09:38.906 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HOB_burolampBrightness' changed from 29 to 4
2023-04-01 12:09:56.870 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HOB_burolampBrightness' received command 3
2023-04-01 12:09:56.872 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HOB_burolampBrightness' predicted to become 3
2023-04-01 12:09:56.873 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HOB_burolampBrightness' changed from 4 to 3
2023-04-01 12:09:57.066 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HOB_burolampBrightness' received command 2
2023-04-01 12:09:57.067 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HOB_burolampBrightness' predicted to become 2
2023-04-01 12:09:57.069 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HOB_burolampBrightness' changed from 3 to 2
2023-04-01 12:10:01.353 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HOB_burolampBrightness' received command 1
2023-04-01 12:10:01.354 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HOB_burolampBrightness' predicted to become 1
2023-04-01 12:10:01.357 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HOB_burolampBrightness' changed from 2 to 1
2023-04-01 12:13:13.076 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:myMQTTBroker:schakelaar_50' changed from ONLINE to UNINITIALIZED
2023-04-01 12:13:13.128 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:myMQTTBroker:schakelaar_50' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2023-04-01 12:13:13.128 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:myMQTTBroker:HOB_burolamp' changed from ONLINE to UNINITIALIZED
2023-04-01 12:13:13.176 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:myMQTTBroker:HOB_burolamp' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2023-04-01 12:13:13.177 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:myMQTTBroker:zigbeeMQTT' changed from ONLINE to UNINITIALIZED
2023-04-01 12:13:13.178 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:myMQTTBroker:zigbeeMQTT' changed from UNINITIALIZED to ONLINE
2023-04-01 12:13:13.223 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:myMQTTBroker:zigbeeMQTT' changed from ONLINE to UNINITIALIZED (HANDLER_MISSING_ERROR)
2023-04-01 12:13:13.231 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:broker:myMQTTBroker' changed from ONLINE to UNINITIALIZED
2023-04-01 12:13:13.243 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:broker:myMQTTBroker' changed from UNINITIALIZED to OFFLINE (COMMUNICATION_ERROR): Client sent DISCONNECT
2023-04-01 12:13:13.246 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:broker:myMQTTBroker' changed from OFFLINE (COMMUNICATION_ERROR): Client sent DISCONNECT to OFFLINE
2023-04-01 12:13:13.260 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:broker:myMQTTBroker' changed from OFFLINE to UNINITIALIZED (HANDLER_MISSING_ERROR)
About openHAB ZigBee Binding:
I think this one shows the state of zigbee. I don’t use it in rules, maybe I dont’t need it all.
I think openhab only communicates with the MQTTBroker, but I am not sure.
The last few lines: yes, openhab is shutting down.
Two brokers:
Both VMs have their own MQTT broker, accessed via localhost.
There is only one zigbee dongle, and that one hops from OH2 to OH3 and back.
At any point in time there is only one network active.
your code goes here==> /opt/openhab3/userdata/logs/events.log <==
2023-04-01 19:53:17.984 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HOB_burolampState' received command ON
2023-04-01 19:53:17.985 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HOB_burolampState' predicted to become ON
2023-04-01 19:53:17.989 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HOB_burolampState' changed from OFF to ON
Is this what you mean?
When I “Run Now (Ctrl R)” from the UI the light switches on.