I’ve changed a lot of it due to the loss of MQtt access, but the important parts were:
[{"id":"9ccf6e06d122a103","type":"mqtt in","z":"f0b6cd64cdc3f7bc","name":"get tv state","topic":"/remoteapp/mobile/3c:2a:d7:d5:30:64$vidaa_common/platform_service/data/gettvinfo","qos":"2","datatype":"auto-detect","broker":"921f251ebf6fbf2e","nl":false,"rap":true,"rh":0,"inputs":0,"x":160,"y":140,"wires":[["1fbc53f23e21cc57"]]},{"id":"1fbc53f23e21cc57","type":"change","z":"f0b6cd64cdc3f7bc","name":"","rules":[{"t":"move","p":"payload.fake_sleep_state","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"tvstate","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":180,"wires":[["95e1cede9b85424b"]]},{"id":"95e1cede9b85424b","type":"switch","z":"f0b6cd64cdc3f7bc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":330,"y":180,"wires":[["0c72647ea416dc39","e6edf2423d6c4585"],["f987fb2d14e50c95","5080d07b8c6a4b25"],["0c72647ea416dc39"]]},{"id":"35ca5fd39f7495bd","type":"mqtt out","z":"f0b6cd64cdc3f7bc","name":"ping tv","topic":"/remoteapp/tv/platform_service/3c:2a:d7:d5:30:64$vidaa_common/actions/gettvinfo","qos":"1","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"921f251ebf6fbf2e","x":150,"y":100,"wires":[]},{"id":"921f251ebf6fbf2e","type":"mqtt-broker","name":"","broker":"192.168.10.186","port":"36669","tls":"471adc02eb596bae","clientid":"","autoConnect":true,"usetls":true,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":"60"},{"id":"471adc02eb596bae","type":"tls-config","name":"hisense TV","cert":"","key":"","ca":"","certname":"rcm_certchain_pem.cer","keyname":"rcm_pem_privkey.pkcs8","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""}]
Those are the pinger that you can hit on a timer, to force the MQtt server to update, not sure if this is necessary, but Its there, then the “fake_sleep” is checked, this tells us if the TV is awake or in standby. the MQTT server has to be set up with the right certificates, then if you notice in the config for the nodes there is what looks like a MAC address, that was captured from MQTT explorer and the remotenow app on a phone, that phones MAC address is then authorised to control the TV, we use that mac address in the MQTT topic to properly send commands to the TV, spoofing the app.
The MQtt server is shut off after a period of time, so sending on/off commands is unreliable, so to get arount that, I use a status node to detect if the MQTT failed, then that sets teh TVs state in my flow to OFF so that the next on command can be sent via IR to wake the system up again.
The status node and a switch node to detect if the status is anything other than green:
[{"id":"03948b196ecb0e52","type":"status","z":"f0b6cd64cdc3f7bc","name":"","scope":["9ccf6e06d122a103"],"x":100,"y":260,"wires":[["418d79611ff58a30"]]},{"id":"418d79611ff58a30","type":"switch","z":"f0b6cd64cdc3f7bc","name":"","property":"status.fill","propertyType":"msg","rules":[{"t":"neq","v":"\"green\"","vt":"str"},{"t":"eq","v":"\"green\"","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":230,"y":260,"wires":[["e6edf2423d6c4585","0c72647ea416dc39"],[]]}]
I hooked all of this into a mess of switch nodes and some function nodes to determine whether the TV is on, off or in standby and send the right on/off commands as necessary.
This uses the nodered integration within HACS to let me have on/off buttons in lovelace that control the TV.