Skip to content

Commit

Permalink
Merge pull request #581 from TheTechCompany/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
balbatross authored Sep 17, 2024
2 parents 634cb1c + 6af2fc5 commit 6eb23cc
Show file tree
Hide file tree
Showing 126 changed files with 1,747 additions and 359 deletions.
1 change: 1 addition & 0 deletions .github/workflows/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ jobs:
stack-name: ${{env.STACK_NAME}}
work-dir: ./packages/infrastructure/main
env:
HEXHIVE_SECRET: ${{ secrets.HEXHIVE_SECRET }}
IOT_USER: ${{ secrets.IOT_USER }}
IOT_PASS: ${{ secrets.IOT_PASS }}
IOT_EXCHANGE: ${{ secrets.IOT_EXCHANGE }}
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ dist/
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
!.yarn/versions

*stack


*.key
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.4.15-alpha.313](https://github.com/TheTechCompany/HiveCommandClient/compare/v1.4.15-alpha.312...v1.4.15-alpha.313) (2024-09-17)

**Note:** Version bump only for package @hivecomand-clients/root





## [1.4.15-alpha.312](https://github.com/TheTechCompany/HiveCommandClient/compare/v1.4.15-alpha.311...v1.4.15-alpha.312) (2024-09-11)

**Note:** Version bump only for package @hivecomand-clients/root





## [1.4.15-alpha.311](https://github.com/TheTechCompany/HiveCommandClient/compare/v1.4.15-alpha.310...v1.4.15-alpha.311) (2024-05-23)

**Note:** Version bump only for package @hivecomand-clients/root





## [1.4.15-alpha.310](https://github.com/TheTechCompany/HiveCommandClient/compare/v1.4.15-alpha.309...v1.4.15-alpha.310) (2024-05-23)

**Note:** Version bump only for package @hivecomand-clients/root





## [1.4.15-alpha.309](https://github.com/TheTechCompany/HiveCommandClient/compare/v1.4.15-alpha.308...v1.4.15-alpha.309) (2024-04-29)

**Note:** Version bump only for package @hivecomand-clients/root
Expand Down
52 changes: 36 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

SCADA system for IIOT 4.0

- [Electrical Editor](packages/core-ui/command-electrical-editor/README.md)

## Getting Started

Developer pathway
### Developer pathway

Get dependencies

[HexHive Gateway](https://github.com/TheTechCompany/HexHive)

```
git clone
Expand All @@ -17,23 +18,17 @@ cd HiveCommand/
yarn
```

Start Storybook (Component development)
Start gateway, backend + web-frontend
```
cd packages/core-ui/command-electrical-editor
hexhive-dev
yarn storybook
```


Start backend + web-frontend (HexHive gateway needs configuring first) [HexHive Gateway](https://github.com/TheTechCompany/HexHive)
```
cd packages/app/hivecommand-backend/; yarn start
cd packages/app/hivecommand-frontend/; yarn start
```

## Typescript references
#### Typescript references
To keep typescript inference throughout the monorepo follow the below steps;

Keep the root tsconfig.json up to date with project references
Expand All @@ -43,13 +38,38 @@ Add references at the bottom of modules that use shared modules

For webpack ts-loader with projectReferences and tsconfig-paths-webpack-plugin must be setup

Integrator pathway
### Integrator pathway

[Device onboarding](/docs/device-onboarding.md)

Architecture

```
┌─────────────────────┐
│EdgeDevice (RPi / PC)│
└┬────────────────────┘
┌▽────────────────┐
│SCADA Client │
└┬───────────────┬┘
┌▽─────────────┐┌▽─────────────┐
│Evented values││PLC Driver Bus│
└┬─────────────┘└┬─────────────┘
┌▽───┐┌──────────▽┐
│MQTT││PLC │
└────┘└───────────┘
```

Available SCADA Clients

- [@hive-command/cli-client](/packages/clients/cli-client/)
- [@hive-command/native](https://github.com/TheTechCompany/HiveCommand/releases)

[Download Builder](https://github.com/TheTechCompany/HiveCommand/releases)
Available PLC Drivers

End-user pathway
- [Driver interface](/packages/drivers/command-driver/)
- [OPC-UA](/packages/drivers/command-opcua/)
- [Ethernet/IP](/packages/drivers/command-ethernet-ip/)

[Sign Up](https://hivecommand.dev)

## Testing

Expand Down
32 changes: 32 additions & 0 deletions docs/device-onboarding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Device onboarding

Prerequisites

- [IO Mapping](./program-io.md)

## Stages

1. Device creation
2. Token setup
3. Provisioning
4. Runtime setup

### Device Creation

In the deployments menu click the add button, provide a site level name describing where this device will be, customise the ID if required and select the Program from the dropdown.

### Token Setup

Click the more button and select settings for the device you are trying to setup.

Click the add button and provide a name for the token you are trying to generate, click next and a token will be generated for this installation.

### Provisioning

Install the required client library for your installation, for a headless installation the [CLI Client](https://npmjs.com/@hive-command/cli-client) is probably the right choice, for a manned installation the [Native App](https://github.com/TheTechCompany/HiveCommand/releases) is a better choice.

Start the client and provide the provisoning code, after fetching the required context from the discovery server and installing the drivers data transmission should begin.

### Runtime setup

Power outages, maintenance and other things can cause the client to crash so it's a good idea to either set it up as a Windows service or run with a watchdog like forever
3 changes: 2 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Getting Started
# Getting Started

Binary file added docs/images/data-scopes-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/data-scopes-modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/data-scopes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tag-datatypes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tag-scope.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions docs/program-io.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Program IO

Communication is maintained by a series of driver libraries [(found here)](/packages/drivers/) each one is responsible for a single protocol and when instantiated is responsible for a long term connection to a single instance of the opposing server/client.

Values are included in a program through Tags and Types, Tags are top level mappings of name, datatype and location (which driver instance). Tags datatypes are basic primitives (string, number, boolean) and Types.

Types are re-usable mappings of tags that allow for mapping logical types e.g. Valves and Pumps.

## Driver setup

To setup a new driver in a program go to the System page in the program editor and click the add button

![Image](./images/data-scopes.png)

Select the driver type from the dropdown in the modal

![Image](./images/data-scopes-modal.png)

Finally configure the driver options to match the local configuration

![Image](./images/data-scopes-config.png)

## Tag setup

Tags are mapped to the local values by the drivers and each may implement this differently.

For Ethernet/IP the tags are fetched only from the global tag list and are batched in to small workloads fetched cyclicly

For OPC-UA the tags are fetched with a prefix applied from the driver configuration and are batched in to smaller workloads based on the OPC-UA serverside configuration.

Multiple different drivers can be combined through the tag list to make a new HMI top level tag list

To add new tags select Tags from the Editor menu.

Drivers can be configured from the driver dropdown on each tag row

![Image](./images/tag-scope.png)

Datatypes can be configured from the type dropdown

![Image](./images/tag-datatypes.png)

Changes are saved automatically as items are changed
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"packages/types/*"
],
"npmClient": "yarn",
"version": "1.4.15-alpha.309"
"version": "1.4.15-alpha.313"
}
32 changes: 32 additions & 0 deletions packages/app/hivecommand-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.4.15-alpha.313](https://github.com/TheTechCompany/HiveCommand/compare/v1.4.15-alpha.312...v1.4.15-alpha.313) (2024-09-17)

**Note:** Version bump only for package @hive-command/api





## [1.4.15-alpha.312](https://github.com/TheTechCompany/HiveCommand/compare/v1.4.15-alpha.311...v1.4.15-alpha.312) (2024-09-11)

**Note:** Version bump only for package @hive-command/api





## [1.4.15-alpha.311](https://github.com/TheTechCompany/HiveCommand/compare/v1.4.15-alpha.310...v1.4.15-alpha.311) (2024-05-23)

**Note:** Version bump only for package @hive-command/api





## [1.4.15-alpha.310](https://github.com/TheTechCompany/HiveCommand/compare/v1.4.15-alpha.309...v1.4.15-alpha.310) (2024-05-23)

**Note:** Version bump only for package @hive-command/api





## [1.4.15-alpha.309](https://github.com/TheTechCompany/HiveCommand/compare/v1.4.15-alpha.308...v1.4.15-alpha.309) (2024-04-29)

**Note:** Version bump only for package @hive-command/api
Expand Down
2 changes: 1 addition & 1 deletion packages/app/hivecommand-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hive-command/api",
"version": "1.4.15-alpha.309",
"version": "1.4.15-alpha.313",
"description": "",
"main": "dist/index.js",
"private": true,
Expand Down
29 changes: 21 additions & 8 deletions packages/app/hivecommand-api/src/device/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ export const useAddDeviceChart = (deviceId: string) => {
y: number,
w: number,
h: number,
total?: boolean
total?: boolean,
xAxisDomain?: any,
yAxisDomain?: any
}) => {
const item = mutation.createCommandDeviceAnalytic({
page: args.page,
Expand All @@ -111,7 +113,9 @@ export const useAddDeviceChart = (deviceId: string) => {
tagId: args.templateId,
subkeyId: args.keyId,
timeBucket: args.timeBucket,
device: deviceId
device: deviceId,
xAxisDomain: args.xAxisDomain,
yAxisDomain: args.yAxisDomain
}
})

Expand All @@ -121,7 +125,7 @@ export const useAddDeviceChart = (deviceId: string) => {
}
}
})
return (page: string, type: string, templateId: string, keyId: string, unit: string, timeBucket: string, x: number, y: number, w: number, h: number, total?: boolean) => {
return (page: string, type: string, templateId: string, keyId: string, unit: string, timeBucket: string, x: number, y: number, w: number, h: number, total?: boolean, xAxisDomain?: any, yAxisDomain?: any) => {
return addGraph({
args: {
page: page,
Expand All @@ -134,7 +138,9 @@ export const useAddDeviceChart = (deviceId: string) => {
w,
h,
total,
timeBucket
timeBucket,
xAxisDomain,
yAxisDomain
}
})
}
Expand All @@ -153,7 +159,9 @@ export const useUpdateDeviceChart = (deviceId: string) => {
y: number,
w: number,
h: number,
total?: boolean
total?: boolean,
xAxisDomain?: any,
yAxisDomain?: any
}) => {
const item = mutation.updateCommandDeviceAnalytic({
id: args.id,
Expand All @@ -168,7 +176,9 @@ export const useUpdateDeviceChart = (deviceId: string) => {
unit: args.unit,
timeBucket: args.timeBucket,
tagId: args.templateId,
subkeyId: args.keyId
subkeyId: args.keyId,
xAxisDomain: args.xAxisDomain,
yAxisDomain: args.yAxisDomain
}
})

Expand All @@ -178,7 +188,8 @@ export const useUpdateDeviceChart = (deviceId: string) => {
}
}
})
return (page: string, id: string, type: string, templateId: string, keyId: string, unit: string, timeBucket: string, x: number, y: number, w: number, h: number, total?: boolean) => {
return (page: string, id: string, type: string, templateId: string, keyId: string, unit: string, timeBucket: string, x: number, y: number, w: number, h: number, total?: boolean, xAxisDomain?: any, yAxisDomain?: any) => {
console.log({xAxisDomain, yAxisDomain})
return addGraph({
args: {
page,
Expand All @@ -192,7 +203,9 @@ export const useUpdateDeviceChart = (deviceId: string) => {
y,
w,
h,
total
total,
xAxisDomain,
yAxisDomain
}
})
}
Expand Down
Loading

0 comments on commit 6eb23cc

Please sign in to comment.