cflurin / homebridge-mqtt

Homebridge-mqtt is a Plugin for Homebridge.
Apache License 2.0
229 stars 39 forks source link

Implementing Television #101

Closed bakman2 closed 4 years ago

bakman2 commented 4 years ago

I am able to add a Television accessory and can turn it on/off. I am able to add InputSource(s) as services to the Television, but when I do this the Television icon disappears.

Do you have some guidance on how to implement the inputSource(Types) with homebridge-mqtt ? Is this even possible ? (I am using node-red).

Screenshot 2020-04-12 at 12 06 38

Screenshot 2020-04-12 at 12 07 24

cflurin commented 4 years ago

Hi,

I am able to add a Television accessory and can turn it on/off.

How did you add it?

Topic: ? Payload: ?

Note: please copy the JSON message, do not use images.

bakman2 commented 4 years ago

This is what I inject from a function node:

a = "homebridge/to/add"
s = "homebridge/to/add/service"

// television
payload = {}

payload.name = "tv"
payload.service_name = "Panasonic"
payload.service = "Television"

c = {}
c.ConfiguredName = "Panasonic"
c.SleepDiscoveryMode = 1
c.Brightness = 30
c.PowerModeSelection = 0 
c.RemoteKey = { "minValue": 0, "maxValue": 16}

payload.Characteristics = c

node.send({topic:a, payload})

// add as services:

payload = {}

payload.name = "tv"
payload.service_name = "Apple TV"
payload.service = "InputSource"
payload.Identifier = 1

c = {}
c.ConfiguredName = "Apple TV"
c.InputSourceType = 3
c.IsConfigured = 1
c.CurrentVisibilityState = 0
c.TargetVisibilityState = 0

payload.Characteristics = c

node.send({topic:s, payload})

payload = {}

payload.name = "tv"
payload.service_name = "Plex"
payload.service = "InputSource"
payload.Identifier = 2

c = {}
c.ConfiguredName = "Plex"
c.InputSourceType = 3
c.IsConfigured = 1
c.CurrentVisibilityState = 0
c.TargetVisibilityState = 0

payload.Characteristics = c

node.send({topic:s, payload})

(this is all based on the hap nodejs, trying to reverse engineer the correct way to describe the characteristics.)

cflurin commented 4 years ago

As far as I know there is no Television service.

See: https://github.com/homebridge/HAP-NodeJS/blob/master/src/lib/gen/HomeKit.ts

The services in that file HomeKit.ts are the only services supported.

bakman2 commented 4 years ago

There are separate files for television (among others), they do seem to work as the screenshot above shows.

https://github.com/homebridge/HAP-NodeJS/tree/master/src/lib/gen

cflurin commented 4 years ago

Okey, I have to investigate, never used these files.

cflurin commented 4 years ago

I have tried to add the services without success. Just now I'm working on other projects, maybe you can get help from the homebridge team or have a look at other tv-plugins.

bakman2 commented 4 years ago

I managed to get it working with homebridge, but i'm not impressed so I will give up on it ;)