yamcs / python-yamcs-client

Yamcs Client for Python
https://docs.yamcs.org/python-yamcs-client/
GNU Lesser General Public License v3.0
16 stars 11 forks source link

Allow specification of generation time when writing parameters #18

Closed merose closed 2 years ago

merose commented 2 years ago

This is related to the Yamcs enhancement in https://github.com/yamcs/yamcs/issues/605.

It is currently possible to specify the generation time when writing parameters using the batchSetParameterValues API. The corresponding Python API should also support an optional argument to specify the generation time.

fqqb commented 2 years ago

Addressed as of v1.7.6

Example usage:

from datetime import datetime, timezone
from yamcs.tmtc.model import ValueUpdate

gentime = datetime.now(tz=timezone.utc)

# Example 1
processor.set_parameter_value("/some/parameter", 123, generation_time=gentime)
processor.set_parameter_value("/some/other/parameter", 456, generation_time=gentime)

# Example 2
processor.set_parameter_values({
    "/some/parameter": 123,
    "/some/other/parameter": 456
}, generation_time=gentime)

# Example 3
processor.set_parameter_values({
    "/some/parameter": ValueUpdate(123, generation_time=gentime),
    "/some/other/parameter": ValueUpdate(456, generation_time=gentime)
})

Works also for set_parameter_value because it gets redirected to set_parameter_values (thinking to get rid of the non-batch HTTP method on Yamcs).