restoreOnStartup doesn't transmit restored value to mqtt

As explained by Markus and Vincent, that isn’t how restoreOnStartup is supposed to work.

One way to get this behavior is below. Beware of the infinite loops Vincent mentions though.

Create a System started Rule that creates a Timer to wait a bit to ensure that restoreOnStartup has done it’s job. Then loop though the Group of all the Items and sendCommand the current state.

rule "Send command restored states"
when
    System started
then
    createTimer(now.plusSeconds(10), [ |
        MyGroup.members.filter[ d | d.state != NULL ].forEach[ d | d.sendCommand(d.state) ]
    ])
end

As an aside, please How to use code fences for code and logs posted to the forum so they are easier to read.

1 Like