Player Item and follow-profile

I have a three-button 433MHz remote that sends the values 1 2 and 3

I have an item mapped that represents this remote.
The item has two channel links.
One link to the 433MHz-channel on MQTT (all remotes just send a certain number) with
a map transformation like this: 1=PREVIOUS, 2=NEXT, 3=PAUSE
The other channel link goes to the trackPlayer channel on the spotify bridge thing.

My goal is to have my three-button-remote send PREVIOUS or NEXT and toggle PLAY/PAUSE state to the spotify player channel.

However this doesn’t seem to work. Only pause works, it doesn’t toggle, previous and next are ignored.

Am i doing something wrong?

May we see samples of your events.log to see if any of that works?

Meaning … what happens?

I can’t see anything that would cause PLAY to be sent, rather than PAUSE, if that is what you are expecting to happen?

Well i assumed that there’s some kind of smart involved that just toggles the play state if i send a redundant command. Or that there would be a toggle command.

Only pause works:
depending on whether i enter PLAY or PAUSE into my translation map, that command gets executed.

Following is a log.
I entered PLAY into the translation map and had spotify set to pause via its GUI. Then i press the three buttons on the remote and after that press PAUSE in spotify GUI.

2022-10-27 20:22:05.212 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SpotifyPlayerBridge_Fernbedienung' changed from PAUSE to PLAY
2022-10-27 20:22:05.642 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'rf433toMQTT_message' changed from 9082984 to 9082980   #2980 is NEXT
2022-10-27 20:22:08.257 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'rf433toMQTT_message' changed from 9082980 to 9082978  #2978 is PREVIOUS
2022-10-27 20:22:09.723 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'rf433toMQTT_message' changed from 9082978 to 9082984  #2984 is PLAY
2022-10-27 20:22:12.387 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SpotifyPlayerBridge_Fernbedienung' changed from PLAY to PAUSE
2022-10-27 20:22:12.387 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'spotifyTrackProgress' changed from 0:07 to 0:11
2022-10-27 20:22:15.451 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'rf433toMQTT_message' changed from 9082984 to 9082980
2022-10-27 20:22:18.388 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'rf433toMQTT_message' changed from 9082980 to 9082978

I think it’s more simple minded than you supposed, it does what you tell it to do, i.e. PAUSE is PAUSE

However, I think you’ve fallen in a hole here, and it will never do what you want.
a) A Player types Item state is distinguished from command, these are not the same thing. Example, you can send a command NEXT and the resultant state could be PLAY.
b) It’s not possible to update the Item state to a unsupported state, like NEXT.
c) a follow profile can only (attempt to) mirror an Item state out to an external channel. It won’t even see commands to the Item, so for example here it could never send NEXT.

I think your bet here is a more conventional approach. Link your remote into an Item representing only the remote.
Have a rule listen out for commands from your remote and massage them into commands suitable for your player Item, linked only to spotify.

I suspected i might have to do it with rules. I was fascinated by the follow profile and might have wanted too much.

I don’t understand how i would define a virtual item for the remote, though.
OHAB-GUI doesn’t offer it.

Can you give me a pointer, please?

EDIT: Why does it work for play/pause though?

Just go to settings, items and press the plus button to create a new one.
Without linking it to a thing channel, it will become a virtual or even called proxy item.

ahh yes. item. i knew how to do that.
my bad, i had somehow thought you wrote virtual thing, yet i did write item

Because PLAY/PAUSE are valid states for a Player type Item as well as valid commands

Compare with a Dimmer type Item, where only numeric states are valid, yet you can command it ON (probably resulting in state 100%)

Use a follow profile on a Dimmer Item and it will pass through state 50% as though it were a command, but never ON or OFF since these never appear as Dimmer states.
The follow profile is of very limited usefulness for the complex Item types beyond Switch, Number, and String.

Haven’t you already got Item rf433toMQTT_message with your remote activity? Not sure what you want another one for.
Your rule just needs to listen out for message like 9082980 and respond by commanding NEXT to your Player Item, etc.?

I think I’d use the MQTT channel option for postCommand though, so that incoming messages from the remote generate commands instead of state updates, making the remote act more like the openHAB UI.
Makes it easier to handle repeated press of same button.