Skip to content

Array in custom characteristic #61

@Julius-Bendt

Description

@Julius-Bendt

Describe Your Problem:
I'm trying to create a custom characteristic that shows an array of string.
I'm using the home+ 6 app, which are able to show custom characteristics.

I've created the characteristic based on this issue: #20 (as linked in the README file)

I'm able get the custom characteristic to show, but only if I'm not using the "array" format

I've tried to lookup how saturation in the lightbulb works, however I could only find the definitions.

Code:

import { Formats, Perms, CharacteristicProps } from 'homebridge';

export = (homebridge) => {
  const Charact = homebridge.hap.Characteristic;

  return class EffectCharacteristic extends Charact {
    public static readonly UUID: string = 'f8d871fa-a67a-43fe-872d-5250f055d17c';
      constructor() {
          
        const options: CharacteristicProps = {
            format: Formats.ARRAY, // UINT16 works
            unit: '',
            validValues: [0,1,2,3,4,5,6,7], // Also tried with strings. Removing this allows the accessory to be shown, but not edited
            perms: [Perms.PAIRED_READ, Perms.NOTIFY],
        }
        
        super('Effect', EffectCharacteristic.UUID, options);
        this.value = 0; // And with a string down here
    }
  };
};

Github repo:
https://github.com/Julius-Bendt/homebridge-hyperion

Logs:
None - no errors thrown

Plugin Config:

{
    "name": "HyperionJub",
    "url": "http://192.168.1.107",
    "port": "8090",
    "priority": 50,
    "platform": "HyperionJub"
}

Screenshots:

image

Environment:

  • Plugin Version:
  • Homebridge Version: 1.6.1
  • Node.js Version: 18.17.1
  • NPM Version: 10.0.0
  • Operating System: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions