SmartGridready / SGrSpecifications

SmartGridready Specifications
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

#295 Add mapping for value for RestAPI #296

Closed ArndGerns closed 3 weeks ago

ArndGerns commented 4 weeks ago

Added mapping for value for RestAPI

It is now possible to have a mapping for read and write for a rest api datapoint.

Example:

<valueMapping>
  <mapping>
    <from>off</from>
    <to>false</to>
  </mapping>
  <mapping>
    <from>on</from>
    <to>true</to>
  </mapping>
</valueMapping>

For a write data call, the generic value is mapped with the mapping and the mapped value is written to the rest api.

For a read data call, the value is read from the rest api and then mapped to the generic value.

ergo-furrer commented 4 weeks ago

@ArndGerns @mkrebs81 : OK, for me.

mkrebs81 commented 4 weeks ago

I believe this will be sufficient.

The REST API query string or parameters are strings anyway. And the "from" content should be parsable according to the data point's data type.

I suppose the conversion direction depends on whether it is a read or write operation:

ergo-furrer commented 4 weeks ago

I believe this will be sufficient.

The REST API query string or parameters are strings anyway. And the "from" content should be parsable according to the data point's data type.

I suppose the conversion direction depends on whether it is a read or write operation:

  • read --> from = value returned by REST call, to = value returned to communicator
  • write --> from = value given by communicator, to = value given to REST call

It's my understanding too.

ArndGerns commented 4 weeks ago

Then it seems to be ambiguous. I guess @ergo-furrer has understood it differently.

Can we rename the mapping values in

That would be unambiguous. What do you think? Better names?

ergo-furrer commented 4 weeks ago

Then it seems to be ambiguous. I guess @ergo-furrer has understood it differently.

Can we rename the mapping values in

  • <restValue> => the value in the rest API call
  • <jsonValue> => the value in the generic inferface

That would be unambiguous. What do you think? Better names?

What about <genericValue>, <deviceValue> ?

ArndGerns commented 4 weeks ago

Then it seems to be ambiguous. I guess @ergo-furrer has understood it differently. Can we rename the mapping values in

  • <restValue> => the value in the rest API call
  • <jsonValue> => the value in the generic inferface

That would be unambiguous. What do you think? Better names?

What about <genericValue>, <deviceValue> ?

Yes. Better.

ArndGerns commented 3 weeks ago

Have changed it now to <genericValue>, <deviceValue>. If it is ok, I'ld merge it.