Where can I find the response string - ItachFlex

I added it there as MAP with filename of denonmsg.map in the transform folder.
But how do I get that (the transformed mapped value) into the UI (a cell on a page)

@Stan_Ehm You may have better success using Javascript, since there are better string manipulation/matching functions.

That would transform the message for a String type Item. What is your Item getting updated to in reality? How would you normally display an Item, it’s just an Item. Have you looked in both your openhab.log and events.log?

That’s the magic part, @Stan_Ehm. The transform is applied before the state of your item is updated. So when you display the item state in the UI, it should contain the transformed value (assuming the transform is successful).

From the user side (read wife) - opens the OH app, sees the page with cell on it. Click/tap the cell. The cell is configured to send an action “@PWR:2%0D” to the item. (this turns the unit on) , that same call has the denon give a response - but i have no idea where that response is picked up in OH3 - maybe it goes to the innerworks of the map transform, but how do I access the transformed value, to put it onto the cell. (will be doing the same thing to show current volume levels)
image

Incidentally I tried rules - at first blush rules seem intense, it runs every few seconds “on item update” and the denon unit is off - so idk what update is triggering the rule

The item that’s linked to the iTach thing’s receive channel is updated with the string that the binding receives from the iTach. In my example screenshot above, that’s the item Gc_RSCAA66RECEIVE.

Okay, some information.

The colon in the MAP input worried me - and from experimentation, yes it does need escaping.
Backslash \ is the escape character for strings, that instructs “don’t use next char as a special char”.
And with any MAP I would recommend tacking on a default (no) match so that you can see failures.
A revised file might look like -

@PWR\:1=open
...
@PWR\:1%.0D%.0A=offf
=missing translation

Can we be clear about what link you applied the profile to? Is this linked to the same Item you are sending UI commands to? I keep asking what your Item state is getting set to.

1 Like

Hmm, does this mean I have to have a send item and a receive item, right now the same item is linked to both send and receive.
in the image below the @PWR:1%0D is the last response OH recieved from the denon (means the power status is OFF).

  1. the transform file exists, but isn’t being applied from what I see.
  2. I don’t see or know where to find the UI cell config that picks up that return value

Probably not, but for heaven’s sake start simple.
Link your new channel to a new String type Item.
See that it gets the coded update you expect.
Revise your map file with escapes for colons.
Apply MAP profile to the new link.
See that Item now gets mapped updates.

Once the mechanism works, see about combining into one Item.
Disable autoupdate on your “control” Item, so that coded commands sent fromUI do not affect its state.
Now by observation determine if the binding updates this Item when you send commands.
If it does not, we are in luck.
You can just link your new monitor channel to the command Item as well, with the MAP profile.
And delete your test display Item and link.

If the command Item continues to get updates, we will have to go with two Items.
Disable autoupdate on your “display” Item, so that we can send it commands from the UI without messing up its state (which is supplied by bindng and map).
Make a rule that listens for any commands to the display Item, and passes them to the command Item (where they will get passed to binding for action).
Put the display Item on your UI with the controls that you need to send commands.
Do not put the command Item on your UI.

1 Like

Possibly not but I also would suggest you have 2 separate items to eliminate any uncertainty.

It started simple :slight_smile:

Mapfile updated to account for escaping colon, contents:

@PWR\:1=openx
@PWR\:1%.0D%.0A=offfx
@PWR\:1%0D%0A=offfx2
@PWR\:1%0D=offfx3
@PWR\:1%.0D=offfx4
=missing translation

Created brand new item for receive channel

Determined it seems you cannot have two different items one on the send and one on the receive, the reply only goes back to the origin item, the other gets (stays) null.

The item is definitely getting the response, it changes to documented values when the discrete power on off are triggered, its just not applying the transform. I am looking at the log and the UI no errors

2021-02-19 11:01:06.166 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘DenonRcvTest’ received command @PWR:1%0D
2021-02-19 11:01:06.173 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘DenonRcvTest’ predicted to become @PWR:1%0D
2021-02-19 11:01:06.178 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘DenonRcvTest’ changed from @PWR:2%0D to @PWR:1%0D

This is good news. At least we know the item is updating now.

Using map file test.map

@PWR\:1=openx
@PWR\:1%.0D%.0A=offfx
@PWR\:1%0D%0A=offfx2
@PWR\:1%0D=offfx3
@PWR\:1%.0D=offfx4
=missing translation

And this textual item definition.

String Test_Item_String "Test String [MAP(test.map):%s]"

When I send @PWR:1%0D to the item, I see this in the UI.

Don’t send this commands yet - it is only linked to the receive channel, yes? Are you really getting responses from the device, as opposed to internal reflections of your command (the ‘prediction’)

Okay, step one.

OH3 users are finding that profile update process is not very dynamic. It’s a pain, but I suggest you reboot OH as your profile setting looks good now.

I tried the textual definition as well but got what I sent. I am sending via a Cell on a Page, how did you send? I also have test.map and denonmsg.map both in the /etc/openhab/transform folder
Also noticed you cannot currently update or change the textual definition from the UI, you have to make new ones …:frowning:

(rebooted whole debian - no change)

I sent from the Karaf console.

openhab:send Test_Item_String @PWR:1\%0D

I don’t have time ATM to try it using the UI.

ok I installed Karaf (no idea what it does, so I will research later)
I ran: openhab-cli console from the debian console, and got the openhab prompt

entered the command with appropriate "Test_Item_Stringx" and @PWR:1\%0D
transform not applied.

restarted, same thing.

So decided to delete all those test items and make
i) one from .items file (appended F)
ii) one via the UI - textual item (appended UI)
The file one worked, the UI created one does not work
NOTE the far right does NOT update with the transformed value you have to open it.

image

image

So maybe a UI creation bug - IDK how to look at the JSON in the db

I’ve lost track of what you are trying to do now, and complaining about “when I do this” without really detailing “this” isn’t helping.
How did you set your UI test Item up? How did you set your file test Item up? The process differs. Can we see? What have you asked your widgets to display? It is optonal to display raw state or transformed state, when formatting at state presentation level.

Simply trying to transform the received string from a real device into a human readable format and show it on the Cell that sent the command. This was first attempted to ALL be done through the OH3 web UI.

Real devices are receiving and processing their serial commands, that all works.
OH gets the devices reply but it stays as a command string. To clean that up the connector had a profile assigned to it (denonmsg.map) which there was no way to tell if it was being used, probably not since even the null key was ignored.

Mark suggested above creating an item from a Textual definition - which was done through the UI, and command was sent to it via openhab-cli it simply echoed the command.

I then created a clone item from a .items file and sent it a command, it transformed the reply using the map file.

The syntax used to create the Textual item definition in both the UI and the items file was exactly the same as in Marks post:
String Test_Item_String "Test String [MAP(test.map):%s]"

Summary - creating the item from a .items file works for transforming real device replys, creating item via the UI, reply transformation seems ignored.

Outstanding - now that the item has a humanly readable value, how does a Cell pick that up/get updated with the transformed value, in the footer of the cell for example?

IDK if it helps but notice in the API explorer that there no MAP Pattern set for this item, even though the UI shows it to be denonmsg.map

{
    "link": "http://192.168.1.90:52080/rest/items/DenonRcvTest",
    "state": "NULL",
    "stateDescription": {
      "pattern": "%s",
      "readOnly": false,
      "options": []
    },
    "editable": true,
    "type": "String",
    "name": "DenonRcvTest",
    "label": "DenonRcvTest",
    "category": "",
    "tags": [],
    "groupNames": []
  },

The item created from a text file has a patterns map
{
“link”: “http://192.168.1.90:52080/rest/items/Test_Item_StringF”,
“state”: “@PWR:1%0D”,
“transformedState”: “offfx3”,
“stateDescription”: {
"pattern": “MAP(test.map):%s”,
“readOnly”: false,
“options”: []
},
“editable”: false,
“type”: “String”,
“name”: “Test_Item_StringF”,
“label”: “Test String”,
“tags”: [],
“groupNames”: []
}

(both map files exist in the transform folder)