PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 44 forks source link

Adds television support #189

Closed sander1988 closed 4 years ago

sander1988 commented 4 years ago

Adds television support for Domoticz SwitchTypeVal 17 devices. I just started testing it in my environment on my iPhone (iOS 13). Please feel free to leave any feedback or questions.

A few notes:

PatchworkBoy commented 4 years ago

Needs rebasing to account for other pulls. Throws error on Fan power state service.

[1/4/2020, 11:06:49 AM] [eDomoticz] Initializing eDomoticz platform...
/usr/local/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:1586
                    this.getCharacteristic(service, Characteristic.On).on('set', this.setPowerState.bind(this)).on('get', this.ferState.bind(this));
                                                                                                                                       ^

TypeError: Cannot read property 'bind' of undefined
    at Object.getServices (/usr/local/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:1586:136)
    at Object.publishServices (/usr/local/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:87:29)
    at Object.eDomoticzAccessory (/usr/local/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:79:10)
    at Object.configureAccessory (/usr/local/lib/node_modules/homebridge-edomoticz/index.js:256:21)
    at Server._configCachedPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:352:24)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:88:8)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
PatchworkBoy commented 4 years ago

Have manually incorporated changes due to required merges as result of a few other pull requests taking out of sync.

Could you re-pull yours from master to bring up to date, and then add instructions on how to use / implement the TV type in readme.md and issue a new pull request please?

sander1988 commented 4 years ago

Needs rebasing to account for other pulls. Throws error on Fan power state service.

[1/4/2020, 11:06:49 AM] [eDomoticz] Initializing eDomoticz platform...
/usr/local/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:1586
                    this.getCharacteristic(service, Characteristic.On).on('set', this.setPowerState.bind(this)).on('get', this.ferState.bind(this));
                                                                                                                                       ^

TypeError: Cannot read property 'bind' of undefined
    at Object.getServices (/usr/local/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:1586:136)
    at Object.publishServices (/usr/local/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:87:29)
    at Object.eDomoticzAccessory (/usr/local/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:79:10)
    at Object.configureAccessory (/usr/local/lib/node_modules/homebridge-edomoticz/index.js:256:21)
    at Server._configCachedPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:352:24)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:88:8)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

Not sure what happened here. I will fix this, pull master and also fix 2 other bugs that are TV related. I will create a new merge request within a couple of weeks.

sander1988 commented 4 years ago

I'm still working on this. There is one last issue I'm trying to fix: The TV input sources work only the first few hours. After some time the televersion devices breaks up into several seperate switches (TV on/off + one for each TV input).

I can't figure out why. Someone else a suggestion why?


It should look like this in Homekit, but it does only for the first few hours.

image0

villmatt commented 4 years ago

@sander1988, I cannot figure out how you mare managing to get sources into your television accessory. I have different Domoticz switches for the different inputs but I can't figure out how to get them into the tv accessory. I would love so much for some help. I have been stuck looking for an answer to this for weeks. Thanks and sorry for bothering you.

sander1988 commented 4 years ago

@sander1988, I cannot figure out how you mare managing to get sources into your television accessory. I have different Domoticz switches for the different inputs but I can't figure out how to get them into the tv accessory. I would love so much for some help. I have been stuck looking for an answer to this for weeks. Thanks and sorry for bothering you.

@villmatt - Please see issue #194 . First it works like in the screenshot above but after a while (hours or days) it breaks into separate switches (the bug of #194). Yesterday I posted another screenshot in #194. This is the issue you mean, right?

villmatt commented 4 years ago

Not at all, for me to get a television accessory working, I need to create a dummy device that is type media player with the image television. With this type I cannot add multiple buttons, but power on and off works as it should based on my event rules.

If I create a dummy device that is switch type selector and image television, the home app says unsupported device.

I am using a HomePod as my home hub that is updated to latest OS. Latest version of Domoticz. Not beta. And latest version of the edomoticz plugin.

As far as what I’m able to do. I can only get a television accessory with no input devices since I cannot create a television device with type selector. (Shows unsupported device)

villmatt commented 4 years ago

@sander1988 This is me having some sort of success with creating a television accessory. I will post another series of images with a brand new dummy accessory using switch type selector and television image.

CBE73B37-7924-4C76-BE92-419A8830B065 74EC6356-EF0F-49F2-B1DE-EE27A4590FAB F25CC40F-4871-4A57-B4BA-07544033EE38

villmatt commented 4 years ago

85853318-76B1-4FB9-87DB-95854C5B1C77 57C507C2-61BA-442E-9747-CD94BD45BD17 9CE20B97-F5D5-4496-A14B-8D222C4D466D

villmatt commented 4 years ago

@sander1988, I managed to figure this out. It is probably my lack of knowledge of Domoticz. Just in case anyone else is stumped on how to implement. This is what I had to do to get a dummy device type television with sources working.

You need 2 devices exposed to HomeKit through Domoticz. One device is type Media Player with Switch Icon being Television. The other device is switch type selector with icon being television.

You can utilise the first device if all you want to do is have a television device in HomeKit and power it on and off, but if you want to have inputs in the menu, you need the second device to feed in the values to the first. I'm not sure how or why it works like this. It is just the only way I've been able to get it to work.

image image image image image

"TV Controller" IS MEANT TO DISPLAY "PROJECTOR INPUTS", I had changed the name in the home app and forgot to change it back for these screenshots

image image
sander1988 commented 4 years ago

@villmatt - Yes you are right. This is how it can be done using virtual devices. FYI: I have built this TV support around the LGTV plugin for Domoticz. That plugin use also a Media Player devices and a separate selector switch for the sources.