Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
firsttris committed Dec 29, 2023
1 parent 36fe00f commit ec876c6
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 110 deletions.
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,24 @@ I have collected an API Summary, where you have an quick overview of all methods

This project currently supports the following devices:

- [Light](/src/app/LightControl.tsx)
- [Thermostat](/src/app/ThermostatControl.tsx)
- [Blinds](/src/app/BlindsControl.tsx)
[Switch](src/app/controls/SwitchControl.tsx)
![Screenshot](docs/controls/switch.png)

[Thermostat](src/app/controls/ThermostatControl.tsx)
![Screenshot](docs/controls/thermostat.png)

[Blinds](/src/app/BlindsControl.tsx)
![Screenshot](docs/controls/blinds.png)

[Door Operator](src/app/controls/DoorControl.tsx)
![Screenshot](docs/controls/door-operator.png)

[Floor Heating](src/app/controls/FloorControl.tsx)
![Screenshot](docs/controls/floor-heating.png)

[Rain Detection Control](src/app/controls/RainDetectionControl.tsx)
![Screenshot](docs/controls/rain.png)


We welcome pull requests to add support for new devices. Your contributions are appreciated!

Expand Down
Binary file modified docs/ListOfDevices1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/ListOfDevices2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/controls/blinds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/controls/door-operator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/controls/floor-heating.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/controls/rain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/controls/switch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/controls/thermostat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/app/ChannelsForType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useTranslations } from './../i18n/utils';
import { Icon } from '@iconify/react';
import { Channel, ChannelType } from './../types/types';
import { RainDetectionControl } from './controls/RainDetectionControl';
import { DoorControl } from './controls/DoorControl';


interface ExpandMoreProps {
Expand Down Expand Up @@ -49,6 +50,8 @@ const getControlComponent = (channel: Channel, refetch: () => void) => {
return <BlindsControl channel={channel} />;
case ChannelType.RAIN_DETECTION_TRANSMITTER:
return <RainDetectionControl channel={channel} />;
case ChannelType.KEYMATIC:
return <DoorControl refetch={refetch} channel={channel} />;
default:
return (
<Box>
Expand Down
8 changes: 7 additions & 1 deletion src/app/components/StyledIcons.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { Icon } from "@iconify/react";
import { styled } from "@mui/material";

export const StyledIconButton = styled(Icon)`
interface StyledIconButtonProps {
icon: string;
active?: string;
}

export const StyledIconButton = styled(Icon)<StyledIconButtonProps>`
color: ${(props) => (props.active === 'true' ? '#0077B6' : '#000')};
font-size: 40px;
background-color: lightGrey;
border-radius: 10px;
Expand Down
83 changes: 83 additions & 0 deletions src/app/controls/DoorControl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { Box, CardHeader, Typography } from '@mui/material';
import { StyledIconButton } from '../components/StyledIcons';
import { KeymaticChannel } from './../../types/types';
import { useSetValueMutation } from './../../hooks/useApi';

interface DoorControlProps {
channel: KeymaticChannel;
refetch: () => void;
}

export const DoorControl: React.FC<DoorControlProps> = ({ channel, refetch }) => {
const setValueMutation = useSetValueMutation();
const {
datapoints: { STATE, STATE_UNCERTAIN },
} = channel;

const isUncertain = STATE_UNCERTAIN === 'true';
const isUnlocked = STATE === 'true';

const unlockDoor = async () => {
await setValueMutation.mutateAsync({
interface: channel.interfaceName,
address: channel.address,
valueKey: 'STATE',
type: 'boolean',
value: true,
});
refetch()
};

const lockDoor = async () => {
await setValueMutation.mutateAsync({
interface: channel.interfaceName,
address: channel.address,
valueKey: 'STATE',
type: 'boolean',
value: false,
});
refetch()
};

const openDoor = async () => {
await setValueMutation.mutateAsync({
interface: channel.interfaceName,
address: channel.address,
valueKey: 'OPEN',
type: 'boolean',
value: true,
});
refetch()
};

return (
<CardHeader
title={
<Box>
<Box sx={{ display: 'flex', gap: '10px', alignItems: 'center' }}>
<StyledIconButton
icon="material-symbols:lock-outline"
active={(!isUnlocked).toString()}
onClick={lockDoor}
/>
<StyledIconButton
icon="material-symbols:lock-open-outline"
active={isUnlocked.toString()}
onClick={unlockDoor}
/>
<StyledIconButton
icon="material-symbols:door-open-outline"
onClick={openDoor}
/>
</Box>
<Typography
sx={{ display: isUncertain ? 'block' : 'none' }}
variant="caption"
>
Door state is uncertain
</Typography>
</Box>
}
/>
);
};
4 changes: 2 additions & 2 deletions src/app/controls/RainDetectionControl.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box, CardHeader, Typography, styled } from '@mui/material';
import { RainDesctionTransmitterChannel } from './../../types/types';
import { RainDetectionTransmitterChannel } from './../../types/types';
import { StyledHeaderIcon } from '../components/StyledIcons';

const StyledBox = styled(Box)({
Expand All @@ -15,7 +15,7 @@ const StyledBox = styled(Box)({


interface RainDetectionControlProps {
channel: RainDesctionTransmitterChannel;
channel: RainDetectionTransmitterChannel;
}

export const RainDetectionControl: React.FC<RainDetectionControlProps> = ({
Expand Down
229 changes: 125 additions & 104 deletions src/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,106 +1,127 @@
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
}
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',
KEYMATIC = 'KEYMATIC',
}

export interface RainDesctionTransmitterChannel extends BaseChannel {
type: ChannelType.RAIN_DETECTION_TRANSMITTER;
datapoints: RainDesctionTransmitterDatapoint
}

export type Channel = SwitchVirtualReceiverChannel | BlindVirtualReceiverChannel | HeatingClimateControlTransceiverChannel | FloorClimateControlTransceiverChannel | RainDesctionTransmitterChannel;
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;
};

export type KeymaticDatapoint = {
ERROR: string;
INHIBIT: string;
OPEN: string;
RELOCK_DELAY: string;
STATE: string;
STATE_UNCERTAIN: 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 RainDetectionTransmitterChannel extends BaseChannel {
type: ChannelType.RAIN_DETECTION_TRANSMITTER;
datapoints: RainDesctionTransmitterDatapoint;
}

export interface KeymaticChannel extends BaseChannel {
type: ChannelType.KEYMATIC;
datapoints: KeymaticDatapoint;
}

export type Channel =
| SwitchVirtualReceiverChannel
| BlindVirtualReceiverChannel
| HeatingClimateControlTransceiverChannel
| FloorClimateControlTransceiverChannel
| RainDetectionTransmitterChannel
| KeymaticChannel;

0 comments on commit ec876c6

Please sign in to comment.