Skip to content

Epics CA transport does not handle Bool values correctly #169

@GDYendell

Description

@GDYendell
ERROR:root:Exception when running dispatched callback
Traceback (most recent call last):
  File "/venv/lib/python3.11/site-packages/softioc/asyncio_dispatcher.py", line 86, in async_wrapper
    await ret
  File "/workspaces/FastCS/src/fastcs/transport/epics/ca/ioc.py", line 202, in on_update
    cast_from_epics_type(attribute.datatype, value)
  File "/workspaces/FastCS/src/fastcs/transport/epics/ca/util.py", line 109, in cast_from_epics_type
    return datatype.validate(value)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/FastCS/src/fastcs/datatypes.py", line 42, in validate
    raise ValueError(f"Value '{value}' is not of type {self.dtype}")
ValueError: Value '1' is not of type <class 'bool'>

The Epics CA transport represents booleans as integer 0/1, so it needs to convert to False/True.

This was broken in #102.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions