From 90128ea903ca4417bf20b2341be54814eaebdb5f Mon Sep 17 00:00:00 2001 From: bdular Date: Thu, 22 May 2025 23:54:51 +0200 Subject: [PATCH 1/3] Moved paths, removed unused/stale content --- .github/dependabot.yaml | 18 +- blog/2021-08-12-welcome.md | 4 +- blog/authors.yml | 8 + docs-services/logging/graylog.md | 85 ---- docs/client/adding-support-for-hardware.md | 57 +++ docs/{go-client => client}/configuration.md | 38 +- .../installing-libraries.md | 0 docs/{ => client}/intro.md | 0 .../running-the-client.md | 0 docs/go-client/_category_.json | 4 - docs/go-client/adding-support-for-hardware.md | 381 ------------------ .../hardware}/WiringSketch_eng.png | Bin .../hardware}/bill-of-materials.md | 0 {docs-hardware => docs/hardware}/hardware.md | 0 docs/ocpp/_category_.json | 4 - docs/ocpp/ocpp-16.md | 159 -------- docs/ocpp/ocpp-201.md | 266 ------------ .../services}/logging/_category_.json | 0 docs/services/logging/graylog.md | 85 ++++ .../services}/logging/logging.md | 0 {docs-services => docs/services}/mender.md | 4 +- .../services}/modem-setup.md | 86 ++-- docusaurus.config.js | 58 +-- src/pages/index.js | 4 +- 24 files changed, 253 insertions(+), 1008 deletions(-) create mode 100644 blog/authors.yml delete mode 100644 docs-services/logging/graylog.md create mode 100644 docs/client/adding-support-for-hardware.md rename docs/{go-client => client}/configuration.md (87%) rename docs/{go-client => client}/installing-libraries.md (100%) rename docs/{ => client}/intro.md (100%) rename docs/{go-client => client}/running-the-client.md (100%) delete mode 100644 docs/go-client/_category_.json delete mode 100644 docs/go-client/adding-support-for-hardware.md rename {docs-hardware => docs/hardware}/WiringSketch_eng.png (100%) rename {docs-hardware => docs/hardware}/bill-of-materials.md (100%) rename {docs-hardware => docs/hardware}/hardware.md (100%) delete mode 100644 docs/ocpp/_category_.json delete mode 100644 docs/ocpp/ocpp-16.md delete mode 100644 docs/ocpp/ocpp-201.md rename {docs-services => docs/services}/logging/_category_.json (100%) create mode 100644 docs/services/logging/graylog.md rename {docs-services => docs/services}/logging/logging.md (100%) rename {docs-services => docs/services}/mender.md (97%) rename {docs-services => docs/services}/modem-setup.md (52%) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 9bc3abe..3534cf9 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -3,26 +3,14 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" - assignees: - - "xBlaz3kx" - reviewers: - - "xBlaz3kx" + interval: "monthly" - package-ecosystem: "docker" directory: "/" schedule: - interval: "weekly" - assignees: - - "xBlaz3kx" - reviewers: - - "xBlaz3kx" + interval: "monthly" - package-ecosystem: "npm" directory: "/" schedule: - interval: "weekly" - assignees: - - "xBlaz3kx" - reviewers: - - "xBlaz3kx" \ No newline at end of file + interval: "monthly" \ No newline at end of file diff --git a/blog/2021-08-12-welcome.md b/blog/2021-08-12-welcome.md index a985e7c..b8aaa28 100644 --- a/blog/2021-08-12-welcome.md +++ b/blog/2021-08-12-welcome.md @@ -1,9 +1,7 @@ --- slug: welcome title: Welcome -author: xBlaz3kx -author_title: Developer -author_url: https://github.com/xBlaz3kx +author: bdular tags: [charge-pi, hello] --- diff --git a/blog/authors.yml b/blog/authors.yml new file mode 100644 index 0000000..a25fc2b --- /dev/null +++ b/blog/authors.yml @@ -0,0 +1,8 @@ +bdular: + name: Blaž Dular + title: Software Engineer + url: https://github.com/xBlaz3kx + image_url: https://github.com/xBlaz3kx.png + email: blaz@blazdular.cc + socials: + github: xBlaz3kx diff --git a/docs-services/logging/graylog.md b/docs-services/logging/graylog.md deleted file mode 100644 index 7555d4e..0000000 --- a/docs-services/logging/graylog.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -sidebar_position: 2 ---- - -# 📜 Graylog logging server - -## Prerequisites - -You should have a publicly accessible Linux or Windows server with Docker and docker-compose installed. - -See [Docker](https://docs.docker.com/engine/install/) and [docker-compose](https://docs.docker.com/compose/install/) -for installation guides. - -## 🏃 Deploying Graylog server with docker-compose - -1. Copy the following code into a docker-compose.yaml or use the provided [docker-compose](../../docker-compose.yaml). There - are two docker-compose files - the first one is the base and the second one uses Traefik as a reverse proxy for - routing. - -```yaml -version: '3' -services: - mongo: - image: mongo:4.4.1 - networks: - - graylog - volumes: - - mongo_data:/data/db - elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.0 - environment: - - http.host=0.0.0.0 - - transport.host=localhost - - network.host=0.0.0.0 - - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - networks: - - graylog - volumes: - - es_data:/usr/share/elasticsearch/data - graylog: - image: graylog/graylog:4.0 - environment: - - GRAYLOG_PASSWORD_SECRET= - # Password: admin - - GRAYLOG_ROOT_PASSWORD_SHA2=571dc059e9aac28f272adbb668914318f95f2a2e98cae34d807f54710f6da8dd - - GRAYLOG_HTTP_EXTERNAL_URI=http://:8081/ - volumes: - - graylog_data:/usr/share/graylog/data - networks: - - graylog - restart: always - depends_on: - - mongo - - elasticsearch - ports: - - "8081:9000" - - "1514:1514" - - "1514:1514/udp" - - "12201:12201" - - "12201:12201/udp" -networks: - graylog: - driver: bridge -volumes: - mongo_data: - driver: local - es_data: - driver: local - graylog_data: - driver: local -``` - -2. Change the password hint and SHA256 as well as the external `GRAYLOG_HTTP_EXTERNAL_URI` environment variable. - -3. Run using: - - ```bash - sudo docker-compose up -d - ``` - - or - - ```bash - sudo docker-compose -f docker-compose.yaml -f docker-compose.traefik.yaml up -d - ``` \ No newline at end of file diff --git a/docs/client/adding-support-for-hardware.md b/docs/client/adding-support-for-hardware.md new file mode 100644 index 0000000..17cc4ee --- /dev/null +++ b/docs/client/adding-support-for-hardware.md @@ -0,0 +1,57 @@ +--- +sidebar_position: 4 +--- + +# ➡️Adding hardware support + +There are four hardware component groups that are included in the project: + +1. NFC/RFID tag reader, +2. LCD (display), +3. (Led) Indicator, +4. Power meter, +5. EVCC. + +These hardware components have corresponding interfaces that are included in the `ChargePointHandler` struct. This +allows adding support for other models of hardware with similar functionalities. + +You're welcome to submit a Pull Request with any additional hardware model implementations! Be sure to test and document +your changes, update the [supported hardware](../hardware/hardware.md) table(s) with the new hardware model(s). It would +be nice to have a wiring sketch or a connection table included for the new model(s). + +## 💳 Reader hardware + +All readers must implement the `Reader` interface. It is recommended that you implement the interface in a new file +named after the model of the reader in the `hardware/reader` package. Then you should add a **constant** named after +the **model** of the reader in the `reader` file in the package and add a switch case with the implementation and the +necessary logic that returns a pointer to the struct. + +The settings of the reader are read from the `settings.json` file, which is stored in the cache and are available in the +NewTagReader method. + +## 🖥️ Display hardware + +All displays must implement the `LCD` interface. It is recommended that you implement the interface in a new file named +after the model of the display/LCD in the `hardware/display` package. Then you should add a **constant** named after +the **model** of the display in the `display` file in the package and add a switch case with the implementation and the +necessary logic that returns a pointer to the struct. + +## Indicator hardware + +The process is the same as the previous description. + +## ⚡ EVCC + +The process is similar to other components. Note: Init method will be called whenever the charge point boots. +The init method should perform any necessary setup steps, such as opening a communication path. Any two-way +communication should be initiated in another thread and should communicate through channels. + +## ⚡ Power meters + +The process is the same as the previous description. + +## ⚡ EVCC + +The process is similar to other components. Note: Init method will be called whenever the charge point boots. +The init method should perform any necessary setup steps, such as opening a communication path. Any two-way +communication should be initiated in another thread and should communicate through channels. diff --git a/docs/go-client/configuration.md b/docs/client/configuration.md similarity index 87% rename from docs/go-client/configuration.md rename to docs/client/configuration.md index 456cab6..bba4fe4 100644 --- a/docs/go-client/configuration.md +++ b/docs/client/configuration.md @@ -72,11 +72,11 @@ or might not work properly. #### chargePoint info -| Attribute | Description | Possible values | -|:---------------:|:------------------------------------------------------------------:|:-------------------:| -| maxChargingTime | Maxiumum amount of time that a transaction can last (in minutes). | Default: 180 | -| ocpp.vendor | Vendor ID | Default: "xBlaz3k" | -| ocpp.model | Model | Default: "ChargePi" | +| Attribute | Description | Possible values | +|:---------------:|:----------------------------------------------------------------:|:-------------------:| +| maxChargingTime | Maximum amount of time that a transaction can last (in minutes). | Default: 180 | +| ocpp.vendor | Vendor ID | Default: "xBlaz3k" | +| ocpp.model | Model | Default: "ChargePi" | #### chargePoint hardware @@ -175,14 +175,14 @@ EVSE with the provided configuration. #### Attributes -| Attribute | Description | Possible values | -|:----------:|:-----------------------------------------:|:---------------------------------------:| -| evseId | ID of the EVSE | >1 | -| connectors | List of available connectors for the EVSE || -| evcc | Charging Controller || -| status | Status of the EVSE | "Available", "Charging", "Faulted",... | -| session | Persistent session data || -| powerMeter | Power Meter configuration for EVSE || +| Attribute | Description | Possible values | +|:----------:|:-----------------------------------------:|:--------------------------------------:| +| evseId | ID of the EVSE | >1 | +| connectors | List of available connectors for the EVSE | | +| evcc | Charging Controller | | +| status | Status of the EVSE | "Available", "Charging", "Faulted",... | +| session | Persistent session data | | +| powerMeter | Power Meter configuration for EVSE | | #### evcc @@ -207,11 +207,11 @@ EVSE with the provided configuration. #### connectors -| Attribute | Description | Possible values | -|:-------------:|:-----------------------:|:-------------------------------------:| -| connectorId | connector ID | Default:"ChargePi" | -| type | type of the connector | "Schuko", "Type1","Type2", "CCS", ... | -| status | Status of the connector | "Available", "Charging", ... | +| Attribute | Description | Possible values | +|:-----------:|:-----------------------:|:-------------------------------------:| +| connectorId | connector ID | Default:"ChargePi" | +| type | type of the connector | "Schuko", "Type1","Type2", "CCS", ... | +| status | Status of the connector | "Available", "Charging", ... | Example EVSE configuration: @@ -248,4 +248,4 @@ Example EVSE configuration: "voltageDividerOffset": 1333 } } -`````` \ No newline at end of file +``` \ No newline at end of file diff --git a/docs/go-client/installing-libraries.md b/docs/client/installing-libraries.md similarity index 100% rename from docs/go-client/installing-libraries.md rename to docs/client/installing-libraries.md diff --git a/docs/intro.md b/docs/client/intro.md similarity index 100% rename from docs/intro.md rename to docs/client/intro.md diff --git a/docs/go-client/running-the-client.md b/docs/client/running-the-client.md similarity index 100% rename from docs/go-client/running-the-client.md rename to docs/client/running-the-client.md diff --git a/docs/go-client/_category_.json b/docs/go-client/_category_.json deleted file mode 100644 index aff515f..0000000 --- a/docs/go-client/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Go Client", - "position":2 -} diff --git a/docs/go-client/adding-support-for-hardware.md b/docs/go-client/adding-support-for-hardware.md deleted file mode 100644 index 818c574..0000000 --- a/docs/go-client/adding-support-for-hardware.md +++ /dev/null @@ -1,381 +0,0 @@ ---- -sidebar_position: 4 ---- - -# ➡️Adding hardware support - -There are four hardware component groups that are included in the project: - -1. NFC/RFID tag reader, -2. LCD (display), -3. (Led) Indicator, -4. Power meter, -5. EVCC. - -These hardware components have corresponding interfaces that are included in the `ChargePointHandler` struct. This -allows adding support for other models of hardware with similar functionalities. - -You're welcome to submit a Pull Request with any additional hardware model implementations! Be sure to test and document -your changes, update the [supported hardware](../hardware/hardware.md) table(s) with the new hardware model(s). It would -be nice to have a wiring sketch or a connection table included for the new model(s). - -## 💳 Reader hardware - -All readers must implement the `Reader` interface. It is recommended that you implement the interface in a new file -named after the model of the reader in the `hardware/reader` package. Then you should add a **constant** named after -the **model** of the reader in the `reader` file in the package and add a switch case with the implementation and the -necessary logic that returns a pointer to the struct. - -The settings of the reader are read from the `settings.json` file, which is stored in the cache and are available in the -NewTagReader method. - -```golang -package reader - -import ( - "context" - "errors" - log "github.com/sirupsen/logrus" - "github.com/xBlaz3kx/ChargePi-go/internal/models/settings" -) - -// Supported readers - by libnfc -const ( - PN532 = "PN532" -) - -var ( - ErrReaderUnsupported = errors.New("reader type unsupported") - ErrReaderDisabled = errors.New("reader disabled") -) - -// Reader is an abstraction for an RFID/NFC tag reader. -type Reader interface { - ListenForTags(ctx context.Context) - Cleanup() - Reset() - GetTagChannel() <-chan string -} - -// NewTagReader creates an instance of the Reader interface based on the provided configuration. -func NewTagReader(reader settings.TagReader) (Reader, error) { - if reader.IsEnabled { - log.Infof("Preparing tag reader from config: %s", reader.ReaderModel) - - switch reader.ReaderModel { - case PN532: - return nil, nil - // Your custom implmentation - default: - return nil, ErrReaderUnsupported - } - } - - return nil, ErrReaderDisabled -} - -``` - -## 🖥️ Display hardware - -All displays must implement the `LCD` interface. It is recommended that you implement the interface in a new file named -after the model of the display/LCD in the `hardware/display` package. Then you should add a **constant** named after -the **model** of the display in the `display` file in the package and add a switch case with the implementation and the -necessary logic that returns a pointer to the struct. - -```golang -package display - -import ( - "context" - "errors" - log "github.com/sirupsen/logrus" - "github.com/xBlaz3kx/ChargePi-go/internal/models/settings" - "time" -) - -const ( - DriverHD44780 = "hd44780" -) - -var ( - ErrDisplayUnsupported = errors.New("display type unsupported") - ErrDisplayDisabled = errors.New("display disabled") -) - -type ( - // LCDMessage Object representing the message that will be displayed on the LCD. - // Each array element in Messages represents a line being displayed on the 16x2 screen. - LCDMessage struct { - Messages []string - MessageDuration time.Duration - } - - // LCD is an abstraction layer for concrete implementation of a display. - LCD interface { - DisplayMessage(message LCDMessage) - ListenForMessages(ctx context.Context) - Cleanup() - Clear() - GetLcdChannel() chan<- LCDMessage - } -) - -// NewMessage creates a new message for the LCD. -func NewMessage(duration time.Duration, messages []string) LCDMessage { - return LCDMessage{ - Messages: messages, - MessageDuration: duration, - } -} - -// NewDisplay returns a concrete implementation of an LCD based on the drivers that are supported. -// The LCD is built with the settings from the settings file. -func NewDisplay(lcdSettings settings.Display) (LCD, error) { - if lcdSettings.IsEnabled { - log.Info("Preparing LCD from config") - - switch lcdSettings.Driver { - case DriverHD44780: - // custom implementation - default: - return nil, ErrDisplayUnsupported - } - } - - return nil, ErrDisplayDisabled -} - -``` - -## Indicator hardware - -The process is the same as the previous description. - -```golang -package indicator - -import ( - "errors" - log "github.com/sirupsen/logrus" - "github.com/spf13/viper" -) - -// color constants -const ( - Off = 0x0 - White = 0xFFFFFF - Red = 0xff0000 - Green = 0x00ff00 - Blue = 0x000ff - Yellow = 0xeeff00 - Orange = 0xff7b00 -) - -// Supported types -const ( - TypeWS281x = "WS281x" -) - -var ( - ErrInvalidIndex = errors.New("invalid index") - ErrInvalidPin = errors.New("invalid data pin #") - ErrInvalidNumberOfLeds = errors.New("number of leds must be greater than zero") -) - -type ( - // Indicator is an abstraction layer for connector status indication, usually an RGB LED strip. - Indicator interface { - DisplayColor(index int, colorHex uint32) error - Blink(index int, times int, colorHex uint32) error - Cleanup() - } -) - -// NewIndicator constructs the Indicator based on the type provided by the settings file. -func NewIndicator(stripLength int) Indicator { - var ( - indicatorEnabled = viper.GetBool("chargepoint.hardware.ledIndicator.enabled") - indicatorType = viper.GetString("chargepoint.hardware.ledIndicator.type") - indicateCardRead = viper.GetBool("chargepoint.hardware.ledIndicator.indicateCardRead") - ) - - if indicatorEnabled { - if indicateCardRead { - stripLength++ - } - - log.Infof("Preparing Indicator from config: %s", indicatorType) - switch indicatorType { - case TypeWS281x: - // Your custom implementation - default: - return nil, ErrReaderUnsupported - } - } - - return nil -} -``` - -## ⚡ EVCC - -The process is similar to other components. Note: Init method will be called whenever the charge point boots. -The init method should perform any necessary setup steps, such as opening a communication path. Any two-way -communication should be initiated in another thread and should communicate through channels. - -```golang -package evcc - -import ( - "context" - "github.com/xBlaz3kx/ChargePi-go/internal/models/settings" -) - -const ( - PhoenixEMCPPPETH = "EM-CP-PP-ETH" - Relay = "Relay" -) - -type ( - EVCC interface { - Init(ctx context.Context) error - EnableCharging() error - DisableCharging() - SetMaxChargingCurrent(value float64) error - GetMaxChargingCurrent() float64 - Lock() - Unlock() - GetState() string - Cleanup() error - } -) - -// NewPowerMeter creates a new power meter based on the connector settings. -func NewEVCCFromType(evccSettings settings.EVCC) (EVCC, error) { - switch evccSettings.Type { - case Relay: - return nil, nil - case PhoenixEMCPPPETH: - return nil, nil - // Your custom implementation - default: - return nil, nil - } -} - -} -``` - -## ⚡ Power meters - -The process is the same as the previous description. - -```golang -package powerMeter - -import ( - "context" - "errors" - log "github.com/sirupsen/logrus" - "github.com/xBlaz3kx/ChargePi-go/internal/models/settings" -) - -// Supported power meters -const ( - TypeC5460A = "cs5460a" -) - -var ( - ErrPowerMeterUnsupported = errors.New("power meter type not supported") - ErrPowerMeterDisabled = errors.New("power meter not enabled") -) - -// PowerMeter is an abstraction for measurement hardware. -type ( - PowerMeter interface { - Init(ctx context.Context) error - Reset() - GetEnergy() float64 - GetPower() float64 - GetCurrent() float64 - GetVoltage() float64 - GetRMSCurrent() float64 - GetRMSVoltage() float64 - } -) - -// NewPowerMeter creates a new power meter based on the connector settings. -func NewPowerMeter(meterSettings settings.PowerMeter) (PowerMeter, error) { - if meterSettings.Enabled { - log.Infof("Creating a new power meter: %s", meterSettings.Type) - - switch meterSettings.Type { - case TypeC5460A: - // Your custom implementation - return nil, nil - default: - return nil, ErrPowerMeterUnsupported - } - } - - return nil, ErrPowerMeterDisabled -} -``` - -## ⚡ EVCC - -The process is similar to other components. Note: Init method will be called whenever the charge point boots. -The init method should perform any necessary setup steps, such as opening a communication path. Any two-way -communication should be initiated in another thread and should communicate through channels. - -```golang -package evcc - -import ( - "context" - "github.com/xBlaz3kx/ChargePi-go/internal/models/settings" -) - -import ( - "context" - "errors" - log "github.com/sirupsen/logrus" - "github.com/xBlaz3kx/ChargePi-go/internal/models/settings" -) - -// Supported power meters -const ( - PhoenixEMCPPPETH = "EM-CP-PP-ETH" - Relay = "Relay" -) - -type ( - EVCC interface { - Init(ctx context.Context) error - EnableCharging() error - DisableCharging() - SetMaxChargingCurrent(value float64) error - GetMaxChargingCurrent() float64 - Lock() - Unlock() - GetState() string - Cleanup() error - } -) - -// NewPowerMeter creates a new power meter based on the connector settings. -func NewEVCCFromType(evccSettings settings.EVCC) (EVCC, error) { - switch evccSettings.Type { - case Relay: - return nil, nil - case PhoenixEMCPPPETH: - return nil, nil - // Your custom implementation - default: - return nil, nil - } -} - -} -``` diff --git a/docs-hardware/WiringSketch_eng.png b/docs/hardware/WiringSketch_eng.png similarity index 100% rename from docs-hardware/WiringSketch_eng.png rename to docs/hardware/WiringSketch_eng.png diff --git a/docs-hardware/bill-of-materials.md b/docs/hardware/bill-of-materials.md similarity index 100% rename from docs-hardware/bill-of-materials.md rename to docs/hardware/bill-of-materials.md diff --git a/docs-hardware/hardware.md b/docs/hardware/hardware.md similarity index 100% rename from docs-hardware/hardware.md rename to docs/hardware/hardware.md diff --git a/docs/ocpp/_category_.json b/docs/ocpp/_category_.json deleted file mode 100644 index 93face8..0000000 --- a/docs/ocpp/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "OCPP configuration", - "position": 4 -} diff --git a/docs/ocpp/ocpp-16.md b/docs/ocpp/ocpp-16.md deleted file mode 100644 index 7c49ebf..0000000 --- a/docs/ocpp/ocpp-16.md +++ /dev/null @@ -1,159 +0,0 @@ ---- -sidebar_position: 1 ---- - -# OCPP 1.6 - -The default/reference configuration for protocol version 1.6 can be found in the `configuration` file. - -Each OCPP 1.6 configuration variable is represented as a dictionary with key equal to **variable name**, the **value** -and **permission** attributes. For more information regarding OCPP 1.6 configuration, -visit [the official docs](https://www.oasis-open.org/committees/download.php/58944/ocpp-1.6.pdf). - -```json -{ - "version": 1, - "keys": [ - { - "key": "AllowOfflineTxForUnknownId", - "readOnly": false, - "value": "false" - }, - { - "key": "AuthorizationCacheEnabled", - "readOnly": false, - "value": "true" - }, - { - "key": "AuthorizeRemoteTxRequests", - "readOnly": false, - "value": "false" - }, - { - "key": "ClockAlignedDataInterval", - "readOnly": false, - "value": "0" - }, - { - "key": "ConnectionTimeOut", - "readOnly": false, - "value": "50" - }, - { - "key": "GetConfigurationMaxKeys", - "readOnly": false, - "value": "30" - }, - { - "key": "HeartbeatInterval", - "readOnly": false, - "value": "60" - }, - { - "key": "LocalAuthorizeOffline", - "readOnly": false, - "value": "true" - }, - { - "key": "LocalPreAuthorize", - "readOnly": false, - "value": "true" - }, - { - "key": "MaxEnergyOnInvalidId", - "readOnly": false, - "value": "0" - }, - { - "key": "MeterValuesSampledData", - "readOnly": false, - "value": "Power.Active.Import" - }, - { - "key": "MeterValuesAlignedData", - "readOnly": false, - "value": "false" - }, - { - "key": "NumberOfConnectors", - "readOnly": false, - "value": "6" - }, - { - "key": "MeterValueSampleInterval", - "readOnly": false, - "value": "60" - }, - { - "key": "ResetRetries", - "readOnly": false, - "value": "3" - }, - { - "key": "ConnectorPhaseRotation", - "readOnly": false, - "value": "0.RST, 1.RST, 2.RTS" - }, - { - "key": "StopTransactionOnEVSideDisconnect", - "readOnly": false, - "value": "true" - }, - { - "key": "StopTransactionOnInvalidId", - "readOnly": false, - "value": "true" - }, - { - "key": "StopTxnAlignedData", - "readOnly": false, - "value": "" - }, - { - "key": "StopTxnSampledData", - "readOnly": false, - "value": "" - }, - { - "key": "SupportedFeatureProfiles", - "readOnly": false, - "value": "Core, LocalAuthListManagement, Reservation, RemoteTrigger" - }, - { - "key": "TransactionMessageAttempts", - "readOnly": false, - "value": "3" - }, - { - "key": "TransactionMessageRetryInterval", - "readOnly": false, - "value": "60" - }, - { - "key": "UnlockConnectorOnEVSideDisconnect", - "readOnly": false, - "value": "true" - }, - { - "key": "ReserveConnectorZeroSupported", - "readOnly": false, - "value": "false" - }, - { - "key": "SendLocalListMaxLength", - "readOnly": false, - "value": "20" - }, - { - "key": "LocalAuthListEnabled", - "readOnly": false, - "value": "true" - }, - { - "key": "LocalAuthListMaxLength", - "readOnly": false, - "value": "20" - } - ] -} -``` \ No newline at end of file diff --git a/docs/ocpp/ocpp-201.md b/docs/ocpp/ocpp-201.md deleted file mode 100644 index 72a6220..0000000 --- a/docs/ocpp/ocpp-201.md +++ /dev/null @@ -1,266 +0,0 @@ ---- -sidebar_position: 2 ---- - -# OCPP 2.0.1 - -Configuration for protocol version 2.0.1 can be found in _/charge_point/v201/configuration/configuration.json_. - -> Note: not available for the Go client (yet). - -In the protocol version 2.0.1, configuration variables are nested in Controllers (postfix - Ctrlr). Each controller has -variables represented as a dictionary with attributes: **readOnly**, **value** and _optionally_ **unit**. Some -controllers aren't completely supported. For more information regarding OCPP 2.0.1 configuration, -visit [the official website](https://www.openchargealliance.org/protocols/ocpp-201/). - -```json -{ - "AlignedDataCtrlr": { - "Enabled": false, - "Measurands": { - "readOnly": false, - "value": [] - }, - "Interval": { - "readOnly": false, - "value": 50, - "unit": "seconds" - }, - "TxEndedMeasurands": { - "readOnly": false, - "value": [] - }, - "TxEndedInterval": { - "readOnly": false, - "value": 50, - "unit": "seconds" - } - }, - "AuthCacheCtrlr": { - "Enabled": false, - "AuthCacheEnabled": { - "readOnly": false, - "value": true - }, - "AuthCacheLifeTime": { - "readOnly": false, - "value": true - } - }, - "AuthCtrlr": { - "Enabled": true, - "AuthorizeRemoteStart": { - "readOnly": true, - "value": true - }, - "AuthEnabled": { - "readOnly": false, - "value": true - }, - "OfflineTxForUnknownIdEnabled": { - "readOnly": false, - "value": false - }, - "LocalAuthorizeOffline": { - "readOnly": false, - "value": true - }, - "LocalPreAuthorize": { - "readOnly": false, - "value": true - } - }, - "CHAdeMOCtrlr": { - "Enabled": false - }, - "ClockCtrlr": { - "Enabled": false, - "DateTime": { - "readOnly": true, - "value": 1 - }, - "TimeSource": { - "readOnly": false, - "value": [ - "Heartbeat", - "MobileNetwork" - ] - } - }, - "CustomizationCtrlr": { - "Enabled": false - }, - "DeviceDataCtrlr": { - "Enabled": false, - "ItemsPerMessage": { - "readOnly": true, - "value": 1 - }, - "BytesPerMessage": { - "readOnly": true, - "value": 1 - } - }, - "DisplayMessageCtrlr": { - "Enabled": false - }, - "ISO15118Ctrlr": { - "Enabled": false - }, - "LocalAuthListCtrlr": { - "Enabled": false - }, - "MonitoringCtrlr": { - "Enabled": false - }, - "OCPPCommCtrlr": { - "Enabled": true, - "RetryBackOffRepeatTimes": { - "readOnly": false, - "value": 1 - }, - "RetryBackOffRandomRange": { - "readOnly": false, - "unit": "seconds", - "value": 1 - }, - "RetryBackOffWaitMinimum": { - "readOnly": false, - "unit": "seconds", - "value": 1 - }, - "WebSocketPingInterval": { - "readOnly": false, - "unit": "seconds", - "value": 1 - }, - "DefaultMessageTimeout": { - "readOnly": true, - "unit": "seconds", - "value": 1 - }, - "FileTransferProtocols": { - "readOnly": true, - "value": [ - "HTTP", - "HTTPS" - ] - }, - "HeartbeatInterval": { - "readOnly": false, - "unit": "seconds", - "value": 60 - }, - "NetworkConfigurationPriority": { - "readOnly": false, - "value": [] - }, - "NetworkProfileConnectionAttempts": { - "readOnly": false, - "value": 1 - }, - "OfflineThreshold": { - "readOnly": false, - "unit": "seconds", - "value": 150 - }, - "MessageAttempts": { - "readOnly": false, - "value": 1 - }, - "MessageAttemptInterval": { - "unit": "seconds", - "value": 90, - "readOnly": false - }, - "UnlockOnEVSideDisconnect": { - "value": true, - "readOnly": false - }, - "ResetRetries": { - "readOnly": false, - "value": 90 - } - }, - "ReservationCtrlr": { - "Enabled": false - }, - "SampledDataCtrlr": { - "Enabled": true, - "SampledDataEnabled": { - "readOnly": false, - "value": true - }, - "TxEndedMeasurands": { - "readOnly": false, - "value": [] - }, - "TxEndedInterval": { - "readOnly": false, - "value": 60, - "unit": "seconds" - }, - "TxStartedMeasurands": { - "readOnly": false, - "value": [] - }, - "TxUpdatedMeasurands": { - "readOnly": false, - "value": [] - }, - "TxUpdatedInterval": { - "readOnly": false, - "value": [] - } - }, - "SecurityCtrlr": { - "Enabled": false, - "OrganizationName": { - "readOnly": false, - "value": "UL FE" - }, - "CertificateEntries": { - "readOnly": true, - "value": 1 - }, - "SecurityProfile": { - "readOnly": true, - "value": 1 - } - }, - "SmartChargingCtrlr": { - "Enabled": false - }, - "TariffCostCtrlr": { - "Enabled": false - }, - "TxCtrlr": { - "Enabled": true, - "EVConnectionTimeOut": { - "readOnly": false, - "value": 60, - "unit": "seconds" - }, - "StopTxOnEVSideDisconnect": { - "readOnly": true, - "value": true - }, - "TxStartPoint": { - "readOnly": true, - "value": [ - "Authorized" - ] - }, - "TxStopPoint": { - "readOnly": true, - "value": [ - "PowerPathClosed" - ] - }, - "StopTxOnInvalidId": { - "readOnly": false, - "value": true - } - } -} -``` \ No newline at end of file diff --git a/docs-services/logging/_category_.json b/docs/services/logging/_category_.json similarity index 100% rename from docs-services/logging/_category_.json rename to docs/services/logging/_category_.json diff --git a/docs/services/logging/graylog.md b/docs/services/logging/graylog.md new file mode 100644 index 0000000..57568b7 --- /dev/null +++ b/docs/services/logging/graylog.md @@ -0,0 +1,85 @@ +--- +sidebar_position: 2 +--- + +# 📜 Graylog logging server + +## Prerequisites + +You should have a publicly accessible Linux or Windows server with Docker and docker-compose installed. + +See [Docker](https://docs.docker.com/engine/install/) and [docker-compose](https://docs.docker.com/compose/install/) +for installation guides. + +## 🏃 Deploying Graylog server with docker-compose + +1. Copy the following code into a docker-compose.yaml or use the provided [docker-compose](../../docker-compose.yaml). There + are two docker-compose files - the first one is the base and the second one uses Traefik as a reverse proxy for + routing. + + ```yaml + version: '3' + services: + mongo: + image: mongo:4.4.1 + networks: + - graylog + volumes: + - mongo_data:/data/db + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.0 + environment: + - http.host=0.0.0.0 + - transport.host=localhost + - network.host=0.0.0.0 + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + networks: + - graylog + volumes: + - es_data:/usr/share/elasticsearch/data + graylog: + image: graylog/graylog:4.0 + environment: + - GRAYLOG_PASSWORD_SECRET= + # Password: admin + - GRAYLOG_ROOT_PASSWORD_SHA2=571dc059e9aac28f272adbb668914318f95f2a2e98cae34d807f54710f6da8dd + - GRAYLOG_HTTP_EXTERNAL_URI=http://:8081/ + volumes: + - graylog_data:/usr/share/graylog/data + networks: + - graylog + restart: always + depends_on: + - mongo + - elasticsearch + ports: + - "8081:9000" + - "1514:1514" + - "1514:1514/udp" + - "12201:12201" + - "12201:12201/udp" + networks: + graylog: + driver: bridge + volumes: + mongo_data: + driver: local + es_data: + driver: local + graylog_data: + driver: local + ``` + +2. Change the password hint and SHA256 as well as the external `GRAYLOG_HTTP_EXTERNAL_URI` environment variable. + +3. Run using: + + ```bash + sudo docker-compose up -d + ``` + + or + + ```bash + sudo docker-compose -f docker-compose.yaml -f docker-compose.traefik.yaml up -d + ``` \ No newline at end of file diff --git a/docs-services/logging/logging.md b/docs/services/logging/logging.md similarity index 100% rename from docs-services/logging/logging.md rename to docs/services/logging/logging.md diff --git a/docs-services/mender.md b/docs/services/mender.md similarity index 97% rename from docs-services/mender.md rename to docs/services/mender.md index 436aa78..7efd5b5 100644 --- a/docs-services/mender.md +++ b/docs/services/mender.md @@ -28,6 +28,6 @@ We will use [Mender](https://mender.io/) as OTA service for updating Linux, Dock Optionally, you can run only the client service: - ```bash + ```bash docker-compose up -d chargepi - ``` + ``` diff --git a/docs-services/modem-setup.md b/docs/services/modem-setup.md similarity index 52% rename from docs-services/modem-setup.md rename to docs/services/modem-setup.md index 38dadb7..c195fdc 100644 --- a/docs-services/modem-setup.md +++ b/docs/services/modem-setup.md @@ -29,13 +29,13 @@ sidebar_position: 3 sudo /usr/bin/modem3g/sakis3g connect --interactive ``` -5. Get default settings for your modem: +4. Get default settings for your modem: ```bash lsusb ``` -6. Paste default settings in a file: +5. Paste default settings in a file: ```bash sudo nano /etc/sakis3g.conf @@ -54,58 +54,58 @@ sidebar_position: 3 1. Make two service files: -```bash -sudo nano /etc/systemd/system/modem-connection.service -sudo nano /etc/systemd/system/ChargePi.service -``` + ```bash + sudo nano /etc/systemd/system/modem-connection.service + sudo nano /etc/systemd/system/ChargePi.service + ``` 2. Paste into modem-connection.service file: -```bash - [Unit] - Description=Modem connection service - - [Service] - Type=simple - ExecStart=/usr/bin/modem3g/sakis3g --sudo connect - Restart=on-failure - RestartSec=5 - KillMode=process - - [Install] - WantedBy=multi-user.target -``` + ```bash + [Unit] + Description=Modem connection service + + [Service] + Type=simple + ExecStart=/usr/bin/modem3g/sakis3g --sudo connect + Restart=on-failure + RestartSec=5 + KillMode=process + + [Install] + WantedBy=multi-user.target + ``` 3. Paste into ChargePi.service file: -```bash - [Unit] - Description=ChargePi client - After=network.target modem-connection.service - - [Service] - Type=simple - ExecStart=go build //ChargePi-go/ && ./ChargePi-go - Restart=on-failure - KillSignal=SIGTERM - - [Install] - WantedBy=multi-user.target -``` + ```bash + [Unit] + Description=ChargePi client + After=network.target modem-connection.service + + [Service] + Type=simple + ExecStart=go build //ChargePi-go/ && ./ChargePi-go + Restart=on-failure + KillSignal=SIGTERM + + [Install] + WantedBy=multi-user.target + ``` -**Go should be installed and the binary should be added to PATH variable.** + **Go should be installed and the binary should be added to PATH variable.** -Repeat next steps for both files: + Repeat next steps for both files: 4. Give permissions and add services to **systemd**: -```bash -sudo chmod 640 /etc/systemd/system/modem-connection.service -systemctl status modem-connection.service -sudo systemctl daemon-reload -sudo systemctl enable modem-connection.service -sudo systemctl start modem-connection.service -``` + ```bash + sudo chmod 640 /etc/systemd/system/modem-connection.service + systemctl status modem-connection.service + sudo systemctl daemon-reload + sudo systemctl enable modem-connection.service + sudo systemctl start modem-connection.service + ``` ### References: diff --git a/docusaurus.config.js b/docusaurus.config.js index 22f87c0..8bbdff9 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -7,7 +7,7 @@ const lightCodeTheme = themes.dracula; module.exports = { title: 'ChargePi', tagline: 'A configurable, modular, open source charge point', - url: 'https://chargepi.cc', + url: 'http://localhost:3000', baseUrl: '/', onBrokenLinks: 'warn', onBrokenMarkdownLinks: 'warn', @@ -15,6 +15,13 @@ module.exports = { organizationName: 'ChargePi', projectName: 'ChargePi', themeConfig: { + logo: { + alt: 'ChargePi Logo', + src: 'img/Logo.svg', + href: 'https://chargepi.cc', + width: 160, + height: 51, + }, navbar: { title: ' ', logo: { @@ -31,22 +38,19 @@ module.exports = { type: 'doc', docId: 'intro', label: 'Client', - }, { + docsPluginId: 'docs-client', + }, + { type: 'doc', docId: 'hardware', label: 'Hardware', docsPluginId: 'docs-hardware', - }, { - type: 'doc', - docId: 'modem-setup', - label: 'Services', - docsPluginId: 'docs-services', }, ], }, {to: '/blog', label: 'Blog', position: 'left'}, { - href: 'https://github.com/ChargePi?tab=repositories&q=ChargePi-go', + href: 'https://github.com/ChargePi/ChargePi-go', label: 'GitHub', position: 'right' } @@ -61,22 +65,16 @@ module.exports = { { label: 'Client', to: '/docs/intro' - }, { + }, + { label: 'Hardware', to: '/hardware/hardware' - }, { - label: 'Services', - to: '/services/modem-setup' - } + }, ] }, { title: 'Social', items: [ - { - label: 'Stack Overflow', - href: 'https://stackoverflow.com/questions/tagged/chargepi' - }, { label: 'Discord', href: 'https://discordapp.com/invite/chargepi' @@ -97,12 +95,12 @@ module.exports = { ] } ], - copyright: `Copyright © 2022-${new Date().getFullYear()} ChargePi.` + copyright: `Copyright © 2022-${new Date().getFullYear()} ChargePi` }, prism: { theme: lightCodeTheme, darkTheme: darkCodeTheme, - additionalLanguages: ['go', 'python', 'bash', 'docker', 'diff', 'json'], + additionalLanguages: ['go', 'golang', 'python', 'bash', 'docker', 'diff', 'json', 'text'], } }, presets: [ @@ -111,31 +109,41 @@ module.exports = { { docs: { sidebarPath: require.resolve('./sidebars.js'), - editUrl: 'https://github.com/ChargePi/ChargePi-docs/edit/master/' + editUrl: 'https://github.com/ChargePi/docs/edit/master/' }, blog: { showReadingTime: true, editUrl: - 'https://github.com/ChargePi/ChargePi-docs/edit/master/' + 'https://github.com/ChargePi/docs/edit/master/' }, theme: { customCss: require.resolve('./src/css/custom.css') } } ] - ], plugins: [ + ], + plugins: [ + [ + '@docusaurus/plugin-content-docs', + { + id: 'docs-client', + path: './docs/client', + routeBasePath: 'client', + }, + ], [ '@docusaurus/plugin-content-docs', { id: 'docs-hardware', - path: 'docs-hardware', + path: './docs/hardware', routeBasePath: 'hardware', }, - ], [ + ], + [ '@docusaurus/plugin-content-docs', { id: 'docs-services', - path: 'docs-services', + path: './docs/services', routeBasePath: 'services', } ] diff --git a/src/pages/index.js b/src/pages/index.js index f5e7346..4c5e31c 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -26,7 +26,7 @@ function HomepageHeader() {
+ href="https://github.com/ChargePi/ChargePi-go"> GitHub @@ -41,7 +41,7 @@ export default function Home() { return ( + description="ChargePi is an open-source, linux based ⚡Charge Point framework with support for off the shelf and commercial hardware.">
From 3bf3c2f732e8ec9be3034df65d325bf974e934fc Mon Sep 17 00:00:00 2001 From: bdular Date: Fri, 23 May 2025 09:59:50 +0200 Subject: [PATCH 2/3] fix: workflow should build but publish only on push to master --- .github/workflows/deployment.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 4347533..9057360 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -4,8 +4,9 @@ on: push: branches: - master - # Review gh actions docs if you want to further define triggers, paths, etc - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on + pull_request: + branches: + - master jobs: build: @@ -30,7 +31,7 @@ jobs: version: 10.11.0 - name: Install dependencies - run: pnpm install # --frozen-lockfile + run: pnpm install --frozen-lockfile - name: Build website run: pnpm build @@ -42,6 +43,7 @@ jobs: deploy: name: Deploy to GitHub Pages needs: build + if: ${{ github.event_name != 'pull_request' }} # Grant GITHUB_TOKEN the permissions required to make a Pages deployment permissions: From 0a90127d3d84de7ac9d28f7054bf776628b82148 Mon Sep 17 00:00:00 2001 From: bdular Date: Fri, 23 May 2025 10:02:25 +0200 Subject: [PATCH 3/3] fix: indentation --- docs/client/installing-libraries.md | 10 +++++----- docs/services/logging/logging.md | 3 +-- docs/services/mender.md | 4 ++-- docs/services/modem-setup.md | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/client/installing-libraries.md b/docs/client/installing-libraries.md index c567469..3260853 100644 --- a/docs/client/installing-libraries.md +++ b/docs/client/installing-libraries.md @@ -12,11 +12,11 @@ you use this if you do not want to (re)configure anything. Usage: -```bash - cd ~/ChargePi-go/docs - chmod +x install-dependencies.sh - ./install-dependencies.sh 1 -``` + ```bash + cd ~/ChargePi-go/docs + chmod +x install-dependencies.sh + ./install-dependencies.sh 1 + ``` ## Building libnfc for PN532 diff --git a/docs/services/logging/logging.md b/docs/services/logging/logging.md index 41c276e..4832d74 100644 --- a/docs/services/logging/logging.md +++ b/docs/services/logging/logging.md @@ -26,11 +26,10 @@ Logging is configured in the `settings` file. There are multiple ways of logging | `host` | Any valid IP/hostname | / | Only needed when the type is `remote`. | | `port` | / | / | Only needed when the type is `remote`. | -Example logging settings: +### Example ```json { - // ... other settings "logging": { "type": [ "remote", diff --git a/docs/services/mender.md b/docs/services/mender.md index 7efd5b5..7c74622 100644 --- a/docs/services/mender.md +++ b/docs/services/mender.md @@ -23,11 +23,11 @@ We will use [Mender](https://mender.io/) as OTA service for updating Linux, Dock 5. Run docker-compose: ```bash - docker-compose up -d + docker compose up -d ``` Optionally, you can run only the client service: ```bash - docker-compose up -d chargepi + docker compose up -d chargepi ``` diff --git a/docs/services/modem-setup.md b/docs/services/modem-setup.md index c195fdc..6684060 100644 --- a/docs/services/modem-setup.md +++ b/docs/services/modem-setup.md @@ -50,7 +50,7 @@ sidebar_position: 3 MODEM="12d1:155e" ``` -## Running as service script: +## Running as service script 1. Make two service files: @@ -107,7 +107,7 @@ sidebar_position: 3 sudo systemctl start modem-connection.service ``` -### References: +### References * [Sakis3g client](http://raspberry-at-home.com/installing-3g-modem/#more-138) * [Systemd services](https://www.howtogeek.com/687970/how-to-run-a-linux-program-at-startup-with-systemd/)