Philips hue message delayed


I am using Philips hue v1. hub. When I send a message to MQTT broker (hosted on the same server as openhab2) it sometimes takes 5 seconds to react. Sometimes means every morning, so lights were not used overnight and also Openhab server restart at the night.

The first light switch press has 5 second delay and the next one goes fast. Please see logs:

2019-01-13 10:02:55.097 [ome.event.ItemCommandEvent] - Item ‘Toilet_Light_Toggle’ received command TOGGLE

2019-01-13 10:02:55.119 [vent.ItemStateChangedEvent] - Toilet_Light_Toggle changed from NULL to TOGGLE

2019-01-13 10:03:00.599 [ome.event.ItemCommandEvent] - Item ‘Toilet_Light’ received command ON

2019-01-13 10:03:00.606 [vent.ItemStateChangedEvent] - Toilet_Light changed from OFF to ON

2019-01-13 10:03:00.609 [GroupItemStateChangedEvent] - gLight changed from OFF to ON through Toilet_Light

2019-01-13 10:03:02.818 [ome.event.ItemCommandEvent] - Item ‘Toilet_Light_Toggle’ received command TOGGLE

2019-01-13 10:03:02.838 [ome.event.ItemCommandEvent] - Item ‘Toilet_Light’ received command OFF

2019-01-13 10:03:02.849 [vent.ItemStateChangedEvent] - Toilet_Light changed from ON to OFF

2019-01-13 10:03:02.854 [GroupItemStateChangedEvent] - gLight changed from ON to OFF through Toilet_Light

Does anyone know why this is happening ?


Because OH is restarted and the item is not persisted so the value is NULL until it receive a command.

If your OH gets restarted every night then use persistence on the item’s to avoid the NULL.
Best to use mapdb for this and make sure you have it installed in PaperUI then use the file example like below for your items.


Strategies {
	default = everyUpdate

Items {
	* : strategy = everyChange, restoreOnStartup

Hi H102,

thank you it worked for me.

(you are missing “}” at the end of the code)

Glad it worked.:+1:

I edited my reply to add the }. If you would please mark the topic solved by clicking the square box on the post that provided the solution.


Thank you once again. Tested it this morning and now it works like a charm.

This really interesting. Assuming that your rule can handle NULL properly without throwing an error, a change from NULL->TOGGLE shouldn’t take any longer than any other change?

I don’t know what your Item is, but it sounds like the sort of thing that responds to current events and does not need to be persisted+restored.

The usual guess about “first time rule run is delayed” is that the rule code has been rolled out of memory. First time trigger takes a while to fetch it back in. It’s difficult to see how Item state could affect that, but it is possible, perhaps through the restore process.


I figured out today’s morning that this behaviour is happening again.

2019-01-17 08:11:35.128 [ome.event.ItemCommandEvent] - Item ‘Kitchen_Light1_Toggle’ received command TOGGLE
2019-01-17 08:11:35.187 [ome.event.ItemCommandEvent] - Item ‘Kitchen_Light2_Toggle’ received command TOGGLE
2019-01-17 08:11:40.304 [ome.event.ItemCommandEvent] - Item ‘Kitchen_Light2’ received command ON
2019-01-17 08:11:40.324 [ome.event.ItemCommandEvent] - Item ‘Kitchen_Light1’ received command ON
2019-01-17 08:11:40.369 [GroupItemStateChangedEvent] - gLight changed from OFF to ON through Kitchen_Light2


Yes you are right, I have rule for each Philips Hue light (connected trough v1 philips hue hub).

rule “Toggle convert Kitchen1”
Item Kitchen_Light1_Toggle received command TOGGLE
if(Kitchen_Light1.state == ON) sendCommand(Kitchen_Light1, OFF)
else sendCommand(Kitchen_Light1, ON)

Whole setup:
Philips Hue light <<<< Philips Hue V1 Hub <<< Openhab2 binding <<< Openhab2 Rule (toggle) <<< MQTT binding << MQTT message (toggle) <<< Rpi zero gpio switch.

Any ideas ?

Rule looks good, will work with NULL states without error. If you’ve set up unnecessary persist/restore, consider taking it out again.

Sounds like the rule gets rolled out overnight and recompiled when wanted. Are you restarting overnight?

Yes, Server does restart every night.

Okay, “standard” first time use rule delay then.

Thank you for idea.

I will try it…