forse ora va
This commit is contained in:
commit
5e996670f3
4 changed files with 977 additions and 581 deletions
|
@ -49,8 +49,21 @@ const deviceStateOptions = [
|
|||
{ key: 'on', text: 'on', value: true },
|
||||
];
|
||||
|
||||
const thermostatOptions = [
|
||||
{ key: 'HEATING', text: 'HEATING', value: 'HEATING' },
|
||||
{ key: 'COOLING', text: 'COOLING', value: 'COOLING' },
|
||||
{ key: 'IDLE', text: 'IDLE', value: 'IDLE' },
|
||||
{ key: 'OFF', text: 'OFF', value: 'OFF' },
|
||||
];
|
||||
|
||||
const thermostatOperands = [
|
||||
{ key: 'EQUAL', text: '=', value: 'EQUAL' },
|
||||
{ key: 'NOTEQUAL', text: '\u2260', value: 'NOTEQUAL' },
|
||||
];
|
||||
|
||||
const CreateTrigger = (props) => {
|
||||
const [activeOperand, setActiveOperand] = useState(true);
|
||||
const [activeThermostat, setActiveThermostat] = useState(false);
|
||||
const operandsRef = useRef(null);
|
||||
const valuesRef = useRef(null);
|
||||
const notAdmitedDevices = ['buttonDimmer'];
|
||||
|
@ -72,7 +85,7 @@ const CreateTrigger = (props) => {
|
|||
const onChange = (e, val) => {
|
||||
props.inputChange(val);
|
||||
setActiveOperand(hasOperand.has(props.devices[val.value].kind));
|
||||
|
||||
setActiveThermostat(props.devices[val.value].kind === 'thermostat' && props.condition);
|
||||
if (operandsRef.current) operandsRef.current.setValue('');
|
||||
if (valuesRef.current) valuesRef.current.inputRef.current.valueAsNumber = undefined;
|
||||
};
|
||||
|
@ -92,7 +105,32 @@ const CreateTrigger = (props) => {
|
|||
placeholder="Device"
|
||||
/>
|
||||
</Form.Field>
|
||||
{activeOperand ? (
|
||||
{
|
||||
activeThermostat ? (
|
||||
<>
|
||||
<Form.Field inline width={2}>
|
||||
<Dropdown
|
||||
onChange={(e, val) => props.inputChange(val)}
|
||||
ref={operandsRef}
|
||||
name="operand"
|
||||
compact
|
||||
selection
|
||||
options={thermostatOperands}
|
||||
/>
|
||||
</Form.Field>
|
||||
<Form.Field inline width={7}>
|
||||
<Dropdown
|
||||
onChange={(e, val) => props.inputChange(val)}
|
||||
placeholder="State"
|
||||
name="mode"
|
||||
compact
|
||||
selection
|
||||
options={thermostatOptions}
|
||||
/>
|
||||
</Form.Field>
|
||||
</>
|
||||
)
|
||||
: activeOperand ? (
|
||||
<>
|
||||
<Form.Field inline width={2}>
|
||||
<Dropdown
|
||||
|
@ -127,7 +165,8 @@ const CreateTrigger = (props) => {
|
|||
options={deviceStateOptions}
|
||||
/>
|
||||
</Form.Field>
|
||||
)}
|
||||
)
|
||||
}
|
||||
</Form.Group>
|
||||
</Form>
|
||||
</List.Content>
|
||||
|
@ -164,8 +203,10 @@ const SceneItem = (props) => {
|
|||
|
||||
const Trigger = ({
|
||||
deviceName, trigger, onRemove, index,
|
||||
}) => {
|
||||
const { operand, value, on } = trigger;
|
||||
}) => {
|
||||
const {
|
||||
operand, value, on, mode,
|
||||
} = trigger;
|
||||
let symbol;
|
||||
if (operand) {
|
||||
symbol = operands.filter((opt) => opt.key === operand)[0].text;
|
||||
|
@ -175,7 +216,7 @@ const Trigger = ({
|
|||
<Menu compact>
|
||||
<Menu.Item as="span">{deviceName}</Menu.Item>
|
||||
{operand ? <Menu.Item as="span">{symbol}</Menu.Item> : ''}
|
||||
<Menu.Item as="span">{operand ? value : on ? 'on' : 'off'}</Menu.Item>
|
||||
<Menu.Item as="span">{mode || (operand ? value : on ? 'on' : 'off')}</Menu.Item>
|
||||
</Menu>
|
||||
<Icon
|
||||
as="i"
|
||||
|
@ -192,10 +233,12 @@ class AutomationSaveModal extends Component {
|
|||
super(props);
|
||||
this.state = {
|
||||
triggerList: [],
|
||||
conditionsList: [],
|
||||
order: [],
|
||||
automationName: 'New Automation',
|
||||
editName: false,
|
||||
newTrigger: {},
|
||||
newCondition: {},
|
||||
scenesFilter: null,
|
||||
openModal: false,
|
||||
};
|
||||
|
@ -226,13 +269,17 @@ class AutomationSaveModal extends Component {
|
|||
this.setautomationName = this._setter('automationName');
|
||||
this.setEditName = this._setter('editName');
|
||||
this.setNewTrigger = this._setter('newTrigger');
|
||||
|
||||
this.addTrigger = this.addTrigger.bind(this);
|
||||
this.removeTrigger = this.removeTrigger.bind(this);
|
||||
this.onInputChange = this.onInputChange.bind(this);
|
||||
this.searchScenes = this.searchScenes.bind(this);
|
||||
this.orderScenes = this.orderScenes.bind(this);
|
||||
this.onChangeName = this.onChangeName.bind(this);
|
||||
|
||||
// Conditions
|
||||
this.setNewCondition = this._setter('newCondition');
|
||||
this.addCondition = this.addCondition.bind(this);
|
||||
this.removeCondition = this.removeCondition.bind(this);
|
||||
}
|
||||
|
||||
openModal = (e) => {
|
||||
|
@ -254,36 +301,29 @@ class AutomationSaveModal extends Component {
|
|||
triggerKind(trigger) {
|
||||
if ('operand' in trigger && 'value' in trigger) {
|
||||
return 'rangeTrigger';
|
||||
} if ('on' in trigger) {
|
||||
}
|
||||
if ('on' in trigger) {
|
||||
return 'booleanTrigger';
|
||||
}
|
||||
return false;
|
||||
// throw new Error("Trigger kind not handled");
|
||||
}
|
||||
|
||||
_checkNewTrigger(trigger) {
|
||||
const error = {
|
||||
result: false,
|
||||
message: 'There are missing fields!',
|
||||
};
|
||||
const device = Object.values(this.props.devices).filter(
|
||||
(d) => d.id === trigger.device,
|
||||
)[0];
|
||||
|
||||
const triggerKind = this.triggerKind(trigger);
|
||||
|
||||
if (!device || !triggerKind) {
|
||||
error.message = 'There are missing fields';
|
||||
return error;
|
||||
conditionKind(condition) {
|
||||
if ('operand' in condition && 'value' in condition) {
|
||||
return 'rangeTrigger';
|
||||
}
|
||||
if ('on' in condition) {
|
||||
return 'booleanTrigger';
|
||||
}
|
||||
const deviceKind = device.kind;
|
||||
const devicesWithPercentage = ['dimmableLight', 'curtains', 'knobDimmer'];
|
||||
|
||||
switch (triggerKind) {
|
||||
case 'booleanTrigger':
|
||||
if (!trigger.device || trigger.on === null || trigger.on === undefined) return error;
|
||||
break;
|
||||
case 'rangeTrigger':
|
||||
if ('operand' in condition && 'mode' in condition) {
|
||||
return 'thermostatCondition';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
checkRange(deviceKind, devicesWithPercentage, trigger, error, device) {
|
||||
if (!trigger.device || !trigger.operand || !trigger.value) {
|
||||
return error;
|
||||
}
|
||||
|
@ -298,7 +338,8 @@ class AutomationSaveModal extends Component {
|
|||
) {
|
||||
error.message = "The value can't exceed 100, as it's a percentage";
|
||||
return error;
|
||||
} if (
|
||||
}
|
||||
if (
|
||||
deviceKind === 'sensor'
|
||||
&& device.sensor === 'HUMIDITY'
|
||||
&& trigger.value > 100
|
||||
|
@ -306,26 +347,92 @@ class AutomationSaveModal extends Component {
|
|||
error.message = "The value can't exceed 100, as it's a percentage";
|
||||
return error;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
checkBool(trigger, error) {
|
||||
if (!trigger.device || trigger.on === null || trigger.on === undefined) return error;
|
||||
return false;
|
||||
}
|
||||
|
||||
_checkNewTrigger(trigger, isCondition = false) {
|
||||
const error = {
|
||||
result: false,
|
||||
message: 'There are missing fields!',
|
||||
};
|
||||
const device = Object.values(this.props.devices).filter(
|
||||
(d) => d.id === trigger.device,
|
||||
)[0];
|
||||
|
||||
const triggerKind = this.triggerKind(trigger);
|
||||
const conditionKind = this.conditionKind(trigger);
|
||||
if (!isCondition && (!device || !triggerKind)) {
|
||||
error.message = 'There are missing fields';
|
||||
return error;
|
||||
}
|
||||
|
||||
if (isCondition && !conditionKind) {
|
||||
error.message = 'There are missing fields';
|
||||
return error;
|
||||
}
|
||||
const deviceKind = device.kind;
|
||||
const devicesWithPercentage = ['dimmableLight', 'curtains', 'knobDimmer'];
|
||||
|
||||
switch (isCondition ? conditionKind : triggerKind) {
|
||||
case 'booleanTrigger':
|
||||
const checkBoolTrigger = this.checkBool(trigger, error);
|
||||
if (checkBoolTrigger) {
|
||||
return checkBoolTrigger;
|
||||
}
|
||||
break;
|
||||
case 'booleanCondition':
|
||||
const checkBoolCond = this.checkBool(trigger, error);
|
||||
if (checkBoolCond) {
|
||||
return checkBoolCond;
|
||||
}
|
||||
break;
|
||||
case 'rangeTrigger':
|
||||
const checkRangeTrigger = this.checkRange(deviceKind, devicesWithPercentage, trigger, error, device);
|
||||
if (checkRangeTrigger) {
|
||||
return checkRangeTrigger;
|
||||
}
|
||||
break;
|
||||
case 'rangeCondition':
|
||||
const checkRangeCond = this.checkRange(deviceKind, devicesWithPercentage, trigger, error, device);
|
||||
if (checkRangeCond) {
|
||||
return checkRangeCond;
|
||||
}
|
||||
break;
|
||||
case 'thermostatCondition':
|
||||
if (!trigger.device || trigger.mode === null || trigger.mode === undefined || !trigger.operand) return error;
|
||||
break;
|
||||
default:
|
||||
throw new Error('theoretically unreachable statement');
|
||||
}
|
||||
|
||||
const isNotDuplicate = !this.state.triggerList.some(
|
||||
let isNotDuplicate = null;
|
||||
|
||||
if (isCondition === true) {
|
||||
isNotDuplicate = !this.state.conditionsList.some(
|
||||
(t) => t.device === trigger.device && t.operand === trigger.operand,
|
||||
);
|
||||
|
||||
} else {
|
||||
isNotDuplicate = !this.state.triggerList.some(
|
||||
(t) => t.device === trigger.device && t.operand === trigger.operand,
|
||||
);
|
||||
}
|
||||
const type = isCondition ? 'condition' : 'trigger';
|
||||
const duplicationMessage = `You have already created a ${type} for this device with the same conditions`;
|
||||
return {
|
||||
result: isNotDuplicate,
|
||||
message: isNotDuplicate
|
||||
? null
|
||||
: 'You have already created a trigger for this device with the same conditions',
|
||||
: duplicationMessage,
|
||||
};
|
||||
}
|
||||
|
||||
addTrigger() {
|
||||
const { result, message } = this._checkNewTrigger(this.state.newTrigger);
|
||||
|
||||
if (result) {
|
||||
this.setState(
|
||||
update(this.state, {
|
||||
|
@ -383,12 +490,26 @@ class AutomationSaveModal extends Component {
|
|||
return this.props.scenes.filter((e) => e.name.includes(this.scenesFilter));
|
||||
}
|
||||
|
||||
_generateKey = (trigger) => {
|
||||
switch (this.triggerKind(trigger)) {
|
||||
case 'booleanTrigger':
|
||||
generateBoolKey(trigger) {
|
||||
return `${trigger.device}${trigger.on}`;
|
||||
case 'rangeTrigger':
|
||||
}
|
||||
|
||||
generateRangeKey(trigger) {
|
||||
return `${trigger.device}${trigger.operand}${trigger.value}`;
|
||||
}
|
||||
|
||||
_generateKey = (trigger, isCondition = false) => {
|
||||
switch (isCondition ? this.conditionKind(trigger) : this.triggerKind(trigger)) {
|
||||
case 'booleanTrigger':
|
||||
return this.generateBoolKey(trigger);
|
||||
case 'booleanCondition':
|
||||
return this.generateBoolKey(trigger);
|
||||
case 'rangeTrigger':
|
||||
return this.generateRangeKey(trigger);
|
||||
case 'rangeCondition':
|
||||
return this.generateRangeKey(trigger);
|
||||
case 'thermostatCondition':
|
||||
return `${trigger.device}${trigger.operand}${trigger.mode}`;
|
||||
default:
|
||||
throw new Error('theoretically unreachable statement');
|
||||
}
|
||||
|
@ -444,6 +565,25 @@ class AutomationSaveModal extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
for (const condition of this.state.conditionsList) {
|
||||
const kind = condition.kind || this.conditionKind(condition);
|
||||
const loSpagnolo = (kind === 'thermostatCondition' ? { operator: condition.operand, mode: condition.mode }
|
||||
: {
|
||||
operator: condition.operand,
|
||||
range: parseInt(condition.value),
|
||||
});
|
||||
automation.conditions.push(
|
||||
{
|
||||
deviceId: condition.device,
|
||||
kind,
|
||||
...(kind === 'booleanTrigger'
|
||||
? { on: condition.on }
|
||||
: loSpagnolo
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
this.props
|
||||
.fastUpdateAutomation(automation)
|
||||
.then(this.closeModal)
|
||||
|
@ -454,6 +594,7 @@ class AutomationSaveModal extends Component {
|
|||
automation,
|
||||
triggerList: this.state.triggerList,
|
||||
order: this.state.order,
|
||||
conditionList: this.state.conditionsList,
|
||||
})
|
||||
.then(this.closeModal)
|
||||
.catch(console.error);
|
||||
|
@ -473,11 +614,44 @@ class AutomationSaveModal extends Component {
|
|||
) : (
|
||||
<Button icon labelPosition="left" color="green" onClick={this.openModal}>
|
||||
<Icon name="add" />
|
||||
Create new automation
|
||||
Create new automation
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
// CONDITIONS
|
||||
|
||||
addCondition() {
|
||||
// Same method used to check triggers and conditions, not a mistake
|
||||
const { result, message } = this._checkNewTrigger(this.state.newCondition, true);
|
||||
if (result) {
|
||||
this.setState(
|
||||
update(this.state, {
|
||||
conditionsList: { $push: [this.state.newCondition] },
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
alert(message);
|
||||
}
|
||||
}
|
||||
|
||||
removeCondition(index) {
|
||||
this.setState(
|
||||
update(this.state, { conditionsList: { $splice: [[index, 1]] } }),
|
||||
);
|
||||
}
|
||||
|
||||
onInputChangeCondition = (val) => {
|
||||
if (val.name === 'device') {
|
||||
this.setNewCondition({ [val.name]: val.value });
|
||||
} else {
|
||||
this.setNewCondition({
|
||||
...this.state.newCondition,
|
||||
[val.name]: val.value,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal
|
||||
|
@ -499,7 +673,6 @@ Create new automation
|
|||
this.state.automationName
|
||||
)}
|
||||
</Header>
|
||||
|
||||
<Button
|
||||
onClick={() => this.setEditName((prev) => !prev)}
|
||||
style={{ display: 'inline' }}
|
||||
|
@ -578,6 +751,43 @@ Create new automation
|
|||
</Grid.Row>
|
||||
</Grid>
|
||||
</Segment>
|
||||
<Grid columns={1} stackable textAlign="center">
|
||||
<Grid.Row verticalAlign="middle">
|
||||
<Grid.Column>
|
||||
<Header>Add Conditions</Header>
|
||||
<List divided relaxed>
|
||||
{this.state.conditionsList.length > 0
|
||||
&& this.state.conditionsList.map((condition, i) => {
|
||||
const deviceName = this.deviceList.filter(
|
||||
(d) => d.id === condition.device,
|
||||
)[0].name;
|
||||
const key = this._generateKey(condition, true);
|
||||
return (
|
||||
<Trigger
|
||||
key={key}
|
||||
index={i}
|
||||
deviceName={deviceName}
|
||||
trigger={condition}
|
||||
onRemove={this.removeCondition}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
<CreateTrigger
|
||||
condition
|
||||
devices={this.props.devices}
|
||||
inputChange={this.onInputChangeCondition}
|
||||
/>
|
||||
</List>
|
||||
<Button
|
||||
onClick={this.addCondition}
|
||||
circular
|
||||
icon="add"
|
||||
color="blue"
|
||||
size="huge"
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Row>
|
||||
<Grid.Column style={{ marginRight: '1rem' }}>
|
||||
|
|
|
@ -17,7 +17,7 @@ import CreateAutomation, { operands } from './AutomationCreationModal';
|
|||
const Automation = ({
|
||||
automation, devices, scenes, removeAutomation,
|
||||
}) => {
|
||||
const { triggers } = automation;
|
||||
const { triggers, conditions } = automation;
|
||||
const scenePriorities = automation.scenes;
|
||||
const getOperator = (operand) => operands.filter((o) => o.key === operand)[0].text;
|
||||
|
||||
|
@ -85,6 +85,36 @@ const Automation = ({
|
|||
</Grid.Row>
|
||||
</Grid>
|
||||
</Segment>
|
||||
<Grid columns={1} stackable textAlign="center">
|
||||
<Grid.Row verticalAlign="middle">
|
||||
<Grid.Column>
|
||||
<Header>Conditions</Header>
|
||||
<List divided relaxed>
|
||||
{conditions !== undefined
|
||||
&& conditions.map((condition) => {
|
||||
const device = devices.filter(
|
||||
(d) => d.id === condition.deviceId,
|
||||
)[0];
|
||||
return (
|
||||
<Menu key={condition.id} compact>
|
||||
<Menu.Item as="span">
|
||||
{device.name}
|
||||
{' '}
|
||||
{condition.operator
|
||||
? `${getOperator(condition.operator)
|
||||
} ${
|
||||
condition.mode ? condition.mode : condition.range}`
|
||||
: condition.on
|
||||
? ' - on'
|
||||
: ' - off'}
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
})}
|
||||
</List>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
</Grid>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -556,25 +556,36 @@ export const RemoteService = {
|
|||
* with user-fiendly errors as a RemoteError
|
||||
*/
|
||||
saveAutomation: (data) => {
|
||||
const { automation, triggerList, order } = data;
|
||||
console.log('automation: ', automation, triggerList, order);
|
||||
const {
|
||||
automation, triggerList, order, conditionList,
|
||||
} = data;
|
||||
automation.triggers = [];
|
||||
automation.scenes = [];
|
||||
automation.condition = [];
|
||||
return (dispatch) => {
|
||||
const urlAutomation = '/automation';
|
||||
const urlBooleanTrigger = '/booleanTrigger';
|
||||
const urlRangeTrigger = '/rangeTrigger';
|
||||
const urlScenePriority = '/scenePriority';
|
||||
// conditions
|
||||
const urlRangeCondition = '/rangeCondition';
|
||||
const urlBooleanCondition = '/booleanCondition';
|
||||
const urlThermostatCondition = '/thermostatCondition';
|
||||
|
||||
const rangeTriggerList = triggerList.filter((trigger) => trigger.hasOwnProperty('operand'));
|
||||
const rangeTriggerList = triggerList.filter((trigger) => 'operand' in trigger);
|
||||
const booleanTriggerList = triggerList.filter(
|
||||
(trigger) => !trigger.hasOwnProperty('operand'),
|
||||
(trigger) => !('operand' in trigger),
|
||||
);
|
||||
const rangeConditionList = conditionList.filter((condition) => 'operand' in condition && 'value' in condition);
|
||||
const booleanConditionList = conditionList.filter((condition) => 'on' in condition);
|
||||
const thermostatConditionList = conditionList.filter((condition) => 'operand' in condition && 'mode' in condition);
|
||||
|
||||
|
||||
return Endpoint.post(urlAutomation, {}, automation).then(
|
||||
async (automationRes) => {
|
||||
const { id } = automationRes.data;
|
||||
// Introduce the range triggers in the automation
|
||||
const resRangeTriggers = [];
|
||||
for (const t of rangeTriggerList) {
|
||||
const trigger = {
|
||||
automationId: id,
|
||||
|
@ -582,38 +593,83 @@ export const RemoteService = {
|
|||
operator: t.operand,
|
||||
range: t.value,
|
||||
};
|
||||
const resRange = await Endpoint.post(urlRangeTrigger, {}, trigger);
|
||||
automation.triggers.push(resRange.data);
|
||||
resRangeTriggers.push(Endpoint.post(urlRangeTrigger, {}, trigger));
|
||||
}
|
||||
automation.triggers = (await Promise.all(resRangeTriggers)).map((v) => v.data);
|
||||
|
||||
const resBoolTriggers = [];
|
||||
for (const t of booleanTriggerList) {
|
||||
const trigger = {
|
||||
automationId: id,
|
||||
deviceId: t.device,
|
||||
on: t.value,
|
||||
on: t.on,
|
||||
};
|
||||
const resBoolean = await Endpoint.post(
|
||||
resBoolTriggers.push(Endpoint.post(
|
||||
urlBooleanTrigger,
|
||||
{},
|
||||
trigger,
|
||||
);
|
||||
automation.triggers.push(resBoolean.data);
|
||||
console.log('TRIGGERS: ', automation);
|
||||
));
|
||||
}
|
||||
automation.triggers.push(...((await Promise.all(resBoolTriggers)).map((v) => v.data)));
|
||||
|
||||
// Conditions
|
||||
const resRangeConditions = [];
|
||||
for (const t of rangeConditionList) {
|
||||
const condition = {
|
||||
automationId: id,
|
||||
deviceId: t.device,
|
||||
operator: t.operand,
|
||||
range: t.value,
|
||||
};
|
||||
resRangeConditions.push(Endpoint.post(urlRangeCondition, {}, condition));
|
||||
}
|
||||
automation.conditions = (await Promise.all(resRangeConditions)).map((v) => v.data);
|
||||
|
||||
const resBoolConditions = [];
|
||||
for (const t of booleanConditionList) {
|
||||
const condition = {
|
||||
automationId: id,
|
||||
deviceId: t.device,
|
||||
on: t.on,
|
||||
};
|
||||
resBoolConditions.push(Endpoint.post(
|
||||
urlBooleanCondition,
|
||||
{},
|
||||
condition,
|
||||
));
|
||||
}
|
||||
automation.conditions.push(...((await Promise.all(resBoolConditions)).map((v) => v.data)));
|
||||
|
||||
const resThermoConditions = [];
|
||||
for (const t of thermostatConditionList) {
|
||||
const condition = {
|
||||
automationId: id,
|
||||
deviceId: t.device,
|
||||
mode: t.mode,
|
||||
operator: t.operand,
|
||||
};
|
||||
resThermoConditions.push(Endpoint.post(
|
||||
urlThermostatCondition,
|
||||
{},
|
||||
condition,
|
||||
));
|
||||
}
|
||||
automation.conditions.push(...((await Promise.all(resThermoConditions)).map((v) => v.data)));
|
||||
|
||||
const resScenePriorities = [];
|
||||
for (const [priority, sceneId] of order.entries()) {
|
||||
const scenePriority = {
|
||||
automationId: id,
|
||||
priority,
|
||||
sceneId,
|
||||
};
|
||||
const resScenes = await Endpoint.post(
|
||||
resScenePriorities.push(Endpoint.post(
|
||||
urlScenePriority,
|
||||
{},
|
||||
scenePriority,
|
||||
);
|
||||
automation.scenes.push(resScenes.data);
|
||||
));
|
||||
}
|
||||
automation.scenes = (await Promise.all(resScenePriorities)).map((v) => v.data);
|
||||
automation.id = id;
|
||||
dispatch(actions.automationSave(automation));
|
||||
},
|
||||
|
|
|
@ -1613,9 +1613,15 @@
|
|||
"@types/node" "*"
|
||||
|
||||
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
|
||||
<<<<<<< HEAD
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
|
||||
integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==
|
||||
=======
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.2.tgz#79d7a78bad4219f4c03d6557a1c72d9ca6ba62d5"
|
||||
integrity sha512-rsZg7eL+Xcxsxk2XlBt9KcG8nOp9iYdKCOikY9x2RFJCyOdNj4MKPQty0e8oZr29vVAzKXr1BmR+kZauti3o1w==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
|
||||
"@types/istanbul-lib-report@*":
|
||||
version "3.0.0"
|
||||
|
@ -1625,9 +1631,15 @@
|
|||
"@types/istanbul-lib-coverage" "*"
|
||||
|
||||
"@types/istanbul-reports@^1.1.1":
|
||||
<<<<<<< HEAD
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz#7a8cbf6a406f36c8add871625b278eaf0b0d255a"
|
||||
integrity sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==
|
||||
=======
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz#e875cc689e47bce549ec81f3df5e6f6f11cfaeb2"
|
||||
integrity sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
dependencies:
|
||||
"@types/istanbul-lib-coverage" "*"
|
||||
"@types/istanbul-lib-report" "*"
|
||||
|
@ -1643,9 +1655,15 @@
|
|||
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
|
||||
|
||||
"@types/node@*":
|
||||
<<<<<<< HEAD
|
||||
version "13.13.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.5.tgz#96ec3b0afafd64a4ccea9107b75bf8489f0e5765"
|
||||
integrity sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g==
|
||||
=======
|
||||
version "14.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.1.tgz#5d93e0a099cd0acd5ef3d5bde3c086e1f49ff68c"
|
||||
integrity sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
|
||||
"@types/parse-json@^4.0.0":
|
||||
version "4.0.0"
|
||||
|
@ -1725,22 +1743,37 @@
|
|||
"@types/yargs-parser" "*"
|
||||
|
||||
"@types/yargs@^15.0.0":
|
||||
<<<<<<< HEAD
|
||||
version "15.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.4.tgz#7e5d0f8ca25e9d5849f2ea443cf7c402decd8299"
|
||||
integrity sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg==
|
||||
=======
|
||||
version "15.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.5.tgz#947e9a6561483bdee9adffc983e91a6902af8b79"
|
||||
integrity sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
dependencies:
|
||||
"@types/yargs-parser" "*"
|
||||
|
||||
"@typescript-eslint/eslint-plugin@^2.10.0":
|
||||
<<<<<<< HEAD
|
||||
version "2.32.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.32.0.tgz#5d5cc2e00b1d4a4b848cc68bfdd3aede1ef0ad16"
|
||||
integrity sha512-nb1kSUa8cd22hGgxpGdVT6/iyP7IKyrnyZEGYo+tN8iyDdXvXa+nfsX03tJVeFfhbkwR/0CDk910zPbqSflAsg==
|
||||
dependencies:
|
||||
"@typescript-eslint/experimental-utils" "2.32.0"
|
||||
=======
|
||||
version "2.33.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.33.0.tgz#d6c8319d5011b4783bb3d2dadf105d8bdd499bd5"
|
||||
integrity sha512-QV6P32Btu1sCI/kTqjTNI/8OpCYyvlGjW5vD8MpTIg+HGE5S88HtT1G+880M4bXlvXj/NjsJJG0aGcVh0DdbeQ==
|
||||
dependencies:
|
||||
"@typescript-eslint/experimental-utils" "2.33.0"
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
functional-red-black-tree "^1.0.1"
|
||||
regexpp "^3.0.0"
|
||||
tsutils "^3.17.1"
|
||||
|
||||
<<<<<<< HEAD
|
||||
"@typescript-eslint/experimental-utils@2.32.0":
|
||||
version "2.32.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.32.0.tgz#bee7fbe1d21d13a273066d70abc82549d0b7943e"
|
||||
|
@ -1748,10 +1781,20 @@
|
|||
dependencies:
|
||||
"@types/json-schema" "^7.0.3"
|
||||
"@typescript-eslint/typescript-estree" "2.32.0"
|
||||
=======
|
||||
"@typescript-eslint/experimental-utils@2.33.0":
|
||||
version "2.33.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.33.0.tgz#000f1e5f344fbea1323dc91cc174805d75f99a03"
|
||||
integrity sha512-qzPM2AuxtMrRq78LwyZa8Qn6gcY8obkIrBs1ehqmQADwkYzTE1Pb4y2W+U3rE/iFkSWcWHG2LS6MJfj6SmHApg==
|
||||
dependencies:
|
||||
"@types/json-schema" "^7.0.3"
|
||||
"@typescript-eslint/typescript-estree" "2.33.0"
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
eslint-scope "^5.0.0"
|
||||
eslint-utils "^2.0.0"
|
||||
|
||||
"@typescript-eslint/parser@^2.10.0":
|
||||
<<<<<<< HEAD
|
||||
version "2.32.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.32.0.tgz#a1ace8ab1af529580bfb6cc2cd55fd8d8b1e68ab"
|
||||
integrity sha512-swRtH835fUfm2khchiOVNchU3gVNaZNj2pY92QSx4kXan+RzaGNrwIRaCyX8uqzmK0xNPzseaUYHP8CsmrsjFw==
|
||||
|
@ -1765,6 +1808,21 @@
|
|||
version "2.32.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.32.0.tgz#0e4ae2e883557f94039b13ac0ecfcfbb09835b8d"
|
||||
integrity sha512-hQpbWM/Y2iq6jB9FHYJBqa3h1R9IEGodOtajhb261cVHt9cz30AKjXM6WP7LxJdEPPlyJ9rPTZVgBUgZgiyPgw==
|
||||
=======
|
||||
version "2.33.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.33.0.tgz#395c0ef229ebef883608f8632a34f0acf02b9bdd"
|
||||
integrity sha512-AUtmwUUhJoH6yrtxZMHbRUEMsC2G6z5NSxg9KsROOGqNXasM71I8P2NihtumlWTUCRld70vqIZ6Pm4E5PAziEA==
|
||||
dependencies:
|
||||
"@types/eslint-visitor-keys" "^1.0.0"
|
||||
"@typescript-eslint/experimental-utils" "2.33.0"
|
||||
"@typescript-eslint/typescript-estree" "2.33.0"
|
||||
eslint-visitor-keys "^1.1.0"
|
||||
|
||||
"@typescript-eslint/typescript-estree@2.33.0":
|
||||
version "2.33.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.33.0.tgz#33504c050ccafd38f397a645d4e9534d2eccbb5c"
|
||||
integrity sha512-d8rY6/yUxb0+mEwTShCQF2zYQdLlqihukNfG9IUlLYz5y1CH6G/9XYbrxQLq3Z14RNvkCC6oe+OcFlyUpwUbkg==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
dependencies:
|
||||
debug "^4.1.1"
|
||||
eslint-visitor-keys "^1.1.0"
|
||||
|
@ -2960,9 +3018,15 @@ caniuse-api@^3.0.0:
|
|||
lodash.uniq "^4.5.0"
|
||||
|
||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001039, caniuse-lite@^1.0.30001043:
|
||||
<<<<<<< HEAD
|
||||
version "1.0.30001055"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001055.tgz#7b52c3537f7a8c0408aca867e83d2b04268b54cd"
|
||||
integrity sha512-MbwsBmKrBSKIWldfdIagO5OJWZclpJtS4h0Jrk/4HFrXJxTdVdH23Fd+xCiHriVGvYcWyW8mR/CPsYajlH8Iuw==
|
||||
=======
|
||||
version "1.0.30001059"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001059.tgz#7bff0613d94b6ea41cb5c864c966d340f8ae6d34"
|
||||
integrity sha512-oOrc+jPJWooKIA0IrNZ5sYlsXc7NP7KLhNWrSGEJhnfSzDvDJ0zd3i6HXsslExY9bbu+x0FQ5C61LcqmPt7bOQ==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
|
||||
capture-exit@^2.0.0:
|
||||
version "2.0.0"
|
||||
|
@ -4241,9 +4305,15 @@ ee-first@1.1.1:
|
|||
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
|
||||
|
||||
electron-to-chromium@^1.3.378, electron-to-chromium@^1.3.413:
|
||||
<<<<<<< HEAD
|
||||
version "1.3.434"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.434.tgz#a67dcb268e93768e2169399999ccffa4783f048e"
|
||||
integrity sha512-WjzGrE6appXvMyc2kH9Ide7OxsgTuRzag9sjQ5AcbOnbS9ut7P1HzOeEbJFLhr81IR7n2Hlr6qTTSGTXLIX5Pg==
|
||||
=======
|
||||
version "1.3.438"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.438.tgz#56051a9b148842fec813b113e8070ae892a85920"
|
||||
integrity sha512-QKMcpfA/fCOnqFHsZvKr2haQQb3eXkDI17zT+4hHxJJThyN5nShcG6q1VR8vRiE/2GCJM+0p3PzinYknkdsBYg==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
|
||||
elliptic@^6.0.0, elliptic@^6.5.2:
|
||||
version "6.5.2"
|
||||
|
@ -5667,9 +5737,15 @@ html-escaper@^2.0.0:
|
|||
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
|
||||
|
||||
html-minifier-terser@^5.0.1:
|
||||
<<<<<<< HEAD
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/html-minifier-terser/-/html-minifier-terser-5.1.0.tgz#95d3df037f04835e9d1a09d1767c0e361a7de916"
|
||||
integrity sha512-tiYE76O1zunboByeB/nFGwUEb263Z3nkNv6Lz2oLC1s6M36bLKfTrjQ+7ssVfaucVllE+N7hh/FbpbxvnIA+LQ==
|
||||
=======
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz#922e96f1f3bb60832c2634b79884096389b1f054"
|
||||
integrity sha512-ZPr5MNObqnV/T9akshPKbVgyOqLmy+Bxo7juKCfTfnjNniTAMdy4hz21YQqoofMBJD2kdREaqPPdThoR78Tgxg==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
dependencies:
|
||||
camel-case "^4.1.1"
|
||||
clean-css "^4.2.3"
|
||||
|
@ -7588,16 +7664,28 @@ minipass-flush@^1.0.5:
|
|||
minipass "^3.0.0"
|
||||
|
||||
minipass-pipeline@^1.2.2:
|
||||
<<<<<<< HEAD
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/minipass-pipeline/-/minipass-pipeline-1.2.2.tgz#3dcb6bb4a546e32969c7ad710f2c79a86abba93a"
|
||||
integrity sha512-3JS5A2DKhD2g0Gg8x3yamO0pj7YeKGwVlDS90pF++kxptwx/F+B//roxf9SqYil5tQo65bijy+dAuAFZmYOouA==
|
||||
=======
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/minipass-pipeline/-/minipass-pipeline-1.2.3.tgz#55f7839307d74859d6e8ada9c3ebe72cec216a34"
|
||||
integrity sha512-cFOknTvng5vqnwOpDsZTWhNll6Jf8o2x+/diplafmxpuIymAjzoOolZG0VvQf3V2HgqzJNhnuKHYp2BqDgz8IQ==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
dependencies:
|
||||
minipass "^3.0.0"
|
||||
|
||||
minipass@^3.0.0, minipass@^3.1.1:
|
||||
<<<<<<< HEAD
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.1.tgz#7607ce778472a185ad6d89082aa2070f79cedcd5"
|
||||
integrity sha512-UFqVihv6PQgwj8/yTGvl9kPz7xIAY+R5z6XYjRInD3Gk3qx6QGSD6zEcpeG4Dy/lQnv1J6zv8ejV90hyYIKf3w==
|
||||
=======
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.3.tgz#7d42ff1f39635482e15f9cdb53184deebd5815fd"
|
||||
integrity sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
dependencies:
|
||||
yallist "^4.0.0"
|
||||
|
||||
|
@ -10642,9 +10730,15 @@ spdx-exceptions@^2.1.0:
|
|||
integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==
|
||||
|
||||
spdx-expression-parse@^3.0.0:
|
||||
<<<<<<< HEAD
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0"
|
||||
integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==
|
||||
=======
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679"
|
||||
integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
dependencies:
|
||||
spdx-exceptions "^2.1.0"
|
||||
spdx-license-ids "^3.0.0"
|
||||
|
@ -11291,9 +11385,15 @@ ts-pnp@^1.1.2:
|
|||
integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==
|
||||
|
||||
tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0:
|
||||
<<<<<<< HEAD
|
||||
version "1.11.2"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.2.tgz#9c79d83272c9a7aaf166f73915c9667ecdde3cc9"
|
||||
integrity sha512-tTSkux6IGPnUGUd1XAZHcpu85MOkIl5zX49pO+jfsie3eP0B6pyhOlLXm3cAC6T7s+euSDDUUV+Acop5WmtkVg==
|
||||
=======
|
||||
version "1.13.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
|
||||
integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==
|
||||
>>>>>>> 0d03c420ee368026e57f64e749ed248174f66edb
|
||||
|
||||
tsutils@^3.17.1:
|
||||
version "3.17.1"
|
||||
|
|
Loading…
Reference in a new issue