openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
912 stars 420 forks source link

Wake on LAN rule in Main UI fails to initialize #3771

Open DrRSatzteil opened 1 year ago

DrRSatzteil commented 1 year ago

I have a problem with the “send a WoL Packet” action in a rule. When OH is restarted the rule remains in the state UNINITIALIZED and shows the error: “Missing handler ‘network.sendWakeOnLanPacketViaIp’ for module ‘3’”.

When I disable and enable the rule again it works without problems. This seems to be due to a wrong order of things in the startup sequence. Please see my initial report and Richs answer in the community forums: https://community.openhab.org/t/wake-on-lan-rule-in-main-ui-fails-to-init/148894

The rule is defined as follows:

configuration: {}
triggers:
  - id: "1"
    configuration:
      command: ON
      itemName: bd_player_on
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "3"
    configuration:
      config: network:pingdevice:839955dc60
    type: network.sendWakeOnLanPacketViaIp

Expected Behavior

The rule should get into IDLE state after booting up OH

Current Behavior

The rule remains in state UNINITIALIZED

Possible Solution

Rich Koshak answered my report with the following that might be of help to find a solution: "I agree, there does seem to be a case where the Thing is coming online after the rule is loaded. The rule engine is loaded at runlevel 40 but Thing don’t get loaded until runlevel 80 so this is not unexpected. The rule should become initialized when the Thing does come online."

Steps to Reproduce (for Bugs)

  1. Create the above rule
  2. Reboot OH

Context

Rule is not working until the state has been manually fixed by disabling and enabling the rule

Your Environment

openhab-bot commented 1 year ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/wake-on-lan-rule-in-main-ui-fails-to-init/148894/3