Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(OCPI) Retrieving device model should also query based on type "Actual" #98

Open
yuvenus opened this issue Jan 8, 2025 · 0 comments · May be fixed by citrineos/citrineos-ocpi#164
Open
Assignees

Comments

@yuvenus
Copy link

yuvenus commented Jan 8, 2025

Which repository?
citrineos-ocpi

Describe the bug
When retrieving device model information from the database to populate OCPI data about a charging station, evse, and connector, where appropriate, we should also be querying based on VariableAttributes.type === "Actual", in addition to the rest of the query.

A sample query today that will fail if there are multiple VariableAttributes fulfilling the query, even though the type is different:

select va."value" 
        from "VariableAttributes" va 
          left join "Variables" v on va."variableId" = v."id" 
          left join "Components" c on va."componentId" = c."id"
          left join "Evses" e on c."evseDatabaseId" = e."databaseId" 
        where va."stationId" = '${stationId}' and e."id" = ${evseComponentId} and e."connectorId" = ${connectorId} and c."name" = 'Connector' and v."name" = 'AvailabilityState'

The above query should also include the final condition and v."type" = 'Actual' to prevent a "duplicate" errors.

To Reproduce
Steps to reproduce the behavior:

  1. Run citrineos-ocpi
  2. Have an EVSE with device model that has two entries for connector AvailabilityState, one with type "Actual" and one with type "Target"
  3. Retrieve a location, evse, or connector via OCPI API

Expected behavior
You should be able to retrieve a location, evse, or connector via OCPI, even if there are device model entries with differing types.

Desktop (please complete the following information):

  • OS: Windows 11
  • citrineos-core: rc-1.6.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant