eclipse / kuksa.val.services

Repository for Vehicle Service Related implementations for Eclipse SDV
Apache License 2.0
15 stars 18 forks source link

Mock Service create_set_action() works only once when setting to a fixed value on trigger #84

Closed lukasmittag closed 11 months ago

lukasmittag commented 11 months ago
mock_datapoint(
    path="Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition",
    initial_value=0,
    behaviors=[
        create_behavior(
            trigger=EventTrigger(EventType.ACTUATOR_TARGET),
            action=create_set_action(0),
        )
    ],
)

seems like it runs once if the target value is set to something

INFO:base_service:Connecting to Data Broker [127.0.0.1:55555]
INFO:base_service:Using gRPC metadata: None
INFO:base_service:[127.0.0.1:55555] Connectivity changed to: ChannelConnectivity.IDLE
INFO:base_service:Connected to data broker
INFO:mock_service:Subscribing to mocked datapoints...
INFO:mock_service:Feeding 'Vehicle.Body.Windshield.Front.Wiping.System.Mode' with value STOP_HOLD
INFO:mock_service:Feeding 'Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition' with value 0
INFO:base_service:[127.0.0.1:55555] Connectivity changed to: ChannelConnectivity.READY
INFO:behavior:Running behavior for Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition
INFO:mock_service:Feeding 'Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition' with value 12
INFO:behavior:Running behavior for Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition
INFO:behavior:Running behavior for Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition

what I did in kuksa-client:

Test Client> setTargetValue Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition 100
OK

Test Client> getValue Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition
{
    "path": "Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition",
    "value": {
        "value": 12.0,
        "timestamp": "2023-07-12T09:48:44.249621+00:00"
    }
}

Test Client> setValue Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition 100
OK

Test Client> setTargetValue Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition 10
OK

Test Client> getValue Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition
{
    "path": "Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition",
    "value": {
        "value": 100.0,
        "timestamp": "2023-07-12T09:49:30.348992+00:00"
    }
}

maybe not the use case we're aiming to mock for, more a report. So a low priority issue.