├── .dockerignore
├── .gitattributes
├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── .readthedocs.yml
├── .vscode
├── launch.json
└── tasks.json
├── CODE_OF_CONDUCT.md
├── Dockerfile
├── Documentation
├── .gitignore
├── api
│ ├── .gitignore
│ └── index.md
├── articles
│ ├── intro.md
│ └── toc.yml
├── docfx.json
├── index.md
└── toc.yml
├── LICENSE
├── Leon.HomeControl.sln.DotSettings
├── Neon.HomeControl.Api
├── Annotations.cs
├── Core
│ ├── Attributes
│ │ ├── Commands
│ │ │ ├── IotCommandAttribute.cs
│ │ │ └── IotCommandParamAttribute.cs
│ │ ├── Components
│ │ │ └── ComponentAttribute.cs
│ │ ├── Database
│ │ │ ├── DatabaseSeedAttribute.cs
│ │ │ └── NoSqlConnectorAttribute.cs
│ │ ├── Dto
│ │ │ └── DtoMapAttribute.cs
│ │ ├── EventDatabase
│ │ │ ├── EventDatabaseEntityAttribute.cs
│ │ │ └── EventDatabaseIndexAttribute.cs
│ │ ├── IoT
│ │ │ └── IgnorePropertyCompareAttribute.cs
│ │ ├── OAuth
│ │ │ └── OAuthProviderAttribute.cs
│ │ ├── Plugins
│ │ │ └── PluginAttribute.cs
│ │ ├── SchedulerJob
│ │ │ └── SchedulerJobTaskAttribute.cs
│ │ ├── ScriptEngine
│ │ │ └── ScriptEngineAttribute.cs
│ │ ├── ScriptService
│ │ │ ├── ScriptFunctionAttribute.cs
│ │ │ └── ScriptObjectAttribute.cs
│ │ ├── Services
│ │ │ ├── DataAccessAttribute.cs
│ │ │ ├── ScopedAttribute.cs
│ │ │ ├── ServiceAttribute.cs
│ │ │ ├── SingletonAttribute.cs
│ │ │ └── TransientAttribute.cs
│ │ └── WebSocket
│ │ │ └── WebSocketHubAttribute.cs
│ ├── Data
│ │ ├── Commands
│ │ │ ├── IotCommand.cs
│ │ │ ├── IotCommandInfo.cs
│ │ │ └── IotCommandParamInfo.cs
│ │ ├── Components
│ │ │ ├── ComponentInfo.cs
│ │ │ └── RunningComponentInfo.cs
│ │ ├── Config
│ │ │ ├── ComponentConfig.cs
│ │ │ ├── DatabaseConfig.cs
│ │ │ ├── EventDatabaseConfig.cs
│ │ │ ├── FileSystemConfig.cs
│ │ │ ├── HomeConfig.cs
│ │ │ ├── IoTConfig.cs
│ │ │ ├── MqttClient
│ │ │ │ ├── MqttClientConfig.cs
│ │ │ │ └── MqttMirrorConfig.cs
│ │ │ ├── MqttConfig.cs
│ │ │ ├── NeonConfig.cs
│ │ │ ├── PluginConfig.cs
│ │ │ ├── ScriptConfig.cs
│ │ │ └── TaskConfig.cs
│ │ ├── Logger
│ │ │ └── LoggerEntry.cs
│ │ ├── Mqtt
│ │ │ └── MqttMessage.cs
│ │ ├── Network
│ │ │ └── NetworkResult.cs
│ │ ├── OAuth
│ │ │ ├── OAuthResult.cs
│ │ │ └── OAuthTokenResult.cs
│ │ ├── Plugins
│ │ │ ├── PluginConfig.cs
│ │ │ └── PluginDependencyConfig.cs
│ │ ├── PropertyChange
│ │ │ └── BasePropertyChangedEntity.cs
│ │ ├── Rules
│ │ │ ├── RuleInfo.cs
│ │ │ └── RuleTypeEnum.cs
│ │ ├── Scheduler
│ │ │ ├── JobInfo.cs
│ │ │ └── JobTypeEnum.cs
│ │ ├── ScriptData
│ │ │ ├── ScriptFunctionData.cs
│ │ │ └── ScriptLiveExecutionResult.cs
│ │ ├── Services
│ │ │ └── ServiceInfo.cs
│ │ └── UserInteraction
│ │ │ ├── UserInteractionData.cs
│ │ │ ├── UserInteractionField.cs
│ │ │ └── UserInteractionFieldTypeEnum.cs
│ ├── Enums
│ │ ├── ComponentStatusEnum.cs
│ │ ├── LifeScopeTypeEnum.cs
│ │ ├── SchedulerServicePollingEnum.cs
│ │ └── ServiceStatusEnum.cs
│ ├── Events
│ │ ├── HostScanEvent.cs
│ │ ├── MqttMessageEvent.cs
│ │ ├── PortScanEvent.cs
│ │ ├── ScriptOutputEvent.cs
│ │ └── System
│ │ │ └── ServiceLoadedEvent.cs
│ ├── Impl
│ │ ├── Components
│ │ │ └── BaseComponentConfig.cs
│ │ ├── Controllers
│ │ │ └── AbstractApiController.cs
│ │ ├── Dao
│ │ │ └── AbstractDataAccess.cs
│ │ ├── Dto
│ │ │ ├── AbstractDtoMapper.cs
│ │ │ ├── BaseCodeDto.cs
│ │ │ └── BaseDto.cs
│ │ ├── Entities
│ │ │ ├── BaseCodeEntity.cs
│ │ │ └── BaseEntity.cs
│ │ └── EventsDatabase
│ │ │ └── BaseEventDatabaseEntity.cs
│ ├── Interfaces
│ │ ├── Components
│ │ │ ├── IComponent.cs
│ │ │ └── IComponentConfig.cs
│ │ ├── Controllers
│ │ │ └── IBaseApiController.cs
│ │ ├── Dao
│ │ │ └── IDataAccess.cs
│ │ ├── Database
│ │ │ ├── IDatabaseSeed.cs
│ │ │ └── INoSqlConnector.cs
│ │ ├── Dto
│ │ │ ├── IBaseCodeDto.cs
│ │ │ └── IBaseDto.cs
│ │ ├── Entities
│ │ │ ├── IBaseCodeEntity.cs
│ │ │ └── IBaseEntity.cs
│ │ ├── IDtoMapper.cs
│ │ ├── IoTEntities
│ │ │ └── IIotEntity.cs
│ │ ├── JobScheduler
│ │ │ └── IJobSchedulerTask.cs
│ │ ├── Managers
│ │ │ ├── IComponentsService.cs
│ │ │ └── IServicesManager.cs
│ │ ├── Messages
│ │ │ └── IBaseMessage.cs
│ │ ├── OAuth
│ │ │ └── IOAuthCallback.cs
│ │ ├── Plugins
│ │ │ └── IPlugin.cs
│ │ ├── PropertyChange
│ │ │ └── IBasePropertyChangedEntity.cs
│ │ ├── ScriptEngine
│ │ │ └── IScriptEngine.cs
│ │ └── Services
│ │ │ ├── ICommandDispatcherService.cs
│ │ │ ├── IDatabaseService.cs
│ │ │ ├── IDiscoveryService.cs
│ │ │ ├── IEventDatabaseService.cs
│ │ │ ├── IFileSystemManager.cs
│ │ │ ├── IIoTService.cs
│ │ │ ├── IMqttService.cs
│ │ │ ├── INotificationService.cs
│ │ │ ├── IPluginsManager.cs
│ │ │ ├── IRoutineService.cs
│ │ │ ├── IRuleEngineService.cs
│ │ │ ├── ISchedulerService.cs
│ │ │ ├── IScriptService.cs
│ │ │ ├── IService.cs
│ │ │ ├── ITaskExecutorService.cs
│ │ │ └── IUserInteractionService.cs
│ ├── Logger
│ │ └── LoggerEx.cs
│ ├── Managers
│ │ ├── ComponentsService.cs
│ │ ├── FileSystemManager.cs
│ │ ├── PluginsManager.cs
│ │ └── ServicesManager.cs
│ ├── Mapper
│ │ └── DefaultMapperProfile.cs
│ ├── Modules
│ │ └── LogRequestModule.cs
│ └── Utils
│ │ ├── AppUtils.cs
│ │ ├── AssemblyUtils.cs
│ │ ├── HashUtils.cs
│ │ ├── HttpClientUtils.cs
│ │ ├── JsonUtils.cs
│ │ ├── MethodsUtils.cs
│ │ ├── NetworkScanner.cs
│ │ ├── NoSqlUtils.cs
│ │ ├── NotificationExtensions.cs
│ │ ├── OAuth2.cs
│ │ ├── PortScanner.cs
│ │ ├── PropertyChangedNotificationInterceptor.cs
│ │ └── TaskPool.cs
├── FodyWeavers.xml
├── FodyWeavers.xsd
├── Neon.HomeControl.Api.csproj
└── Neon.HomeControl.Api.xml
├── Neon.HomeControl.Components
├── AirCo
│ ├── AircoHttpClient.cs
│ ├── AircoManager.cs
│ └── Model
│ │ ├── AirSwingUDType.cs
│ │ ├── AirswingLRType.cs
│ │ ├── EcoModeType.cs
│ │ ├── FanAutoModeType.cs
│ │ ├── FanSpeedType.cs
│ │ ├── OperateType.cs
│ │ ├── OperationModeType.cs
│ │ ├── Request
│ │ ├── ControlDeviceParameters.cs
│ │ ├── ControlDeviceRequest.cs
│ │ └── LoginRequest.cs
│ │ └── Response
│ │ ├── DeviceGroupResponse.cs
│ │ ├── DeviceId.cs
│ │ ├── DeviceParameters.cs
│ │ ├── DeviceStatusParameters.cs
│ │ ├── DeviceStatusResponse.cs
│ │ ├── Group.cs
│ │ ├── LoginResponse.cs
│ │ ├── ModelAvl.cs
│ │ └── ResultResponse.cs
├── Components
│ ├── BroadlinkComponent.cs
│ ├── ChromecastComponent.cs
│ ├── NestThermoComponent.cs
│ ├── OwnTracksComponent.cs
│ ├── PanasonicAirCondComponent.cs
│ ├── PhilipHueComponent.cs
│ ├── PlexHookComponent.cs
│ ├── RadarrComponent.cs
│ ├── SonarrComponent.cs
│ ├── SonoffTasmodaComponent.cs
│ ├── SpotifyWebComponent.cs
│ ├── SsdpComponent.cs
│ ├── SunSetComponent.cs
│ └── WeatherComponent.cs
├── Config
│ ├── BroadlinkConfig.cs
│ ├── ChromecastConfig.cs
│ ├── NestThermoConfig.cs
│ ├── OwnTracksConfig.cs
│ ├── PanasonicAirCondConfig.cs
│ ├── PhilipHueConfig.cs
│ ├── PlexHookConfig.cs
│ ├── RadarrConfig.cs
│ ├── SonarrConfig.cs
│ ├── SonoffTasmodaConfig.cs
│ ├── SpotifyWebConfig.cs
│ ├── SsdpConfig.cs
│ ├── SunSetConfig.cs
│ └── WeatherComponentConfig.cs
├── Controllers
│ └── PlexHookApiController.cs
├── Data
│ ├── OwnTracksData.cs
│ ├── SunsetDataResultWrap.cs
│ └── SunsetDataResults.cs
├── EventsDb
│ ├── ChromecastEd.cs
│ ├── OwnTracksEd.cs
│ ├── PanasonicAirConditionerEd.cs
│ ├── PhilipsHueEd.cs
│ ├── SonoffStatusEd.cs
│ ├── SpotifyCurrentTrackEd.cs
│ ├── SpotifyDeviceEd.cs
│ ├── SunSetEd.cs
│ └── WeatherEd.cs
├── Interfaces
│ ├── IBroadlinkComponent.cs
│ ├── IChromecastComponent.cs
│ ├── INestThermoComponent.cs
│ ├── IOwnTracksComponent.cs
│ ├── IPanasonicAirCondComponent.cs
│ ├── IPhilipHueComponent.cs
│ ├── IPlexHookComponent.cs
│ ├── IRadarrComponent.cs
│ ├── ISonarrComponent.cs
│ ├── ISonoffTasmodaComponent.cs
│ ├── ISpotifyWebComponent.cs
│ ├── ISsdpComponent.cs
│ ├── ISunSetComponent.cs
│ └── IWeatherComponent.cs
├── Mqtt
│ └── SonoffStateMessage.cs
├── Neon.HomeControl.Components.csproj
└── Neon.HomeControl.Components.xml
├── Neon.HomeControl.Dto
├── Dto
│ ├── RoleDto.cs
│ └── UserDto.cs
├── Mappers
│ ├── DtoMapperProfile.cs
│ ├── RoleDtoMapper.cs
│ └── UserDtoMapper.cs
├── Neon.HomeControl.Dto.csproj
└── Neon.HomeControl.Dto.xml
├── Neon.HomeControl.Entities
├── Dao
│ ├── RoleDataAccess.cs
│ ├── UserDataAccess.cs
│ └── UserRoleDataAccess.cs
├── Entities
│ ├── RoleEntity.cs
│ ├── UserEntity.cs
│ └── UserRoleEntity.cs
├── Migrations
│ ├── 20190717115358_InitialMigration.Designer.cs
│ ├── 20190717115358_InitialMigration.cs
│ └── NeonDbContextModelSnapshot.cs
├── Neon.HomeControl.Entities.csproj
├── Neon.HomeControl.Entities.xml
└── Services
│ ├── DatabaseService.cs
│ └── NeonDbContext.cs
├── Neon.HomeControl.Services
├── Connectors
│ ├── LiteDbConnector.cs
│ └── MongoDbConnector.cs
├── Neon.HomeControl.Services.csproj
├── Neon.HomeControl.Services.xml
├── ScriptEngines
│ ├── JsScriptEngine.cs
│ └── LuaScriptEngine.cs
└── Services
│ ├── CommandDispatcherService.cs
│ ├── DiscoveryService.cs
│ ├── EventDatabaseService.cs
│ ├── IoTService.cs
│ ├── MqttService.cs
│ ├── NotificationService.cs
│ ├── RoutineService.cs
│ ├── RuleEngineService.cs
│ ├── SchedulerService.cs
│ ├── ScriptService.cs
│ ├── TaskExecutorService.cs
│ └── UserInteractionService.cs
├── Neon.HomeControl.StandardScriptLibrary
├── Logging
│ └── LoggerScriptObject.cs
├── Neon.HomeControl.StandardLuaLibrary.xml
├── Neon.HomeControl.StandardScriptLibrary.csproj
└── Services
│ ├── AppUtilsScriptObject.cs
│ ├── ComponentsServiceScriptObject.cs
│ ├── EventBridgeScriptObject.cs
│ ├── RoutinesScriptObject.cs
│ └── ServiceManagerScriptObject.cs
├── Neon.HomeControl.Web
├── Auth
│ └── AuthenticationManager.cs
├── Controllers
│ ├── AdminController.cs
│ ├── AuthController.cs
│ ├── EventsController.cs
│ ├── HealthController.cs
│ ├── OAuthController.cs
│ ├── RolesController.cs
│ └── UsersController.cs
├── Jobs
│ └── TestJob.cs
├── LuaScripts
│ └── TestLuaObject.cs
├── Neon.HomeControl.Web.csproj
├── Neon.HomeControl.Web.xml
├── Program.cs
├── Properties
│ └── launchSettings.json
├── Seeds
│ └── UserRolesSeed.cs
├── Startup.cs
├── Websockets
│ ├── EventsHub.cs
│ ├── LoggerHub.cs
│ └── ScriptHub.cs
├── appsettings.Development.json
├── appsettings.json
└── neon.settings-default.json
├── Neon.HomeControl.sln
├── Neon.HomeControl.sln.DotSettings
├── Neon.Plugin.Test
├── Neon.Plugin.Test.csproj
└── Plugin
│ └── TestLuaCommand.cs
├── README.md
├── build.cake
├── build.ps1
├── docs
└── index.md
├── global.json
├── mkdocs.yml
└── tools
└── packages.config
/.dockerignore:
--------------------------------------------------------------------------------
1 | **/.dockerignore
2 | **/.env
3 | **/.git
4 | **/.gitignore
5 | **/.vs
6 | **/.vscode
7 | **/*.*proj.user
8 | **/azds.yaml
9 | **/charts
10 | **/bin
11 | **/obj
12 | **/Dockerfile
13 | **/Dockerfile.develop
14 | **/docker-compose.yml
15 | **/docker-compose.*.yml
16 | **/*.dbmdl
17 | **/*.jfm
18 | **/secrets.dev.yaml
19 | **/values.dev.yaml
20 | **/.toolstarget
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.readthedocs.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | mkdocs:
3 | configuration: mkdocs.yml
4 |
5 |
6 | formats: all
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to find out which attributes exist for C# debugging
3 | // Use hover for the description of the existing attributes
4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": ".NET Core Launch (web)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/Neon.HomeControl.Web/bin/Debug/netcoreapp2.2/Neon.HomeControl.Web.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}/Neon.HomeControl.Web",
16 | "stopAtEntry": false,
17 | // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
18 | "serverReadyAction": {
19 | "action": "openExternally",
20 | "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
21 | },
22 | "env": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | },
25 | "sourceFileMap": {
26 | "/Views": "${workspaceFolder}/Views"
27 | }
28 | },
29 | {
30 | "name": ".NET Core Attach",
31 | "type": "coreclr",
32 | "request": "attach",
33 | "processId": "${command:pickProcess}"
34 | }
35 | ]
36 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/Neon.HomeControl.Web/Neon.HomeControl.Web.csproj"
11 | ],
12 | "problemMatcher": "$tsc"
13 | },
14 | {
15 | "label": "publish",
16 | "command": "dotnet",
17 | "type": "process",
18 | "args": [
19 | "publish",
20 | "${workspaceFolder}/Neon.HomeControl.Web/Neon.HomeControl.Web.csproj"
21 | ],
22 | "problemMatcher": "$tsc"
23 | },
24 | {
25 | "label": "watch",
26 | "command": "dotnet",
27 | "type": "process",
28 | "args": [
29 | "watch",
30 | "run",
31 | "${workspaceFolder}/Neon.HomeControl.Web/Neon.HomeControl.Web.csproj"
32 | ],
33 | "problemMatcher": "$tsc"
34 | }
35 | ]
36 | }
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
2 | ARG IS_DOCKER=1
3 | ENV IS_DOCKER=${IS_DOCKER}
4 | WORKDIR /app
5 | EXPOSE 80
6 | EXPOSE 443
7 | EXPOSE 1883
8 |
9 | FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
10 | WORKDIR /src
11 | #COPY .git/ ./.git/
12 | COPY global.json ./
13 | COPY Neon.HomeControl.sln ./
14 | COPY Neon.HomeControl.Api/*.csproj ./Neon.HomeControl.Api/
15 | COPY Neon.Plugin.Test/*.csproj ./Neon.Plugin.Test/
16 | COPY Neon.HomeControl.Components/*.csproj ./Neon.HomeControl.Components/
17 | COPY Neon.HomeControl.Entities/*.csproj ./Neon.HomeControl.Entities/
18 | COPY Neon.HomeControl.Dto/*.csproj ./Neon.HomeControl.Dto/
19 | COPY Neon.HomeControl.Services/*.csproj ./Neon.HomeControl.Services/
20 | COPY Neon.HomeControl.StandardScriptLibrary/*.csproj ./Neon.HomeControl.StandardScriptLibrary/
21 | COPY Neon.HomeControl.Web/*.csproj ./Neon.HomeControl.Web/
22 |
23 | RUN dotnet restore
24 | COPY . .
25 | WORKDIR /src/Neon.HomeControl.Web
26 | RUN dotnet build -c Release -o /app
27 |
28 | FROM build AS publish
29 | RUN dotnet publish -c Release -o /app
30 |
31 | FROM base AS final
32 | WORKDIR /app
33 | COPY --from=publish /app .
34 | ENV IS_DOCKER=${IS_DOCKER}
35 | HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "curl --fail http://localhost/api/Health/Ping || exit 1" ]
36 | ENTRYPOINT ["dotnet", "Neon.HomeControl.Web.dll"]
--------------------------------------------------------------------------------
/Documentation/.gitignore:
--------------------------------------------------------------------------------
1 | ###############
2 | # folder #
3 | ###############
4 | /**/DROP/
5 | /**/TEMP/
6 | /**/packages/
7 | /**/bin/
8 | /**/obj/
9 | _site
10 |
--------------------------------------------------------------------------------
/Documentation/api/.gitignore:
--------------------------------------------------------------------------------
1 | ###############
2 | # temp file #
3 | ###############
4 | *.yml
5 | .manifest
6 |
--------------------------------------------------------------------------------
/Documentation/api/index.md:
--------------------------------------------------------------------------------
1 | # PLACEHOLDER
2 | TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*!
3 |
--------------------------------------------------------------------------------
/Documentation/articles/intro.md:
--------------------------------------------------------------------------------
1 | # Add your introductions here!
2 |
--------------------------------------------------------------------------------
/Documentation/articles/toc.yml:
--------------------------------------------------------------------------------
1 | - name: Introduction
2 | href: intro.md
3 |
--------------------------------------------------------------------------------
/Documentation/docfx.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": [
3 | {
4 | "src": [
5 | {
6 | "files":
7 | [
8 | "**/**.sln",
9 | "**/**.csproj"
10 | ],
11 | "cwd":".."
12 | }
13 | ],
14 | "dest": "api",
15 | "disableGitFeatures": false,
16 | "disableDefaultFilter": false
17 | }
18 | ],
19 | "build": {
20 | "content": [
21 | {
22 | "files": [
23 | "api/**.yml",
24 | "api/index.md"
25 | ]
26 | },
27 | {
28 | "files": [
29 | "articles/**.md",
30 | "articles/**/toc.yml",
31 | "toc.yml",
32 | "*.md"
33 | ]
34 | }
35 | ],
36 | "resource": [
37 | {
38 | "files": [
39 | "images/**"
40 | ]
41 | }
42 | ],
43 | "overwrite": [
44 | {
45 | "files": [
46 | "apidoc/**.md"
47 | ],
48 | "exclude": [
49 | "obj/**",
50 | "_site/**"
51 | ]
52 | }
53 | ],
54 | "dest": "_site",
55 | "globalMetadataFiles": [],
56 | "fileMetadataFiles": [],
57 | "template": [
58 | "default"
59 | ],
60 | "postProcessors": [],
61 | "markdownEngineName": "markdig",
62 | "noLangKeyword": false,
63 | "keepFileLink": false,
64 | "cleanupCacheHistory": false,
65 | "disableGitFeatures": false
66 | }
67 | }
--------------------------------------------------------------------------------
/Documentation/index.md:
--------------------------------------------------------------------------------
1 | # This is the **HOMEPAGE**.
2 | Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files.
3 | ## Quick Start Notes:
4 | 1. Add images to the *images* folder if the file is referencing an image.
5 |
--------------------------------------------------------------------------------
/Documentation/toc.yml:
--------------------------------------------------------------------------------
1 | - name: Articles
2 | href: articles/
3 | - name: Api Documentation
4 | href: api/
5 | homepage: api/index.md
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Tommaso Giachi
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Leon.HomeControl.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Commands/IotCommandAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Neon.HomeControl.Api.Core.Attributes.Commands
5 | {
6 | ///
7 | /// Command attribute for dispatch to components commands
8 | ///
9 | [AttributeUsage(AttributeTargets.Method, Inherited = false)]
10 | public class IotCommandAttribute : Attribute
11 | {
12 | ///
13 | /// Command name
14 | ///
15 | public string CommandName { get; set; }
16 |
17 |
18 | ///
19 | /// Command description
20 | ///
21 | public string Description { get; set; }
22 |
23 |
24 | ///
25 | /// Entity Type
26 | ///
27 | public Type EntityType { get; set; }
28 |
29 |
30 | ///
31 | /// ctor
32 | ///
33 | ///
34 | ///
35 | ///
36 | ///
37 | public IotCommandAttribute(string commandName, Type entityType, string description)
38 | {
39 | CommandName = commandName;
40 | Description = description;
41 | EntityType = entityType;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Commands/IotCommandParamAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Attributes.Commands
6 | {
7 |
8 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
9 | public class IotCommandParamAttribute :Attribute
10 | {
11 | ///
12 | /// Name of param
13 | ///
14 | public string Name { get; set; }
15 |
16 | ///
17 | /// If is required
18 | ///
19 | public bool IsRequired { get; set; }
20 |
21 |
22 |
23 | ///
24 | /// Ctor
25 | ///
26 | ///
27 | ///
28 | public IotCommandParamAttribute(string name, bool isRequired)
29 | {
30 | Name = name;
31 | IsRequired = isRequired;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Components/ComponentAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.Components
4 | {
5 | ///
6 | /// Attribute for the implementation of the components
7 | ///
8 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
9 | public class ComponentAttribute : Attribute
10 | {
11 | ///
12 | /// Ctor
13 | ///
14 | /// Name of component
15 | /// Version of component
16 | /// Category (LIGHTS, MUSIC, HOME_AUTOMATION)
17 | /// Describes what the component does
18 | /// Type of Config
19 | public ComponentAttribute(string id, string name, string version, string category, string description,
20 | Type componentConfigType)
21 | {
22 | Id = id;
23 | Name = name;
24 | Version = version;
25 | Category = category;
26 | Description = description;
27 | ComponentConfigType = componentConfigType;
28 | }
29 |
30 | ///
31 | /// Id of component (philip_hue, ecc..)
32 | ///
33 | public string Id { get; set; }
34 |
35 | ///
36 | /// Name of components
37 | ///
38 | public string Name { get; set; }
39 |
40 | ///
41 | /// Version of component
42 | ///
43 | public string Version { get; set; }
44 |
45 | ///
46 | /// Category of component
47 | ///
48 | public string Category { get; set; }
49 |
50 | ///
51 | /// Description of component
52 | ///
53 | public string Description { get; set; }
54 |
55 | ///
56 | /// Type of config
57 | ///
58 | public Type ComponentConfigType { get; set; }
59 | }
60 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Database/DatabaseSeedAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.Database
4 | {
5 | ///
6 | /// Seeds are classes for initializing default data in the database
7 | ///
8 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
9 | public class DatabaseSeedAttribute : Attribute
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Database/NoSqlConnectorAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Attributes.Database
6 | {
7 | ///
8 | /// Attribute for NoSQL connector
9 | ///
10 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
11 | public class NoSqlConnectorAttribute : Attribute
12 | {
13 | ///
14 | /// Name of connector
15 | ///
16 | public string Name { get;set; }
17 |
18 | ///
19 | /// ctor
20 | ///
21 | ///
22 | public NoSqlConnectorAttribute(string connectorName)
23 | {
24 | Name = connectorName;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Dto/DtoMapAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.Dto
4 | {
5 | ///
6 | /// Attribute for mapping entities and DTOs
7 | ///
8 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
9 | public class DtoMapAttribute : Attribute
10 | {
11 | ///
12 | /// DB Entity
13 | ///
14 | ///
15 | public DtoMapAttribute(Type entityType)
16 | {
17 | EntityType = entityType;
18 | }
19 |
20 | ///
21 | /// DB Entity
22 | ///
23 | public Type EntityType { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/EventDatabase/EventDatabaseEntityAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.EventDatabase
4 | {
5 | ///
6 | /// Attribute for mapping event entities. It is necessary to specify the name of the collection to be saved on the
7 | /// database
8 | ///
9 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
10 | public class EventDatabaseEntityAttribute : Attribute
11 | {
12 | ///
13 | /// Initialize new attribute with name of collection
14 | ///
15 | /// Example: weather
16 | public EventDatabaseEntityAttribute(string collectionName)
17 | {
18 | CollectionName = collectionName;
19 | }
20 |
21 | ///
22 | /// Name of collection in database
23 | ///
24 | public string CollectionName { get; set; }
25 | }
26 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/EventDatabase/EventDatabaseIndexAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.EventDatabase
4 | {
5 | ///
6 | /// Attribute for creating indexes on the event database
7 | ///
8 | [AttributeUsage(AttributeTargets.Field)]
9 | public class EventDatabaseIndexAttribute : Attribute
10 | {
11 | ///
12 | /// Create new attribute
13 | ///
14 | ///
15 | public EventDatabaseIndexAttribute(bool unique)
16 | {
17 | Unique = unique;
18 | }
19 |
20 | ///
21 | /// Is True if the Index if unique
22 | ///
23 | public bool Unique { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/IoT/IgnorePropertyCompareAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.IoT
4 | {
5 | ///
6 | /// Attribute for ignore
7 | ///
8 | [AttributeUsage(AttributeTargets.Property)]
9 | public class IgnorePropertyCompareAttribute : Attribute
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/OAuth/OAuthProviderAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.OAuth
4 | {
5 | ///
6 | /// Attribute to create a callback during the oauth process
7 | ///
8 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
9 | public class OAuthProviderAttribute : Attribute
10 | {
11 | ///
12 | /// ctor with name of OAuth provider
13 | ///
14 | /// Ex: Spotify, Facebook, ecc...
15 | public OAuthProviderAttribute(string name)
16 | {
17 | Name = name;
18 | }
19 |
20 | ///
21 | /// Name of Provider
22 | ///
23 | public string Name { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Plugins/PluginAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.Plugins
4 | {
5 | ///
6 | /// Attribute for creating plugins
7 | ///
8 | [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
9 | public class PluginAttribute : Attribute
10 | {
11 | ///
12 | /// Attribute for creating plugins
13 | ///
14 | /// Ex: My Plugin
15 | /// Ex: MISC
16 | /// Ex: v1.0
17 | /// Ex: tgiachi
18 | public PluginAttribute(string name, string category, string version, string author)
19 | {
20 | Name = name;
21 | Category = category;
22 | Version = version;
23 | Author = author;
24 | }
25 |
26 | ///
27 | /// Name of plugin
28 | ///
29 | public string Name { get; set; }
30 |
31 | ///
32 | /// Category of plugin
33 | ///
34 | public string Category { get; set; }
35 |
36 | ///
37 | /// Version of plugin
38 | ///
39 | public string Version { get; set; }
40 |
41 | ///
42 | /// Author of plugin
43 | ///
44 | public string Author { get; set; }
45 |
46 | ///
47 | /// If Plugin have dependencies of plugins
48 | ///
49 | public string[] Dependencies { get; set; }
50 | }
51 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/SchedulerJob/SchedulerJobTaskAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.SchedulerJob
4 | {
5 | ///
6 | /// Attribute for creating scheduled actions
7 | ///
8 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
9 | public class SchedulerJobTaskAttribute : Attribute
10 | {
11 | ///
12 | /// Attribute for creating scheduled actions
13 | ///
14 | /// If True, of starts execute job
15 | /// Number of seconds
16 | public SchedulerJobTaskAttribute(bool startNow, int seconds)
17 | {
18 | StartNow = startNow;
19 | Seconds = seconds;
20 | }
21 |
22 | ///
23 | /// If True, of starts execute job
24 | ///
25 | public bool StartNow { get; set; }
26 |
27 | ///
28 | /// Number of secondse
29 | ///
30 | public int Seconds { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/ScriptEngine/ScriptEngineAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Attributes.ScriptEngine
6 | {
7 | ///
8 | /// Script Engine Attribute
9 | ///
10 | [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
11 | public class ScriptEngineAttribute : Attribute
12 | {
13 |
14 |
15 | ///
16 | /// Name of Script Engine
17 | ///
18 | public string Name { get;set; }
19 |
20 | ///
21 | /// Version
22 | ///
23 | public string Version { get; set; }
24 |
25 |
26 | ///
27 | /// Extension of file to read
28 | ///
29 | public string FileExtension { get; set; }
30 |
31 | ///
32 | /// Ctor
33 | ///
34 | public ScriptEngineAttribute(string name, string extension, string version)
35 | {
36 | Name = name;
37 | FileExtension = extension;
38 | Version = version;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/ScriptService/ScriptFunctionAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.ScriptService
4 | {
5 | [AttributeUsage(AttributeTargets.Method, Inherited = false)]
6 | public class ScriptFunctionAttribute : Attribute
7 | {
8 | public ScriptFunctionAttribute(string category, string functionName, string help)
9 | {
10 | FunctionCategory = category;
11 | FunctionName = functionName;
12 | Help = help;
13 | }
14 |
15 | public string FunctionName { get; set; }
16 |
17 | public string FunctionCategory { get; set; }
18 | public string Help { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/ScriptService/ScriptObjectAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.ScriptService
4 | {
5 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
6 | public class ScriptObjectAttribute : Attribute
7 | {
8 | ///
9 | /// Object name in script engine (ex: logger.log_info())
10 | ///
11 | public string ObjName { get; set; }
12 |
13 | public ScriptObjectAttribute(string objName)
14 | {
15 | ObjName = objName;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Services/DataAccessAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.Services
4 | {
5 | [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
6 | public class DataAccessAttribute : Attribute
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Services/ScopedAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.Services
4 | {
5 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
6 | public class ScopedAttribute : Attribute
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Services/ServiceAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.Services
4 | {
5 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
6 | public class ServiceAttribute : Attribute
7 | {
8 | public ServiceAttribute(Type serviceInterface)
9 | {
10 | ServiceInterface = serviceInterface;
11 | }
12 |
13 | public string Name { get; set; }
14 |
15 | public Type ServiceInterface { get; set; }
16 |
17 | public int Order { get; set; } = 10;
18 | public bool LoadAtStartup { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Services/SingletonAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.Services
4 | {
5 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
6 | public class SingletonAttribute : Attribute
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/Services/TransientAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Attributes.Services
4 | {
5 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
6 | public class TransientAttribute : Attribute
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Attributes/WebSocket/WebSocketHubAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Attributes.WebSocket
6 | {
7 | [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
8 | public class WebSocketHubAttribute : Attribute
9 | {
10 |
11 | public string Path { get; set; }
12 |
13 | public WebSocketHubAttribute(string path)
14 | {
15 | Path = path;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Commands/IotCommand.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 | using Neon.HomeControl.Api.Core.Interfaces.IoTEntities;
3 |
4 | namespace Neon.HomeControl.Api.Core.Data.Commands
5 | {
6 | ///
7 | /// Command to send to devices
8 | ///
9 | public class IotCommand : INotification where T : IIotEntity
10 | {
11 | ///
12 | /// Entity
13 | ///
14 | public T Entity { get; set; }
15 | ///
16 | /// Command name
17 | ///
18 | public string CommandName { get; set; }
19 | ///
20 | /// Command Parameters
21 | ///
22 | public object[] Parameters { get; set; }
23 |
24 | ///
25 | /// Helper for build command
26 | ///
27 | ///
28 | ///
29 | ///
30 | ///
31 | public static IotCommand BuildCommand(T entity, string commandName, params object[] args) where T : IIotEntity
32 | {
33 | return new IotCommand()
34 | {
35 | Entity = entity,
36 | CommandName = commandName,
37 | Parameters = args
38 | };
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Commands/IotCommandInfo.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.Components;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Reflection;
5 | using Newtonsoft.Json;
6 |
7 | namespace Neon.HomeControl.Api.Core.Data.Commands
8 | {
9 | public class IotCommandInfo
10 | {
11 | public Type EntityType { get; set; }
12 | public string CommandName { get; set; }
13 |
14 | [JsonIgnore]
15 | public IComponent Component { get; set; }
16 | [JsonIgnore]
17 | public MethodInfo Method { get; set; }
18 |
19 | public string MethodName { get; set; }
20 | public List Params { get; set; }
21 |
22 | public IotCommandInfo()
23 | {
24 | Params = new List();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Commands/IotCommandParamInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Data.Commands
6 | {
7 | public class IotCommandParamInfo
8 | {
9 | public string ParamName { get; set; }
10 |
11 | public bool IsRequired { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Components/ComponentInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Components
2 | {
3 | public class ComponentInfo
4 | {
5 | public string Id { get; set; }
6 | public string Name { get; set; }
7 |
8 | public string Version { get; set; }
9 |
10 | public string Description { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Components/RunningComponentInfo.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Enums;
2 | using Neon.HomeControl.Api.Core.Interfaces.Components;
3 | using Newtonsoft.Json;
4 | using System;
5 |
6 | namespace Neon.HomeControl.Api.Core.Data.Components
7 | {
8 | public class RunningComponentInfo : ComponentInfo
9 | {
10 | [JsonIgnore] public IComponent Component { get; set; }
11 |
12 | public ComponentStatusEnum Status { get; set; }
13 | public Exception Error { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/ComponentConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Config
2 | {
3 | ///
4 | /// Components config
5 | ///
6 | public class ComponentConfig
7 | {
8 | ///
9 | /// Where Neon Load/Save component's config
10 | ///
11 | public string ConfigDirectory { get; set; }
12 |
13 |
14 | ///
15 | /// Default component config if Components
16 | ///
17 | public ComponentConfig()
18 | {
19 | ConfigDirectory = "Components";
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/DatabaseConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Config
2 | {
3 | ///
4 | /// Internal Database config
5 | ///
6 | public class DatabaseConfig
7 | {
8 | ///
9 | /// SqLite file
10 | ///
11 | public string ConnectionString { get; set; }
12 |
13 |
14 | ///
15 | /// Default Connection string is Neon.HomeControl.sqlite
16 | ///
17 | public DatabaseConfig()
18 | {
19 | ConnectionString = "Neon.HomeControl.sqlite";
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/EventDatabaseConfig.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Neon.HomeControl.Api.Core.Data.Config
4 | {
5 | public class EventDatabaseConfig
6 | {
7 | public string ConnectorName { get; set; }
8 |
9 | public string ConnectionString { get; set; }
10 |
11 |
12 | public EventDatabaseConfig()
13 | {
14 | ConnectorName = "litedb";
15 | ConnectionString = "Database" + Path.DirectorySeparatorChar + "Neon.HomeControl.Events.db";
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/FileSystemConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Config
2 | {
3 | public class FileSystemConfig
4 | {
5 | public string RootDirectory { get; set; }
6 |
7 | public FileSystemConfig()
8 | {
9 | RootDirectory = "Neon\\";
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/HomeConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Config
2 | {
3 | public class HomeConfig
4 | {
5 | public string Name { get; set; }
6 | public double Latitude { get; set; }
7 | public double Longitude { get; set; }
8 | public string Elevation { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/IoTConfig.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Neon.HomeControl.Api.Core.Data.Config
4 | {
5 | public class IoTConfig
6 | {
7 | public string ConnectorName { get; set; }
8 |
9 | public string ConnectionString { get; set; }
10 |
11 | public IoTConfig()
12 | {
13 | ConnectorName = "litedb";
14 | ConnectionString = "Database"+ Path.DirectorySeparatorChar + "Neon.HomeControl.IoT.db";
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/MqttClient/MqttClientConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Data.Config.MqttClient
6 | {
7 | public class MqttClientConfig
8 | {
9 | public string HostName { get; set; }
10 |
11 | public int Port { get; set; }
12 |
13 | public bool IsAuth { get; set; }
14 |
15 | public string Username { get; set; }
16 |
17 | public string Password { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/MqttClient/MqttMirrorConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Data.Config.MqttClient
6 | {
7 | public class MqttMirrorConfig
8 | {
9 | public MqttClientConfig ClientConfig { get; set; }
10 |
11 | public bool SendToMirror { get; set; }
12 |
13 | public bool ReceiveFromMirror { get; set; }
14 |
15 | public bool IsEnabled { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/MqttConfig.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Data.Config.MqttClient;
2 |
3 | namespace Neon.HomeControl.Api.Core.Data.Config
4 | {
5 | public class MqttConfig
6 | {
7 | ///
8 | /// If true start local Mqtt Server
9 | ///
10 | public bool RunEmbedded { get; set; }
11 |
12 | public string Host { get; set; }
13 |
14 | public string ClientId { get; set; }
15 |
16 |
17 | public MqttMirrorConfig MirrorConfig { get; set; }
18 |
19 |
20 | public MqttConfig()
21 | {
22 | RunEmbedded = true;
23 | MirrorConfig = new MqttMirrorConfig()
24 | {
25 | ClientConfig = new MqttClientConfig(),
26 | ReceiveFromMirror = false,
27 | SendToMirror = false,
28 | IsEnabled = false
29 | };
30 | ClientId = "Neon-server";
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/NeonConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Config
2 | {
3 |
4 | ///
5 | /// Neon System config
6 | ///
7 | public class NeonConfig
8 | {
9 | ///
10 | /// Information about home (GPS coordinates)
11 | ///
12 | public HomeConfig Home { get; set; }
13 | ///
14 | /// Plugins System Configuration
15 | ///
16 | public PluginConfig Plugins { get; set; }
17 | ///
18 | /// Jwt Secret key for generate JWT Token
19 | ///
20 | public string JwtToken { get; set; }
21 | ///
22 | /// MQTT Server information
23 | ///
24 | public MqttConfig Mqtt { get; set; }
25 | ///
26 | /// Expose application metrics
27 | ///
28 | public bool EnableMetrics { get; set; }
29 |
30 | ///
31 | /// Expose API information with swagger
32 | ///
33 | public bool EnableSwagger { get; set; }
34 |
35 | ///
36 | /// If true, load all components
37 | ///
38 | public bool AutoLoadComponents { get; set; }
39 |
40 | public DatabaseConfig Database { get; set; }
41 | public ScriptConfig Scripts { get; set; }
42 | public TaskConfig Tasks { get; set; }
43 | public FileSystemConfig FileSystem { get; set; }
44 | public ComponentConfig Components { get; set; }
45 | public EventDatabaseConfig EventsDatabase { get; set; }
46 | public IoTConfig IoT { get; set; }
47 |
48 | ///
49 | /// Database directory
50 | ///
51 | public string DatabaseDirectory { get; set; }
52 |
53 |
54 | public NeonConfig()
55 | {
56 | Database = new DatabaseConfig();
57 | Scripts = new ScriptConfig();
58 | Mqtt = new MqttConfig();
59 | Plugins = new PluginConfig();
60 | Tasks = new TaskConfig();
61 | FileSystem = new FileSystemConfig();
62 | Components = new ComponentConfig();
63 | EventsDatabase = new EventDatabaseConfig();
64 | IoT = new IoTConfig();
65 | JwtToken = "password";
66 | EnableSwagger = true;
67 | DatabaseDirectory = "Database";
68 | AutoLoadComponents = true;
69 | Home = new HomeConfig();
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/PluginConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Config
2 | {
3 | public class PluginConfig
4 | {
5 | public string Directory { get; set; }
6 |
7 | public PluginConfig()
8 | {
9 | Directory = "Plugins";
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/ScriptConfig.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.Services;
2 |
3 | namespace Neon.HomeControl.Api.Core.Data.Config
4 | {
5 |
6 | ///
7 | /// Config for Script Service
8 | ///
9 | public class ScriptConfig
10 | {
11 |
12 | public string EngineName { get; set; }
13 |
14 | ///
15 | /// Directory where script is located
16 | ///
17 | public string Directory { get; set; }
18 |
19 | public ScriptConfig()
20 | {
21 | EngineName = "lua";
22 | Directory = "Scripts";
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Config/TaskConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Config
2 | {
3 | public class TaskConfig
4 | {
5 | public int MaxNumThreads { get; set; }
6 |
7 |
8 | public TaskConfig()
9 | {
10 | MaxNumThreads = 10;
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Logger/LoggerEntry.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Data.Logger
4 | {
5 | public class LoggerEntry
6 | {
7 | public DateTime EventDateTime { get; set; }
8 | public string Source { get; set; }
9 |
10 | public string Severity { get; set; }
11 | public string Message { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Mqtt/MqttMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Mqtt
2 | {
3 | public class MqttMessage
4 | {
5 | public string Topic { get; set; }
6 |
7 | public string Message { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Network/NetworkResult.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Network
2 | {
3 | public class NetworkResult
4 | {
5 | public string IpAddress { get; set; }
6 |
7 | public string DnsName { get; set; }
8 |
9 | public bool Online { get; set; }
10 |
11 | public long RoundTripTime { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/OAuth/OAuthResult.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.OAuth
2 | {
3 | public class OAuthResult
4 | {
5 | public string Code { get; set; }
6 |
7 | public string State { get; set; }
8 |
9 | public string Status { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/OAuth/OAuthTokenResult.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Neon.HomeControl.Api.Core.Data.OAuth
4 | {
5 | public class OAuthTokenResult
6 | {
7 | [JsonProperty("access_token")] public string AccessToken { get; set; }
8 |
9 | [JsonProperty("token_Type")] public string TokenType { get; set; }
10 |
11 | [JsonProperty("expires_in")] public int ExpiresIn { get; set; }
12 |
13 | [JsonProperty("refresh_token")] public string RefreshToken { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Plugins/PluginConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Data.Plugins
6 | {
7 | public class PluginConfig
8 | {
9 | public string Name { get; set; }
10 |
11 | public string Version { get; set; }
12 |
13 | public string Author { get; set; }
14 | public string Description { get; set; }
15 |
16 | public List Dependencies { get; set; }
17 |
18 | public PluginConfig()
19 | {
20 | Dependencies = new List();
21 | }
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Plugins/PluginDependencyConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Data.Plugins
6 | {
7 | public class PluginDependencyConfig
8 | {
9 | public string PackageName { get; set; }
10 |
11 | public string PackageVersion { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/PropertyChange/BasePropertyChangedEntity.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.PropertyChange;
2 | using System.ComponentModel;
3 |
4 | namespace Neon.HomeControl.Api.Core.Data.PropertyChange
5 | {
6 | ///
7 | /// Implementation of Property Change Entity
8 | ///
9 | public class BasePropertyChangedEntity : IBasePropertyChangedEntity
10 | {
11 | ///
12 | /// Event for track property Changed
13 | ///
14 | public event PropertyChangedEventHandler PropertyChanged;
15 | }
16 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Rules/RuleInfo.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.IoTEntities;
2 | using System;
3 |
4 | namespace Neon.HomeControl.Api.Core.Data.Rules
5 | {
6 | public class RuleInfo
7 | {
8 | public string RuleName { get; set; }
9 |
10 | public object RuleCondition { get; set; }
11 |
12 | public Type EntityType { get; set; }
13 | public Action Action { get; set; }
14 |
15 | public RuleTypeEnum RuleType { get; set; }
16 |
17 | public bool IsEnabled { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Rules/RuleTypeEnum.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Rules
2 | {
3 | public enum RuleTypeEnum
4 | {
5 | CSharp,
6 | Lua,
7 | Lambda
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Scheduler/JobInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Data.Scheduler
4 | {
5 | public class JobInfo
6 | {
7 | public Guid JobId { get; set; }
8 | public JobTypeEnum JobType { get; set; }
9 | public string JobName { get; set; }
10 | public int Seconds { get; set; }
11 | public bool StartNow { get; set; }
12 |
13 | public DateTime LastExecution { get; set; }
14 |
15 | public DateTime NextExecution { get; set; }
16 | }
17 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Scheduler/JobTypeEnum.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.Scheduler
2 | {
3 | public enum JobTypeEnum
4 | {
5 | Job,
6 | Polling
7 | }
8 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/ScriptData/ScriptFunctionData.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.ScriptData
2 | {
3 | ///
4 | /// Class for describe C# to script engine function
5 | ///
6 | public class ScriptFunctionData
7 | {
8 | ///
9 | /// Name of function
10 | ///
11 | public string Name { get; set; }
12 | ///
13 | /// Parameters
14 | ///
15 | public string[] Args { get; set; }
16 | ///
17 | /// Category of function (Ex: Logger)
18 | ///
19 | public string Category { get; set; }
20 | ///
21 | /// Help text for describe function
22 | ///
23 | public string Help { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/ScriptData/ScriptLiveExecutionResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Neon.HomeControl.Api.Core.Data.ScriptData
6 | {
7 | public class ScriptLiveExecutionResult
8 | {
9 | public bool Success { get; set; }
10 |
11 | public string Output { get; set; }
12 |
13 | public string Source { get;set; }
14 |
15 | public Exception Exception { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/Services/ServiceInfo.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Enums;
2 | using Neon.HomeControl.Api.Core.Interfaces.Services;
3 | using System;
4 |
5 | namespace Neon.HomeControl.Api.Core.Data.Services
6 | {
7 | public class ServiceInfo
8 | {
9 | public IService Service { get; set; }
10 | public Guid ServiceId { get; set; }
11 |
12 | public string Name { get; set; }
13 |
14 | public ServiceStatusEnum Status { get; set; }
15 |
16 | public Exception Exception { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/UserInteraction/UserInteractionData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Neon.HomeControl.Api.Core.Data.UserInteraction
4 | {
5 | public class UserInteractionData
6 | {
7 | public UserInteractionData()
8 | {
9 | Fields = new List();
10 | }
11 |
12 | public string Name { get; set; }
13 |
14 | public List Fields { get; set; }
15 |
16 | public void AddField(UserInteractionField field)
17 | {
18 | Fields.Add(field);
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/UserInteraction/UserInteractionField.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.UserInteraction
2 | {
3 | public class UserInteractionField
4 | {
5 | public string FieldName { get; set; }
6 |
7 | public UserInteractionFieldTypeEnum FieldType { get; set; }
8 |
9 | public object FieldValue { get; set; }
10 |
11 | public bool IsRequired { get; set; }
12 |
13 | public string Description { get; set; }
14 |
15 | public UserInteractionField Build()
16 | {
17 | return this;
18 | }
19 |
20 | public UserInteractionField SetFieldName(string value)
21 | {
22 | FieldName = value;
23 | return this;
24 | }
25 |
26 | public UserInteractionField SetFieldValue(object value)
27 | {
28 | FieldValue = value;
29 | return this;
30 | }
31 |
32 | public UserInteractionField SetFieldType(UserInteractionFieldTypeEnum value)
33 | {
34 | FieldType = value;
35 | return this;
36 | }
37 |
38 | public UserInteractionField SetIsRequired(bool value)
39 | {
40 | IsRequired = value;
41 |
42 | return this;
43 | }
44 |
45 | public UserInteractionField SetDescription(string value)
46 | {
47 | Description = value;
48 |
49 | return this;
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Data/UserInteraction/UserInteractionFieldTypeEnum.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Data.UserInteraction
2 | {
3 | public enum UserInteractionFieldTypeEnum
4 | {
5 | STRING,
6 | INTEGER,
7 | DOUBLE,
8 | BUTTON,
9 | LINK
10 | }
11 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Enums/ComponentStatusEnum.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Enums
4 | {
5 | ///
6 | /// Component status enum
7 | ///
8 | [Flags]
9 | public enum ComponentStatusEnum
10 | {
11 | ///
12 | /// Component is Stopped
13 | ///
14 | STOPPED,
15 |
16 | ///
17 | /// Component is Started
18 | ///
19 | STARTED,
20 |
21 | ///
22 | /// Component have configuration Error
23 | ///
24 | CONFIGURATION_ERROR,
25 |
26 | ///
27 | /// Component have generic error
28 | ///
29 | ERROR
30 | }
31 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Enums/LifeScopeTypeEnum.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Enums
2 | {
3 | public enum LifeScopeTypeEnum
4 | {
5 | SINGLETON,
6 | TRANSIENT,
7 | SCOPED
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Enums/SchedulerServicePollingEnum.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Enums
2 | {
3 | ///
4 | /// Enum for choose polling timer
5 | ///
6 | public enum SchedulerServicePollingEnum
7 | {
8 | SHORT_POLLING = 10,
9 | NORMAL_POLLING = 60,
10 | LONG_POLLING = 300,
11 | VERY_LONG_POLLING = 3600
12 | }
13 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Enums/ServiceStatusEnum.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Enums
2 | {
3 | public enum ServiceStatusEnum
4 | {
5 | STARTING,
6 | STARTED,
7 | STOPPED,
8 | ERROR
9 | }
10 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Events/HostScanEvent.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace Neon.HomeControl.Api.Core.Events
4 | {
5 | public class HostScanEvent : INotification
6 | {
7 | public string Host { get; set; }
8 | public string DnsName { get; set; }
9 |
10 | public bool IsOnline { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Events/MqttMessageEvent.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace Neon.HomeControl.Api.Core.Events
4 | {
5 | public class MqttMessageEvent : INotification
6 | {
7 | public string Topic { get; set; }
8 |
9 | public string Message { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Events/PortScanEvent.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace Neon.HomeControl.Api.Core.Events
4 | {
5 | public class PortScanEvent : INotification
6 | {
7 | public string Host { get; set; }
8 |
9 | public int Port { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Events/ScriptOutputEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using MediatR;
5 |
6 | namespace Neon.HomeControl.Api.Core.Events
7 | {
8 | public class ScriptOutputEvent : INotification
9 | {
10 | public DateTime EventDate { get; set; }
11 | public string Category { get; set; }
12 |
13 | public string Level { get; set; }
14 |
15 | public string Message { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Events/System/ServiceLoadedEvent.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace Neon.HomeControl.Api.Core.Events.System
4 | {
5 | ///
6 | /// System event triggered when services manager loaded all service
7 | ///
8 | public class ServiceLoadedEvent : INotification
9 | {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Impl/Components/BaseComponentConfig.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.Components;
2 |
3 | namespace Neon.HomeControl.Api.Core.Impl.Components
4 | {
5 | public class BaseComponentConfig : IComponentConfig
6 | {
7 | public BaseComponentConfig()
8 | {
9 | Enabled = true;
10 | }
11 |
12 | public bool Enabled { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Impl/Controllers/AbstractApiController.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 | using Microsoft.Extensions.Logging;
3 | using Neon.HomeControl.Api.Core.Interfaces;
4 | using Neon.HomeControl.Api.Core.Interfaces.Controllers;
5 | using Neon.HomeControl.Api.Core.Interfaces.Dao;
6 | using Neon.HomeControl.Api.Core.Interfaces.Dto;
7 | using Neon.HomeControl.Api.Core.Interfaces.Entities;
8 | using System.Collections.Generic;
9 |
10 | namespace Neon.HomeControl.Api.Core.Impl.Controllers
11 | {
12 | public class AbstractApiController : IBaseApiController>
13 | where TEntity : IBaseEntity
14 | where TDto : IBaseDto
15 |
16 | {
17 | private readonly IDataAccess _dataAccess;
18 | private readonly ILogger _logger;
19 | private readonly IDtoMapper _mapper;
20 |
21 | public AbstractApiController(ILogger>> logger,
22 | IDataAccess dataAccess, IDtoMapper mapper)
23 | {
24 | _logger = logger;
25 | _dataAccess = dataAccess;
26 | _mapper = mapper;
27 | }
28 |
29 |
30 | [HttpGet]
31 | public ActionResult> List()
32 | {
33 | return new ActionResult>(_mapper.ToDto(_dataAccess.List()));
34 | }
35 |
36 | [HttpGet]
37 | public ActionResult Count()
38 | {
39 | return new ActionResult(_dataAccess.Count());
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Impl/Dao/AbstractDataAccess.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.Extensions.Logging;
3 | using Neon.HomeControl.Api.Core.Interfaces.Dao;
4 | using Neon.HomeControl.Api.Core.Interfaces.Entities;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 |
9 | namespace Neon.HomeControl.Api.Core.Impl.Dao
10 | {
11 | public class AbstractDataAccess : IDataAccess where TEntity : class, IBaseEntity
12 | {
13 | private readonly DbContext _dbContext;
14 | private readonly ILogger _logger;
15 |
16 | public AbstractDataAccess(DbContext dbContext, ILogger> logger)
17 | {
18 | _logger = logger;
19 | _dbContext = dbContext;
20 | }
21 |
22 |
23 | public List List()
24 | {
25 | return _dbContext.Set().ToList();
26 | }
27 |
28 | public long Count()
29 | {
30 | return _dbContext.Set().Count();
31 | }
32 |
33 | public TEntity Insert(TEntity entity)
34 | {
35 | if (entity is IBaseCodeEntity codeEntity) codeEntity.Code = Guid.NewGuid();
36 |
37 | entity.CreatedDateTime = DateTime.Now;
38 |
39 | _dbContext.Set().Add(entity);
40 | _dbContext.SaveChanges();
41 | return entity;
42 | }
43 |
44 | public TEntity Update(TEntity entity)
45 | {
46 | entity.UpdateDateTime = DateTime.Now;
47 | _dbContext.Entry(entity).State = EntityState.Modified;
48 | _dbContext.SaveChanges();
49 | return entity;
50 | }
51 |
52 | public bool Delete(TEntity entity)
53 | {
54 | _dbContext.Entry(entity).State = EntityState.Deleted;
55 | _dbContext.SaveChanges();
56 |
57 | return true;
58 | }
59 |
60 | public IQueryable Query()
61 | {
62 | return _dbContext.Set().AsQueryable();
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Impl/Dto/AbstractDtoMapper.cs:
--------------------------------------------------------------------------------
1 | using AutoMapper;
2 | using Neon.HomeControl.Api.Core.Interfaces;
3 | using Neon.HomeControl.Api.Core.Interfaces.Dto;
4 | using Neon.HomeControl.Api.Core.Interfaces.Entities;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 |
8 | namespace Neon.HomeControl.Api.Core.Impl.Dto
9 | {
10 | public class AbstractDtoMapper : IDtoMapper
11 | where TEntity : IBaseEntity where TDto : IBaseDto
12 | {
13 | private readonly IMapper _mapper;
14 |
15 | public AbstractDtoMapper(IMapper mapper)
16 | {
17 | _mapper = mapper;
18 | }
19 |
20 | public List ToDto(List entities)
21 | {
22 | return entities.Select(ToDto).ToList();
23 | }
24 |
25 | public TDto ToDto(TEntity entity)
26 | {
27 | return _mapper.Map(entity);
28 | }
29 |
30 | public List ToEntity(List dto)
31 | {
32 | return dto.Select(ToEntity).ToList();
33 | }
34 |
35 | public TEntity ToEntity(TDto dto)
36 | {
37 | return _mapper.Map(dto);
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Impl/Dto/BaseCodeDto.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.Dto;
2 | using System;
3 |
4 | namespace Neon.HomeControl.Api.Core.Impl.Dto
5 | {
6 | public class BaseCodeDto : BaseDto, IBaseCodeDto
7 | {
8 | public Guid Code { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Impl/Dto/BaseDto.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.Dto;
2 | using System;
3 |
4 | namespace Neon.HomeControl.Api.Core.Impl.Dto
5 | {
6 | public class BaseDto : IBaseDto
7 | {
8 | public long Id { get; set; }
9 | public DateTime CreatedDateTime { get; set; }
10 | public DateTime UpdateDateTime { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Impl/Entities/BaseCodeEntity.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.Entities;
2 | using System;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.ComponentModel.DataAnnotations.Schema;
5 |
6 | namespace Neon.HomeControl.Api.Core.Impl.Entities
7 | {
8 | public class BaseCodeEntity : BaseEntity, IBaseCodeEntity
9 | {
10 | [Key] [Column("code")] public Guid Code { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Impl/Entities/BaseEntity.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.Entities;
2 | using System;
3 | using System.ComponentModel.DataAnnotations;
4 | using System.ComponentModel.DataAnnotations.Schema;
5 |
6 | namespace Neon.HomeControl.Api.Core.Impl.Entities
7 | {
8 | public class BaseEntity : IBaseEntity
9 | {
10 |
11 | [Key]
12 | [Column("id")]
13 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
14 | public long Id { get; set; }
15 |
16 | [Column("created_date")] public DateTime CreatedDateTime { get; set; }
17 |
18 | [Column("updated_date")] public DateTime UpdateDateTime { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Impl/EventsDatabase/BaseEventDatabaseEntity.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Attributes.IoT;
2 | using Neon.HomeControl.Api.Core.Interfaces.IoTEntities;
3 | using System;
4 | namespace Neon.HomeControl.Api.Core.Impl.EventsDatabase
5 | {
6 | public class BaseEventDatabaseEntity : IIotEntity
7 | {
8 | public BaseEventDatabaseEntity()
9 | {
10 | EventDateTime = DateTime.Now;
11 | }
12 |
13 | [IgnorePropertyCompare]
14 | public Guid Id { get; set; }
15 |
16 | public string EntityName { get; set; }
17 |
18 | public string EntityType { get; set; }
19 |
20 | [IgnorePropertyCompare]
21 | public DateTime EventDateTime { get; set; }
22 | }
23 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Components/IComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.Components
4 | {
5 | public interface IComponent
6 | {
7 | ///
8 | /// Start component
9 | ///
10 | ///
11 | Task Start();
12 | ///
13 | /// Stop component
14 | ///
15 | ///
16 | Task Stop();
17 |
18 | ///
19 | /// Send to component the configuration
20 | ///
21 | ///
22 | ///
23 | Task InitConfiguration(object config);
24 |
25 | ///
26 | /// If configuration is empty send default config
27 | ///
28 | ///
29 | object GetDefaultConfig();
30 | }
31 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Components/IComponentConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Interfaces.Components
2 | {
3 | public interface IComponentConfig
4 | {
5 | bool Enabled { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Controllers/IBaseApiController.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 | using Neon.HomeControl.Api.Core.Interfaces.Dao;
3 | using Neon.HomeControl.Api.Core.Interfaces.Dto;
4 | using Neon.HomeControl.Api.Core.Interfaces.Entities;
5 | using System.Collections.Generic;
6 |
7 | namespace Neon.HomeControl.Api.Core.Interfaces.Controllers
8 | {
9 | public interface IBaseApiController
10 | where TEntity : IBaseEntity
11 | where TDto : IBaseDto
12 | where TDataAccess : IDataAccess
13 | {
14 | ActionResult> List();
15 |
16 | ActionResult Count();
17 | }
18 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Dao/IDataAccess.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.Entities;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace Neon.HomeControl.Api.Core.Interfaces.Dao
6 | {
7 | public interface IDataAccess where TEntity : IBaseEntity
8 | {
9 | List List();
10 |
11 | long Count();
12 |
13 | TEntity Insert(TEntity entity);
14 |
15 | TEntity Update(TEntity entity);
16 |
17 | bool Delete(TEntity entity);
18 |
19 | IQueryable Query();
20 | }
21 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Database/IDatabaseSeed.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.Database
4 | {
5 | public interface IDatabaseSeed
6 | {
7 | Task Seed();
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Database/INoSqlConnector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Neon.HomeControl.Api.Core.Interfaces.IoTEntities;
7 |
8 | namespace Neon.HomeControl.Api.Core.Interfaces.Database
9 | {
10 | ///
11 | /// Interface for No SQL database
12 | ///
13 | public interface INoSqlConnector: IDisposable
14 | {
15 | Task Init(string connectionString);
16 |
17 | T Insert(T value, string collectionName) where T : IIotEntity;
18 |
19 | T Update(T value, string collectionName) where T : IIotEntity;
20 |
21 | List List(string collectionName) where T : IIotEntity;
22 |
23 | bool CollectionExists(string name);
24 |
25 | bool AddIndex(string collectionName, string field, bool unique);
26 |
27 | IQueryable Query(string collectionName) where T : IIotEntity;
28 |
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Dto/IBaseCodeDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.Dto
4 | {
5 | public interface IBaseCodeDto : IBaseDto
6 | {
7 | Guid Code { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Dto/IBaseDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.Dto
4 | {
5 | public interface IBaseDto
6 | {
7 | long Id { get; set; }
8 |
9 | DateTime CreatedDateTime { get; set; }
10 |
11 | DateTime UpdateDateTime { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Entities/IBaseCodeEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.Entities
4 | {
5 | public interface IBaseCodeEntity : IBaseEntity
6 | {
7 | Guid Code { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Entities/IBaseEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.Entities
4 | {
5 | public interface IBaseEntity
6 | {
7 | long Id { get; set; }
8 |
9 | DateTime CreatedDateTime { get; set; }
10 |
11 | DateTime UpdateDateTime { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/IDtoMapper.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.Dto;
2 | using Neon.HomeControl.Api.Core.Interfaces.Entities;
3 | using System.Collections.Generic;
4 |
5 | namespace Neon.HomeControl.Api.Core.Interfaces
6 | {
7 | ///
8 | /// Interface for create DTO Mapper
9 | ///
10 | ///
11 | ///
12 | public interface IDtoMapper where TEntity : IBaseEntity where TDto : IBaseDto
13 | {
14 | ///
15 | /// Transform list of entities in DTOs
16 | ///
17 | ///
18 | ///
19 | List ToDto(List entities);
20 | ///
21 | /// Transform single entity in DTO
22 | ///
23 | ///
24 | ///
25 | TDto ToDto(TEntity entity);
26 | ///
27 | /// Transform List of DTOs in Entities
28 | ///
29 | ///
30 | ///
31 | List ToEntity(List dto);
32 | ///
33 | /// Transform DTO in Entity
34 | ///
35 | ///
36 | ///
37 | TEntity ToEntity(TDto dto);
38 | }
39 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/IoTEntities/IIotEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.IoTEntities
4 | {
5 | public interface IIotEntity
6 | {
7 | Guid Id { get; set; }
8 |
9 | DateTime EventDateTime { get; set; }
10 |
11 | string EntityName { get; set; }
12 |
13 | string EntityType { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/JobScheduler/IJobSchedulerTask.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | namespace Neon.HomeControl.Api.Core.Interfaces.JobScheduler
5 | {
6 | public interface IJobSchedulerTask : IDisposable
7 | {
8 | Task Execute(params object[] args);
9 | }
10 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Managers/IComponentsService.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Data.Components;
2 | using Neon.HomeControl.Api.Core.Interfaces.Components;
3 | using Neon.HomeControl.Api.Core.Interfaces.Services;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.Threading.Tasks;
7 |
8 | namespace Neon.HomeControl.Api.Core.Interfaces.Managers
9 | {
10 | public interface IComponentsService : IService
11 | {
12 | List AvailableComponents { get; set; }
13 |
14 | ObservableCollection RunningComponents { get; set; }
15 |
16 | void SaveComponentConfig(T config) where T : IComponentConfig;
17 |
18 | Task StartComponent(string componentId);
19 |
20 | }
21 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Managers/IServicesManager.cs:
--------------------------------------------------------------------------------
1 | using Autofac;
2 | using Neon.HomeControl.Api.Core.Data.Config;
3 | using Neon.HomeControl.Api.Core.Data.Services;
4 | using Neon.HomeControl.Api.Core.Enums;
5 | using System;
6 | using System.Collections.ObjectModel;
7 | using System.Threading.Tasks;
8 |
9 | namespace Neon.HomeControl.Api.Core.Interfaces.Managers
10 | {
11 | public interface IServicesManager
12 | {
13 | IContainer Container { get; set; }
14 |
15 | ObservableCollection ServicesInfo { get; set; }
16 | ContainerBuilder InitContainer();
17 |
18 | bool RegisterService(LifeScopeTypeEnum lifeScope, Type type);
19 |
20 | bool RegisterService(LifeScopeTypeEnum lifeScope);
21 |
22 | IContainer Build();
23 |
24 | Task Start();
25 |
26 | Task Stop();
27 |
28 | T Resolve();
29 |
30 | object Resolve(Type type);
31 |
32 | void StopService(Guid serviceId);
33 |
34 | Task StartService(Type serviceType);
35 |
36 | Task StartService();
37 |
38 | void AddConfiguration(NeonConfig config);
39 | }
40 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Messages/IBaseMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.Messages
4 | {
5 | public interface IBaseMessage
6 | {
7 | Guid MessageId { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/OAuth/IOAuthCallback.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Data.OAuth;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.OAuth
4 | {
5 | public interface IOAuthCallback
6 | {
7 | void OnOAuthResult(OAuthResult result);
8 | }
9 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Plugins/IPlugin.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.Plugins
4 | {
5 | public interface IPlugin
6 | {
7 | Task Start();
8 |
9 | Task Stop();
10 | }
11 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/PropertyChange/IBasePropertyChangedEntity.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.PropertyChange
4 | {
5 | ///
6 | /// Interface for create Property Change Entity
7 | ///
8 | public interface IBasePropertyChangedEntity : INotifyPropertyChanged
9 | {
10 | }
11 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/ScriptEngine/IScriptEngine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Neon.HomeControl.Api.Core.Interfaces.ScriptEngine
8 | {
9 | ///
10 | /// Interface for creates Universal Script Engine
11 | ///
12 | public interface IScriptEngine : IDisposable
13 | {
14 | void LoadFile(string fileName, bool immediateExecute);
15 |
16 | void RegisterFunction(string functionName, object obj, MethodInfo method);
17 |
18 | object ExecuteCode(string code);
19 |
20 | Task Build();
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Services/ICommandDispatcherService.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Neon.HomeControl.Api.Core.Data.Commands;
3 | using Neon.HomeControl.Api.Core.Interfaces.IoTEntities;
4 |
5 | namespace Neon.HomeControl.Api.Core.Interfaces.Services
6 | {
7 | ///
8 | /// Dispatcher Service
9 | ///
10 | public interface ICommandDispatcherService : IService
11 | {
12 | ///
13 | /// Dispatch to component service
14 | ///
15 | ///
16 | ///
17 | ///
18 | ///
19 | object DispatchCommand(T entity, string commandName, params object[] args) where T : IIotEntity;
20 |
21 |
22 | ///
23 | /// List of availables commands
24 | ///
25 | List CommandInfos { get; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Services/IDatabaseService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neon.HomeControl.Api.Core.Interfaces.Services
4 | {
5 | ///
6 | /// Database wrapper for DB Context
7 | ///
8 | public interface IDatabaseService : IService
9 | {
10 | ///
11 | /// Type of DB Context
12 | ///
13 | Type GetDbContextForContainer { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Services/IDiscoveryService.cs:
--------------------------------------------------------------------------------
1 | namespace Neon.HomeControl.Api.Core.Interfaces.Services
2 | {
3 | public interface IDiscoveryService : IService
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/Neon.HomeControl.Api/Core/Interfaces/Services/IEventDatabaseService.cs:
--------------------------------------------------------------------------------
1 | using Neon.HomeControl.Api.Core.Interfaces.IoTEntities;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace Neon.HomeControl.Api.Core.Interfaces.Services
6 | {
7 | public interface IEventDatabaseService : IService
8 | {
9 | T Insert(T value) where T : IIotEntity;
10 |
11 | T Update(T value) where T : IIotEntity;
12 |
13 | List List() where T : IIotEntity;
14 |
15 | List