diff --git a/src/app/ChannelsForType.tsx b/src/app/ChannelsForType.tsx
index bc21b48..9b4a98e 100644
--- a/src/app/ChannelsForType.tsx
+++ b/src/app/ChannelsForType.tsx
@@ -9,13 +9,14 @@ import {
styled,
} from '@mui/material';
import { useState } from 'react';
-import { Channel, ChannelType } from './../hooks/useApi';
-import { FloorControl } from './FloorControl';
-import { SwitchControl } from './SwitchControl';
-import { ThermostatControl } from './ThermostatControl';
-import { BlindsControl } from './BlindsControl';
+import { FloorControl } from './controls/FloorControl';
+import { SwitchControl } from './controls/SwitchControl';
+import { ThermostatControl } from './controls/ThermostatControl';
+import { BlindsControl } from './controls/BlindsControl';
import { useTranslations } from './../i18n/utils';
import { Icon } from '@iconify/react';
+import { Channel, ChannelType } from './../types/types';
+import { RainDetectionControl } from './controls/RainDetectionControl';
interface ExpandMoreProps {
@@ -46,6 +47,8 @@ const getControlComponent = (channel: Channel, refetch: () => void) => {
return ;
case ChannelType.BLIND_VIRTUAL_RECEIVER:
return ;
+ case ChannelType.RAIN_DETECTION_TRANSMITTER:
+ return ;
default:
return (
diff --git a/src/app/RainDetectionTransmitter.tsx b/src/app/RainDetectionTransmitter.tsx
deleted file mode 100644
index e69de29..0000000
diff --git a/src/app/BlindsControl.tsx b/src/app/controls/BlindsControl.tsx
similarity index 88%
rename from src/app/BlindsControl.tsx
rename to src/app/controls/BlindsControl.tsx
index dcc87aa..9bca836 100644
--- a/src/app/BlindsControl.tsx
+++ b/src/app/controls/BlindsControl.tsx
@@ -1,11 +1,11 @@
import { Box, CardContent } from '@mui/material';
import {
- BlindVirtualReceiverChannel,
useSetValueMutation,
-} from '../hooks/useApi';
-import { CircularProgressWithLabel } from './components/CircularProgressWithLabel';
-import { StyledIconButton } from './components/StyledIcons';
-import { ChannelHeader } from './components/ChannelHeader';
+} from '../../hooks/useApi';
+import { CircularProgressWithLabel } from '../components/CircularProgressWithLabel';
+import { StyledIconButton } from '../components/StyledIcons';
+import { ChannelHeader } from '../components/ChannelHeader';
+import { BlindVirtualReceiverChannel } from 'src/types/types';
interface ControlProps {
channel: BlindVirtualReceiverChannel;
diff --git a/src/app/FloorControl.tsx b/src/app/controls/FloorControl.tsx
similarity index 87%
rename from src/app/FloorControl.tsx
rename to src/app/controls/FloorControl.tsx
index 320705b..71a1574 100644
--- a/src/app/FloorControl.tsx
+++ b/src/app/controls/FloorControl.tsx
@@ -4,9 +4,9 @@ import {
LinearProgress,
Typography,
} from '@mui/material';
-import { FloorClimateControlTransceiverChannel } from 'src/hooks/useApi';
-import { StyledHeaderIcon } from './components/StyledIcons';
-import { ChannelHeader } from './components/ChannelHeader';
+import { StyledHeaderIcon } from '../components/StyledIcons';
+import { ChannelHeader } from '../components/ChannelHeader';
+import { FloorClimateControlTransceiverChannel } from 'src/types/types';
interface FloorControlProps {
channel: FloorClimateControlTransceiverChannel;
diff --git a/src/app/controls/RainDetectionControl.tsx b/src/app/controls/RainDetectionControl.tsx
new file mode 100644
index 0000000..b4589ea
--- /dev/null
+++ b/src/app/controls/RainDetectionControl.tsx
@@ -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 = ({
+ channel,
+}) => {
+ const {
+ datapoints: { HEATER_STATE, RAINING },
+ } = channel;
+
+ const isRaining = RAINING === 'true';
+ const isHeating = HEATER_STATE === 'true';
+
+ return (
+
+
+ {isRaining ? (
+
+ ) : (
+
+ )}
+ {isRaining ? 'Raining' : 'Not Raining'}
+
+
+ {isHeating ? (
+
+ ) : (
+
+ )}
+ {isHeating ? 'Heating' : 'Not Heating'}
+
+
+ }
+ />
+ );
+};
diff --git a/src/app/SwitchControl.tsx b/src/app/controls/SwitchControl.tsx
similarity index 87%
rename from src/app/SwitchControl.tsx
rename to src/app/controls/SwitchControl.tsx
index a39a7a3..c5469e1 100644
--- a/src/app/SwitchControl.tsx
+++ b/src/app/controls/SwitchControl.tsx
@@ -1,10 +1,10 @@
import { styled } from '@mui/system';
import { Box } from '@mui/material';
import {
- SwitchVirtualReceiverChannel,
useSetValueMutation,
-} from '../hooks/useApi';
-import { ChannelHeader } from './components/ChannelHeader';
+} from '../../hooks/useApi';
+import { ChannelHeader } from '../components/ChannelHeader';
+import { SwitchVirtualReceiverChannel } from 'src/types/types';
interface ControlProps {
channel: SwitchVirtualReceiverChannel;
diff --git a/src/app/ThermostatControl.tsx b/src/app/controls/ThermostatControl.tsx
similarity index 95%
rename from src/app/ThermostatControl.tsx
rename to src/app/controls/ThermostatControl.tsx
index 53651f4..fa48d30 100644
--- a/src/app/ThermostatControl.tsx
+++ b/src/app/controls/ThermostatControl.tsx
@@ -1,13 +1,12 @@
import { Box, Slider, Typography, styled } from '@mui/material';
-
import {
- HeatingClimateControlTransceiverChannel,
useSetValueMutation,
-} from '../hooks/useApi';
+} from '../../hooks/useApi';
import { useEffect, useState } from 'react';
-import { CircularProgressWithLabel } from './components/CircularProgressWithLabel';
-import { StyledHeaderIcon, StyledIconButton } from './components/StyledIcons';
-import { ChannelHeader } from './components/ChannelHeader';
+import { CircularProgressWithLabel } from '../components/CircularProgressWithLabel';
+import { StyledHeaderIcon, StyledIconButton } from '../components/StyledIcons';
+import { ChannelHeader } from '../components/ChannelHeader';
+import { HeatingClimateControlTransceiverChannel } from 'src/types/types';
interface ControlProps {
channel: HeatingClimateControlTransceiverChannel;
diff --git a/src/hooks/useApi.ts b/src/hooks/useApi.ts
index 3011731..d652896 100644
--- a/src/hooks/useApi.ts
+++ b/src/hooks/useApi.ts
@@ -5,102 +5,7 @@ import regaGetRoomsScript from './../rega/getRooms.tcl';
import regaGetChannelsScript from './../rega/getChannelsForRoomId.tcl';
import { useCheckSession } from './useCheckSession';
import { useMemo } from 'react';
-
-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"
-}
-
-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;
-};
-
-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 type Channel = SwitchVirtualReceiverChannel | BlindVirtualReceiverChannel | HeatingClimateControlTransceiverChannel | FloorClimateControlTransceiverChannel;
+import { Channel, ChannelType } from 'src/types/types';
interface Room {
name: string;
diff --git a/src/types/types.ts b/src/types/types.ts
new file mode 100644
index 0000000..687a73b
--- /dev/null
+++ b/src/types/types.ts
@@ -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;
\ No newline at end of file