mitch7391 / cmd4-HisenseTV

Shell script to integrate Hisense TVs using the RemoteNOW app with Homebridge through the homebridge-cmd4 plug-in.
5 stars 1 forks source link

TLS Error in Homebridge #3

Closed ryanshand closed 3 years ago

ryanshand commented 3 years ago

I'm having some trouble setting an input and getting the channel buttons when I set up my homebridge. The HisenseTV is added to HOME app and I can see the inputs TV, Netflix, HDMI1, HDMI2 etc. however when i change the inputs on the HOME app on my phone, the TV does not respond.

Describe Your Problem: I have added the accessory to Homebridge CMD4 per the instructions. I have successfully got the TV to appear in my iOS Home app - so the MAC and IP setings are correct. I can connect to the TV using MQTT explorer.

However it appears that not all functions are working - specifically there appears to be a TLS error when running the ActiveIdentifier function - I am not familiar with mosquitto_sub command to know why there is a TLS error, but I can confirm the certs are correct as I can connect manually to the television via MQTT explorer using the certs.

the error seems to relate to this, but I don't know what in the shell script it refers to

getValue: accTypeEnumIndex:( 4 )-"ActiveIdentifier"

[Link to Logs:]()

Paste of Logs:

[5/4/2021, 3:42:48 PM] [Cmd4] Doing Poll of index:3 characteristic:Active for:Hisense timeout=3000 interval=5000
[5/4/2021, 3:42:48 PM] [Cmd4] getValue: accTypeEnumIndex:( 3 )-"Active" function for: Hisense cmd: bash /home/pi/HisenseTV.sh Get 'Hisense' 'Active'
[5/4/2021, 3:42:48 PM] [Cmd4] getValue: Active function for: Hisense returned: 1
[5/4/2021, 3:42:48 PM] [Cmd4] characteristicPolling Updating Hisense Active 1
[5/4/2021, 3:42:51 PM] [Cmd4] Doing Poll of index:4 characteristic:ActiveIdentifier for:Hisense timeout=3000 interval=5000
[5/4/2021, 3:42:51 PM] [Cmd4] getValue: accTypeEnumIndex:( 4 )-"ActiveIdentifier" function for: Hisense cmd: bash /home/pi/HisenseTV.sh Get 'Hisense' 'ActiveIdentifier'
[5/4/2021, 3:42:51 PM] [Cmd4] getValue: ActiveIdentifier function for Hisense streamed to stderr: Error: A TLS error occurred.

[5/4/2021, 3:42:52 PM] [Cmd4] Doing Poll of index:3 characteristic:Active for:My_TelevisionSpeaker timeout=3000 interval=50000
[5/4/2021, 3:42:52 PM] [Cmd4] getValue: accTypeEnumIndex:( 3 )-"Active" function for: My_TelevisionSpeaker cmd: bash /home/pi/HisenseTV.sh Get 'My_TelevisionSpeaker' 'Active'
[5/4/2021, 3:42:52 PM] [Cmd4] getValue: Active function for: My_TelevisionSpeaker returned: 1
[5/4/2021, 3:42:52 PM] [Cmd4] characteristicPolling Updating My_TelevisionSpeaker Active 1
[5/4/2021, 3:42:53 PM] [Cmd4] Doing Poll of index:3 characteristic:Active for:Hisense timeout=3000 interval=5000
[5/4/2021, 3:42:53 PM] [Cmd4] getValue: accTypeEnumIndex:( 3 )-"Active" function for: Hisense cmd: bash /home/pi/HisenseTV.sh Get 'Hisense' 'Active'
[5/4/2021, 3:42:53 PM] [Cmd4] getValue: Active function for: Hisense returned: 1
[5/4/2021, 3:42:53 PM] [Cmd4] characteristicPolling Updating Hisense Active 1
[5/4/2021, 3:42:55 PM] [Cmd4] Doing Poll of index:214 characteristic:VolumeSelector for:My_TelevisionSpeaker timeout=3000 interval=50000
[5/4/2021, 3:42:55 PM] [Cmd4] getValue: accTypeEnumIndex:( 214 )-"VolumeSelector" function for: My_TelevisionSpeaker cmd: bash /home/pi/HisenseTV.sh Get 'My_TelevisionSpeaker' 'VolumeSelector'
[5/4/2021, 3:42:56 PM] [Cmd4] Doing Poll of index:4 characteristic:ActiveIdentifier for:Hisense timeout=3000 interval=5000
[5/4/2021, 3:42:56 PM] [Cmd4] getValue: accTypeEnumIndex:( 4 )-"ActiveIdentifier" function for: Hisense cmd: bash /home/pi/HisenseTV.sh Get 'Hisense' 'ActiveIdentifier'
[5/4/2021, 3:42:56 PM] [Cmd4] getValue: ActiveIdentifier function for Hisense streamed to stderr: Error: A TLS error occurred.

Cmd4 Config:

{
    "platform": "Cmd4",
    "name": "Cmd4",
    "Cmd4_Mode": "FullyPolled",
    "statusMsg": true,
    "outputConstants": false,
    "restartRecover": false,
    "accessories": [
        {
            "type": "Switch",
            "displayName": "My_Switch",
            "on": "FALSE",
            "name": "Master",
            "Manufacturer": "Advantage Air Australia",
            "Model": "e-zone",
            "SerialNumber": "Fujitsu e-zone2",
            "stateChangeResponseTime": 1,
            "state_cmd": "bash /home/pi/zones.sh",
            "state_cmd_suffix": "z01"
        },
        {
            "type": "Switch",
            "displayName": "My_Switch",
            "on": "FALSE",
            "name": "Kids Room",
            "Manufacturer": "Advantage Air Australia",
            "Model": "e-zone",
            "SerialNumber": "Fujitsu e-zone2",
            "stateChangeResponseTime": 1,
            "state_cmd": "bash /home/pi/zones.sh",
            "state_cmd_suffix": "z02"
        },
        {
            "type": "Switch",
            "displayName": "My_Switch",
            "on": "FALSE",
            "name": "Office & Gym",
            "Manufacturer": "Advantage Air Australia",
            "Model": "e-zone",
            "SerialNumber": "Fujitsu e-zone2",
            "stateChangeResponseTime": 1,
            "state_cmd": "bash /home/pi/zones.sh",
            "state_cmd_suffix": "z03"
        },
        {
            "type": "Switch",
            "displayName": "My_Switch",
            "on": "FALSE",
            "name": "Living",
            "Manufacturer": "Advantage Air Australia",
            "Model": "e-zone",
            "SerialNumber": "Fujitsu e-zone2",
            "stateChangeResponseTime": 1,
            "state_cmd": "bash /home/pi/zones.sh",
            "state_cmd_suffix": "z04"
        },
        {
            "type": "Fan",
            "on": "FALSE",
            "name": "Fan",
            "Manufacturer": "Advantage Air Australia",
            "Model": "e-zone",
            "SerialNumber": "Fujitsu e-zone2",
            "stateChangeResponseTime": 1,
            "state_cmd": "bash /home/pi/ezone.sh"
        },
        {
            "type": "Thermostat",
            "displayName": "My_Thermostat",
            "currentHeatingCoolingState": "OFF",
            "targetHeatingCoolingState": "OFF",
            "currentTemperature": 50,
            "targetTemperature": 37,
            "temperatureDisplayUnits": "CELCIUS",
            "name": "My_Thermostat",
            "Manufacturer": "Advantage Air Australia",
            "Model": "e-zone",
            "SerialNumber": "Fujitsu e-zone2",
            "polling": [
                {
                    "characteristic": "currentHeatingCoolingState",
                    "interval": 60,
                    "timeout": 8000
                },
                {
                    "characteristic": "currentTemperature",
                    "interval": 60,
                    "timeout": 8000
                },
                {
                    "characteristic": "targetTemperature",
                    "interval": 60,
                    "timeout": 8000
                }
            ],
            "stateChangeResponseTime": 1,
            "state_cmd": "bash /home/pi/ezone.sh"
        },
        {
            "type": "Television",
            "category": "TELEVISION",
            "publishExternally": true,
            "name": "Hisense",
            "active": "INACTIVE",
            "activeIdentifier": 0,
            "configuredName": "Hisense",
            "sleepDiscoveryMode": "ALWAYS_DISCOVERABLE",
            "accessories": [
                {
                    "type": "televisionSpeaker",
                    "displayName": "My_TelevisionSpeaker",
                    "name": "My_TelevisionSpeaker",
                    "active": "INACTIVE",
                    "mute": "FALSE",
                    "volumeSelector": 1,
                    "volumeControlType": "ABSOLUTE",
                    "state_cmd": "bash /home/pi/HisenseTV.sh",
                    "polling": [
                        {
                            "characteristic": "active",
                            "interval": 50,
                            "timeout": 3000
                        },
                        {
                            "characteristic": "volumeSelector",
                            "interval": 50,
                            "timeout": 3000
                        }
                    ]
                }
            ],
            "linkedTypes": [
                {
                    "type": "InputSource",
                    "displayName": "TV",
                    "configuredName": "TV",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "TUNER",
                    "isConfigured": "CONFIGURED",
                    "identifier": 0,
                    "targetVisibilityState": "SHOWN",
                    "name": "TV"
                },
                {
                    "type": "InputSource",
                    "displayName": "HDMI1",
                    "configuredName": "HDMI1",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "HDMI",
                    "isConfigured": "CONFIGURED",
                    "identifier": 1,
                    "targetVisibilityState": "SHOWN",
                    "name": "HDMI1"
                },
                {
                    "type": "InputSource",
                    "displayName": "HDMI2",
                    "configuredName": "HDMI2",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "HDMI",
                    "isConfigured": "CONFIGURED",
                    "identifier": 2,
                    "targetVisibilityState": "SHOWN",
                    "name": "HDMI2"
                },
                {
                    "type": "InputSource",
                    "displayName": "HDMI3",
                    "configuredName": "HDMI3",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "HDMI",
                    "isConfigured": "CONFIGURED",
                    "identifier": 3,
                    "targetVisibilityState": "SHOWN",
                    "name": "HDMI3"
                },
                {
                    "type": "InputSource",
                    "displayName": "HDMI4",
                    "configuredName": "HDMI4",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "HDMI",
                    "isConfigured": "CONFIGURED",
                    "identifier": 4,
                    "targetVisibilityState": "SHOWN",
                    "name": "HDMI4"
                },
                {
                    "type": "InputSource",
                    "displayName": "AV",
                    "configuredName": "AV",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "COMPOSITE_VIDEO",
                    "isConfigured": "CONFIGURED",
                    "identifier": 5,
                    "targetVisibilityState": "SHOWN",
                    "name": "AV"
                },
                {
                    "type": "InputSource",
                    "displayName": "Netflix",
                    "configuredName": "Netflix",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 6,
                    "targetVisibilityState": "SHOWN",
                    "name": "Netflix"
                },
                {
                    "type": "InputSource",
                    "displayName": "Prime",
                    "configuredName": "Prime",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 7,
                    "targetVisibilityState": "SHOWN",
                    "name": "Prime"
                },
                {
                    "type": "InputSource",
                    "displayName": "YouTube",
                    "configuredName": "YouTube",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 8,
                    "targetVisibilityState": "SHOWN",
                    "name": "Youtube"
                },
                {
                    "type": "InputSource",
                    "displayName": "Foxtel",
                    "configuredName": "Foxtel",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 9,
                    "targetVisibilityState": "SHOWN",
                    "name": "Foxtel"
                },
                {
                    "type": "InputSource",
                    "displayName": "Stan",
                    "configuredName": "Stan",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 10,
                    "targetVisibilityState": "SHOWN",
                    "name": "Stan"
                },
                {
                    "type": "InputSource",
                    "displayName": "Plex",
                    "configuredName": "Plex",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 11,
                    "targetVisibilityState": "SHOWN",
                    "name": "Plex"
                },
                {
                    "type": "InputSource",
                    "displayName": "ABCiview",
                    "configuredName": "ABCiview",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 12,
                    "targetVisibilityState": "SHOWN",
                    "name": "ABCiview"
                },
                {
                    "type": "InputSource",
                    "displayName": "YoutubeKids",
                    "configuredName": "YoutubeKids",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 13,
                    "targetVisibilityState": "SHOWN",
                    "name": "YoutubeKids"
                },
                {
                    "type": "InputSource",
                    "displayName": "SBSONDEMAND",
                    "configuredName": "SBSONDEMAND",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 14,
                    "targetVisibilityState": "SHOWN",
                    "name": "SBSONDEMAND"
                },
                {
                    "type": "InputSource",
                    "displayName": "AppsNow",
                    "configuredName": "AppsNow",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 15,
                    "targetVisibilityState": "SHOWN",
                    "name": "AppsNow"
                },
                {
                    "type": "InputSource",
                    "displayName": "KidoodleTV",
                    "configuredName": "KidoodleTV",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 16,
                    "targetVisibilityState": "SHOWN",
                    "name": "KidoodleTV"
                },
                {
                    "type": "InputSource",
                    "displayName": "GameCenter",
                    "configuredName": "GameCenter",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 17,
                    "targetVisibilityState": "SHOWN",
                    "name": "GameCenter"
                },
                {
                    "type": "InputSource",
                    "displayName": "ToonGoggles",
                    "configuredName": "ToonGoggles",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 18,
                    "targetVisibilityState": "SHOWN",
                    "name": "ToonGoggles"
                },
                {
                    "type": "InputSource",
                    "displayName": "YuppTV",
                    "configuredName": "YuppTV",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 19,
                    "targetVisibilityState": "SHOWN",
                    "name": "YuppTV"
                },
                {
                    "type": "InputSource",
                    "displayName": "AccuWeather",
                    "configuredName": "AccuWeather",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 20,
                    "targetVisibilityState": "SHOWN",
                    "name": "AccuWeather"
                },
                {
                    "type": "InputSource",
                    "displayName": "TVBrowser",
                    "configuredName": "TVBrowser",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 21,
                    "targetVisibilityState": "SHOWN",
                    "name": "TVBrowser"
                },
                {
                    "type": "InputSource",
                    "displayName": "SHOWMAX",
                    "configuredName": "SHOWMAX",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 22,
                    "targetVisibilityState": "SHOWN",
                    "name": "SHOWMAX"
                },
                {
                    "type": "InputSource",
                    "displayName": "MiguTV",
                    "configuredName": "MiguTV",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 23,
                    "targetVisibilityState": "SHOWN",
                    "name": "MiguTV"
                },
                {
                    "type": "InputSource",
                    "displayName": "NiHaoTV",
                    "configuredName": "NiHaoTV",
                    "currentVisibilityState": "SHOWN",
                    "inputSourceType": "APPLICATION",
                    "isConfigured": "CONFIGURED",
                    "identifier": 24,
                    "targetVisibilityState": "SHOWN",
                    "name": "NiHaoTV"
                }
            ],
            "remoteKey": "SELECT",
            "polling": [
                {
                    "characteristic": "active",
                    "interval": 5,
                    "timeout": 3000
                },
                {
                    "characteristic": "activeIdentifier",
                    "interval": 5,
                    "timeout": 3000
                }
            ],
            "stateChangeResponseTime": 1,
            "state_cmd": "bash /home/pi/HisenseTV.sh"
        }
    ]
}

Screenshots: image

Environment:

HisenseTV.txt

mitch7391 commented 3 years ago

Hey @ryanshand I was confused when I saw the E-zone config for a second and worried I uploaded the wrong config to this! Awesome to see you trying to use both of my repos :)

I am away from home until tomorrow night, but hopefully we can get something going for you. First off what model of Hisense TV is it and do you know which version of VIDAA it uses?

A TLS issue sounds like an encryption issue, the use of insecure mode and the cert in my commands should get us around this… Can I get you to try the following command from your terminal?

mosquitto_pub --cafile  CERT_LOCATION --insecure -v -h IP_ADDRESS -p 36669 -P multimqttservice -u hisenseservice -t "/remoteapp/tv/ui_service/REMOTENOW_MAC$normal/actions/changesource" -m '{"sourceid":"4","sourcename":"HDMI1"}'

Just replace CERT_LOCATION, IP_ADDRESS and REMOTENOW_MAC with what you have them set at in your HisenseTV.sh. This command should change your TV input to HDMI; if it does not then we can try fault find from there.

ryanshand commented 3 years ago

the Aircon plugin is wicked, total life-saver. Although I have a MyAir5 system from 2016, and no temp sensors - but the way HomeKit works, I need to run the config with the temp sensor in order to set a specific desired temp and cool / heat mode - but the app always shows 0 degrees because there's no sensor. I'm probably gonna pony up the $150 to buy one just to fix that annoying display haha. Buy yeah you did a wicked job on that, thanks!

So I did bit of research into the mosquitto_ commands and found this has the same issue that @MrAus

so for my TV, the 70S5, software version V0000.01.00T.L0305 you need to pass in some certificates - I have attached them here

rcm_pem_privkey.zip

put them somewhere on your box, and then the command changes to below - this works!

I have attached my fully working solution HisenseTV.zip

mosquitto_pub --cert /home/pi/Hisensecerts/rcm_certchain_pem.cer --key /home/pi/Hisensecerts/rcm_pem_privkey.pkcs8 --insecure -h 192.168.1.32 -p 36669 -P multimqttservice -u hisenseservice -t "/remoteapp/tv/ui_service/3D:81:F2:B6:08:B0$normal/actions/changesource" -m '{"sourceid":"0","sourcename":"TV"}' -d --cafile /home/pi/hisense.crt

ryanshand commented 3 years ago

Actually just a quick question. I can now fully change inputs, am I meant to be able to change channels on live Tv?

all I see is this

5721E592-929B-4B5F-B303-E2709172824F

mitch7391 commented 3 years ago

I am glad to hear you love the air con shell script :)

I need to run the config with the temp sensor in order to set a specific desired temp and cool / heat mode - but the app always shows 0 degrees because there's no sensor.

I am pretty sure you should be able to use the ‘no temp sensor’ version and set the state or temps without a temp sensor; please let me know there is an issue there that I need to look into! Or is this an issue with how the MyAir app displays it on the actual app? To be honest I didn’t have the temp sensors at first and then shelled out for the lot; they do deals on them at certain points of the year so keep an eye out for that.

I have attached my fully working solution

Interesting, so for your model you actually have a slightly different command? By requiring this cert chain and private key. Good on you for finding this out, not a lot of people do their own googling! I can’t open your zip file on my phone but will take a look when I get home tomorrow.

I can now fully change inputs, am I meant to be able to change channels on live Tv?

This is I believe a limitation of Apple. From the Home app you can not change channels. It won’t let me connect to this away from home, but if you check the ‘remote’ in your control centre (add it from settings if you don’t); then you can control more of the TV from here.

2C55036E-A20D-4405-A84C-3119AF546E93

I still don’t think it gives you a number keypad but I think you can you the up and down key to change the channel (not ideal I know, but once again Apple limitations).

ryanshand commented 3 years ago

Ah ok gotcha. Bummer, the remote doesn't have channel up and down. I did a bit of a hacky thing as an experiment and made an "input" pass in keypresses - so I can change the "input" using Siri/shortcut and it will change the station - well, it will press 7 and then 0 so if i'm on TV, it will work.

just something i'm messing with.

#Channel7 24 ) mosquitto_pub --cafile $certPath --cert /home/pi/Hisensecerts/rcm_certchain_pem.cer --key /home/pi/Hisensecerts/rcm_pem_privkey.pkcs8 --insecure -h $ip -p 36669 -P multimqttservice -u hisenseservice -t "/remoteapp/tv/remote_service/"$pairedMAC"$normal/actions/sendkey" -m "KEY_7" mosquitto_pub --cafile $certPath --cert /home/pi/Hisensecerts/rcm_certchain_pem.cer --key /home/pi/Hisensecerts/rcm_pem_privkey.pkcs8 --insecure -h $ip -p 36669 -P multimqttservice -u hisenseservice -t "/remoteapp/tv/remote_service/"$pairedMAC"$normal/actions/sendkey" -m "KEY_0"

mitch7391 commented 3 years ago

I like what you are experimenting with! You could also create Switch accessories to act as your channels (would have to make a heap of them); just take a look at how my zones.sh from my ezone repo for an example.

Personally all I ever use my TV accessory for is the on/off function through Siri but hated not seeing a TV in my home; then this became about making the fully functioning TV accessory for everyone else. Sometimes I change the input through the Home app when the remote is out of reach as my phone is always on me lol hopefully Apple up their game with a lot of their accessory services across the board in the coming years.

ryanshand commented 3 years ago

Ah that’s a cool idea, I don’t mind the idea of using switches. I gave up my developer license because I’m a cheapskate so I don’t have access to the HomeKit SDK. Might have to bite the bullet and sign up again

mitch7391 commented 3 years ago

There would be a trick to it with that approach as you would need to use the state_cmd for each switch in your config to define each one and have it set to what ever the mosquitto command would be (the equivalent of "KEY_POWER"); if you get what I mean. The switch shell script part would be nice and simple.

mitch7391 commented 3 years ago

Also what is HomeKit SDK? I’m still pretty new to all this stuff!

ryanshand commented 3 years ago

Also what is HomeKit SDK? I’m still pretty new to all this stuff!

I ended up just reading a bunch of the doco on Homebridge and its limitations regarding RemoteKey. It's kind of a pain in the arse, it doesnt support volume control, channel control or other functions that RemoteNOW does. That's not your fault or anything I just mean to say it's a limitation.

I've got my setup pretty much exactly the way I want it now, so I'm going to sit on it for a while. For what it's worth, I'll share my set up with you.

After some dicking around using MQTT Explorer monitoring API calls, while using RemoteNOW on my phone, I found that RemoteNOW can set the TV to a specific TV Station - regardless of what Input is currently shown, OR if the TV is off.

Use case: TV is powered off (standby) - you can go into the "favourites" part of RemoteNOW app, press channel 10, and the TV will power on, and show channel 10 - even if it was on HDMI1 when it was on standby.

It does this using the changechannel call.

/remoteapp/tv/ui_service/$normal/actions/changechannel and passing in channel_param

you get the list of available channels from the TV directly using MQTT - I have attached mine, not sure if they're specific to each TV or static - but a sample is below

ChannelList.txt

{ "list_para": "sl3d54bfff-ba0d-4f22-9cfd-b2686cd5cc4d", "list_name": "Antenna", "list": [{ "channel_num": "1", "channel_name": "10 HD", "channel_param": "1#chf9037e9a-894e-4a08-8b9a-32f686320f23#sl3d54bfff-ba0d-4f22-9cfd-b2686cd5cc4d#4" },

so an example API call to change to channel 10 for my TV is

#Channel10 23 ) mosquitto_pub --cafile $certPath --cert /home/pi/Hisensecerts/rcm_certchain_pem.cer --key /home/pi/Hisensecerts/rcm_pem_privkey.pkcs8 --insecure -h $ip -p 36669 -P multimqttservice -u hisenseservice -t "/remoteapp/tv/ui_service/3D:81:F2:B6:08:B0$normal/actions/changechannel" -m '{"channel_param" : "1#chf9037e9a-894e-4a08-8b9a-32f686320f23#sl3d54bfff-ba0d-4f22-9cfd-b2686cd5cc4d#4"}' ;;

Now, because RemoteKey is limited - I decided I didn't need all of the TV inputs you pull in (e.g. I don't need AccuWeather, TV browser, Foxtel etc - so I hijacked those and just replaced the commands with ones to do the following:

Change to Channel 7 Change to Channel 9 Change to Channel 10 Mute the TV

In Home app on my phone, it presents as below.

image

Using the Shortcuts app, I then create shortcuts to do the actions.

The shortcut is: Control My Home

I then Google Image searched the logos for each station, and added the shortcut to my home screen of my phone. I can now also say "Hey Siri, Channel 7" and Siri will run the shortcut, from my Apple Watch, HomePod or iPhone.

image

image

So now I have pretty much full control via voice or device.

I don't typically watch any other stations like ABC, SBS etc so I didn't bother doing the others, but hopefully this gives you some ideas if you want to do something to cover all bases.

I'm getting a bit of pressure from the missus to get off the computer, so need to park this.

I've attached my shell script, my Homebridge config file, the certificates and the channel list. I also parametized the certificate location so you can dump them anywhere and reference it without having to update 46 lines.

Cheers

Ryan ChannelList.zip

mitch7391 commented 3 years ago

It's kind of a pain in the arse, it doesnt support volume control, channel control or other functions that RemoteNOW does.

Yeah like I said it is limited thanks to Apple and hopefully they will improve it in the future.

After some dicking around using MQTT Explorer monitoring API calls, while using RemoteNOW on my phone, I found that RemoteNOW can set the TV to a specific TV Station - regardless of what Input is currently shown, OR if the TV is off.

That is pretty much how I created all of this; it’s really annoying messing around with it all to be honest and probably had a bit to do with why I put off making the full published version I put online for a few months; versus the simpler implementation I use myself (my inputs are just TV and HDMI1) and the remote through the control centre (as limited as it is). I really like what you have put together and how you have implanted it; nice job!

I'm getting a bit of pressure from the missus to get off the computer, so need to park this.

I also get a bit of this and completely understand. My wife has probably been more patient than she has had to be through the whole e-zone and hisense work lol I have been pretty flat out lately, but mean to have a good look over your work and can add it up here on the repo to help anyone else who has the same model as you (I will make sure to credit you of course).

I’ll close this out for now seen as everything is working. And if you have any ideas or troubles here or with your ezone; just reach out and I’ll be happy to help or brain storm. Been a pleasure chatting with you Ryan!