c-jimenez/open-ocpp

After starting the transaction in the case of a reservation on Connector 0, the status of Connector 0 was not reset to "available."

JamesLebron opened this issue · 1 comments

Dear author,

Hello.

During the testing process, we encountered the following issues:

  1. Firstly, we attempted to reserve Connector 0 and then initiate a remote start on Connector 0, followed by plugging in the charging cable on Connector 1 to begin charging.

  2. However, the status of Connector 0 remained "Reserved" throughout.

  3. I have added the following code, but it may not be correct. If it is correct, you can refer to it.

// Check reservation on the whole charge point
                    if (m_ocpp_config.reserveConnectorZeroSupported())
                    {
                        Connector& charge_point = m_connectors.getChargePointConnector();
                        if (charge_point.status == ChargePointStatus::Reserved)
                        {
                            // Check if this transaction can be used for the charge point reservation
                            if (m_reservation_manager.isTransactionAllowed(Connectors::CONNECTOR_ID_CHARGE_POINT, id_tag) ==
                                AuthorizationStatus::Accepted)
                            {
                                // Fill reservation id
                                start_transaction_req.reservationId = charge_point.reservation_id;

                                // Clear reservation
                                m_reservation_manager.clearReservation(connector_id);

                                //Clear Status with chargepint(0)
                                m_status_manager.updateConnectorStatusWithOutReport(Connectors::CONNECTOR_ID_CHARGE_POINT,
                                                                                    ocpp::types::ChargePointStatus::Available);
                            }
                        }
                    }
/**
 * @brief 
 * 
 * @param connector_id 
 * @param status 
 * @return true 
 * @return false 
 */
bool StatusManager::updateConnectorStatusWithOutReport(unsigned int connector_id, ocpp::types::ChargePointStatus status)
{
    Connector* connector = m_connectors.getConnector(connector_id);
    if (connector)
    {
        // Check if status has changed
        if (connector->status != status)
        {
            LOG_INFO << "Connector " << connector_id << " : " << ChargePointStatusHelper.toString(status);
            {
                std::lock_guard<std::mutex> lock(connector->mutex);

                // Save new status
                connector->status           = status;
                connector->status_timestamp = DateTime::now();
                return m_connectors.saveConnector(connector->id);
            }
        }
    }
}

Thanks for your proposal.
I will make a few more tests and I come back to you.