Skip to content

Commit

Permalink
fix(entity): Select correct attribute type value
Browse files Browse the repository at this point in the history
Closes #583
  • Loading branch information
zachowj committed Feb 16, 2022
1 parent 5452743 commit 581992b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/nodes/entity/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { EditorNodeDef, EditorRED, EditorWidgetTypedInputType } from 'node-red';
import * as exposeNode from '../../editor/exposenode';
import ha from '../../editor/ha';
import * as haServer from '../../editor/haserver';
import { HassExposedConfig, HassNodeProperties } from '../../editor/types';
import {
HassExposedConfig,
HassNodeProperties,
HATypedInputTypeOptions,
} from '../../editor/types';

declare const RED: EditorRED;

Expand Down Expand Up @@ -52,7 +56,7 @@ const haConfigOptions = {
],
switch: ['name', 'icon'],
};
const attributeTypes = [
const attributeTypes: HATypedInputTypeOptions = [
'str',
'num',
'bool',
Expand Down Expand Up @@ -171,10 +175,9 @@ const EntityEditor: EditorNodeDef<EntityEditorNodeProperties> = {
.val(data.value);

$value.typedInput({
types: attributeTypes as any,
// @ts-ignore - DefinitelyTyped is wrong typedInput can take a object as a parameter
type: data.valueType,
types: attributeTypes,
});
$value.typedInput('type', data.valueType);
},
})
.editableList('addItems', this.attributes);
Expand Down

0 comments on commit 581992b

Please sign in to comment.