-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
189 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
10 changes: 5 additions & 5 deletions
10
src/app/BlindsControl.tsx → src/app/controls/BlindsControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Box, CardHeader, Typography, styled } from '@mui/material'; | ||
import { RainDesctionTransmitterChannel } from './../../types/types'; | ||
import { StyledHeaderIcon } from '../components/StyledIcons'; | ||
|
||
const StyledBox = styled(Box)({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
}); | ||
|
||
const StyledIconBox = styled(Box)({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: '5px', | ||
}); | ||
|
||
|
||
interface RainDetectionControlProps { | ||
channel: RainDesctionTransmitterChannel; | ||
} | ||
|
||
export const RainDetectionControl: React.FC<RainDetectionControlProps> = ({ | ||
channel, | ||
}) => { | ||
const { | ||
datapoints: { HEATER_STATE, RAINING }, | ||
} = channel; | ||
|
||
const isRaining = RAINING === 'true'; | ||
const isHeating = HEATER_STATE === 'true'; | ||
|
||
return ( | ||
<CardHeader | ||
title={ | ||
<StyledBox> | ||
<StyledIconBox> | ||
{isRaining ? ( | ||
<StyledHeaderIcon icon="mdi:weather-heavy-rain" color="#0077B6" /> | ||
) : ( | ||
<StyledHeaderIcon icon="mdi:clouds" /> | ||
)} | ||
<Typography variant="caption">{isRaining ? 'Raining' : 'Not Raining'}</Typography> | ||
</StyledIconBox> | ||
<StyledIconBox> | ||
{isHeating ? ( | ||
<StyledHeaderIcon | ||
icon="material-symbols:mode-heat" | ||
color="#FF4500" | ||
/> | ||
) : ( | ||
<StyledHeaderIcon icon="material-symbols:mode-heat-off" /> | ||
)} | ||
<Typography variant="caption">{isHeating ? 'Heating' : 'Not Heating'}</Typography> | ||
</StyledIconBox> | ||
</StyledBox> | ||
} | ||
/> | ||
); | ||
}; |
6 changes: 3 additions & 3 deletions
6
src/app/SwitchControl.tsx → src/app/controls/SwitchControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 5 additions & 6 deletions
11
src/app/ThermostatControl.tsx → src/app/controls/ThermostatControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
export enum ChannelType { | ||
SWITCH_VIRTUAL_RECEIVER = "SWITCH_VIRTUAL_RECEIVER", | ||
BLIND_VIRTUAL_RECEIVER = "BLIND_VIRTUAL_RECEIVER", | ||
HEATING_CLIMATECONTROL_TRANSCEIVER = "HEATING_CLIMATECONTROL_TRANSCEIVER", | ||
CLIMATECONTROL_FLOOR_TRANSCEIVER = "CLIMATECONTROL_FLOOR_TRANSCEIVER", | ||
RAIN_DETECTION_TRANSMITTER = "RAIN_DETECTION_TRANSMITTER" | ||
} | ||
|
||
export type SwitchVirtualReceiverDatapoint = { | ||
COMBINED_PARAMETER: string; | ||
ON_TIME: string; | ||
PROCESS: string; | ||
SECTION: string; | ||
SECTION_STATUS: string; | ||
STATE: string; | ||
}; | ||
|
||
export type BlindVirtualReceiverDatapoint = { | ||
ACTIVITY_STATE: string; | ||
COMBINED_PARAMETER: string; | ||
LEVEL: string; | ||
LEVEL_2: string; | ||
LEVEL_2_STATUS: string; | ||
LEVEL_STATUS: string; | ||
PROCESS: string; | ||
SECTION: string; | ||
SECTION_STATUS: string; | ||
STOP: string; | ||
}; | ||
|
||
export type HeatingClimateControlTransceiverDatapoint = { | ||
ACTIVE_PROFILE: string; | ||
ACTUAL_TEMPERATURE: string; | ||
ACTUAL_TEMPERATURE_STATUS: string; | ||
BOOST_MODE: string; | ||
BOOST_TIME: string; | ||
CONTROL_DIFFERENTIAL_TEMPERATURE: string; | ||
CONTROL_MODE: string; | ||
DURATION_UNIT: string; | ||
DURATION_VALUE: string; | ||
FROST_PROTECTION: string; | ||
HEATING_COOLING: string; | ||
HUMIDITY?: string; | ||
HUMIDITY_STATUS?: string; | ||
PARTY_MODE: string; | ||
PARTY_SET_POINT_TEMPERATURE: string; | ||
PARTY_TIME_END: string; | ||
PARTY_TIME_START: string; | ||
QUICK_VETO_TIME: string; | ||
SET_POINT_MODE: string; | ||
SET_POINT_TEMPERATURE: string; | ||
SWITCH_POINT_OCCURED: string; | ||
WINDOW_STATE: string; | ||
LEVEL?: string; | ||
LEVEL_STATUS?: string; | ||
}; | ||
|
||
export type FloorClimateControlTransceiverDatapoint = { | ||
DEW_POINT_ALARM: string; | ||
EMERGENCY_OPERATION: string; | ||
EXTERNAL_CLOCK: string; | ||
FROST_PROTECTION: string; | ||
HUMIDITY_LIMITER: string; | ||
LEVEL: string; | ||
LEVEL_STATUS: string; | ||
VALVE_STATE: string; | ||
} | ||
|
||
export type RainDesctionTransmitterDatapoint = { | ||
RAINING: string; | ||
HEATER_STATE: string; | ||
} | ||
|
||
interface BaseChannel { | ||
id: number; | ||
name: string; | ||
address: string; | ||
interfaceName: string; | ||
} | ||
|
||
export interface SwitchVirtualReceiverChannel extends BaseChannel { | ||
type: ChannelType.SWITCH_VIRTUAL_RECEIVER; | ||
datapoints: SwitchVirtualReceiverDatapoint; | ||
} | ||
|
||
export interface BlindVirtualReceiverChannel extends BaseChannel { | ||
type: ChannelType.BLIND_VIRTUAL_RECEIVER; | ||
datapoints: BlindVirtualReceiverDatapoint; | ||
} | ||
|
||
export interface HeatingClimateControlTransceiverChannel extends BaseChannel { | ||
type: ChannelType.HEATING_CLIMATECONTROL_TRANSCEIVER; | ||
datapoints: HeatingClimateControlTransceiverDatapoint; | ||
} | ||
|
||
export interface FloorClimateControlTransceiverChannel extends BaseChannel { | ||
type: ChannelType.CLIMATECONTROL_FLOOR_TRANSCEIVER; | ||
datapoints: FloorClimateControlTransceiverDatapoint | ||
} | ||
|
||
export interface RainDesctionTransmitterChannel extends BaseChannel { | ||
type: ChannelType.RAIN_DETECTION_TRANSMITTER; | ||
datapoints: RainDesctionTransmitterDatapoint | ||
} | ||
|
||
export type Channel = SwitchVirtualReceiverChannel | BlindVirtualReceiverChannel | HeatingClimateControlTransceiverChannel | FloorClimateControlTransceiverChannel | RainDesctionTransmitterChannel; |