Motorized Retractable TV Mount [Video]

Here is my slow and anti-climactic motorized TV mount hooked up to HA using the RM Mini Remote and some code to send commands through AppDaemon.

Here is a demo video (partially sped up the video because the motor is slow for safety reasons, you can tell by the audio):

Here is the APPDAEMON code i used to control it up and down (I very much welcome comments on improving my coding, even minor nitpicking. thank you):

import appdaemon.plugins.hass.hassapi as hass
import datetime
import time

#
# Send command to stop the motor then lift/drop the tv mount
#

class TVDrop(hass.Hass):

  def initialize(self):
    self.remote_entity_id = "remote.broadlink"
    self.learned_cmd_device_name = "lift"
    self.mediaplayer_entity_id = "media_player.bedroom_samsung_tv"
    self.runin_handle = None
    
    
    self.listen_state(self.LiftTV, "input_boolean.lift", new = "off", old = "on")
    self.listen_state(self.DropTV, "input_boolean.lift", new = "on", old = "off")

  def LiftTV(self, entity, attribute, old, new, kwargs):
    remote_id = self.remote_entity_id 
    device_name = self.learned_cmd_device_name 
    TV_ID = self.mediaplayer_entity_id 
    desired_state = "off"
    
    self.log("Step 0: <" + "LiftTV CALLED" + ">")
    self.log("Step 1: <Turn {} TV>".format(desired_state))
    self.TV_OFF_ON(remote_id,device_name,TV_ID,desired_state)
    self.log("Step 1: <" + "SEND *STOP* TV COMMAND" + ">")
    self.remoteCommandSTOP(remote_id,device_name)
    self.log("Step 2: <" + "SEND *UP* TV COMMAND" + ">")
    self.remoteCommandUP(remote_id,device_name)
    
  def DropTV(self, entity, attribute, old, new, kwargs):
     
    remote_id = self.remote_entity_id 
    device_name = self.learned_cmd_device_name 
    TV_ID = self.mediaplayer_entity_id 
    desired_state = "on"
    
    self.log("Step 0: <" + "DropTV CALLED" + ">")
    self.log("Step 1: <" + "SEND *STOP* TV COMMAND" + ">")
    self.remoteCommandSTOP(remote_id,device_name)
    self.log("Step 2: <" + "SEND *DOWN* TV COMMAND" + ">")
    self.remoteCommandDOWN(remote_id,device_name)
    self.log("Step 1: <Turn {} TV>".format(desired_state))
    self.TV_OFF_ON(remote_id,device_name,TV_ID,desired_state)


  def remoteCommandSTOP(self,remote_id,device_name):
    '''     entity_id: remote.broadlink
            device: lift
            command: STOP
            num_repeats: 5
            delay_secs: 0.75
            hold_secs: 2.5    '''
            
    repeatCommand = 5
    delay = 0.75
    hold_s = 2.5
    cmd = "STOP"
    self.call_service("remote/send_command", entity_id = remote_id, device = device_name, command = cmd, num_repeats = repeatCommand, delay_secs = delay, hold_secs = hold_s)
    
  def remoteCommandUP(self,remote_id,device_name):
    repeatCommand = 5
    delay = 0.75
    hold_s = 2.5
    cmd = "UP"
    self.call_service("remote/send_command", entity_id = remote_id, device = device_name, command = cmd, num_repeats = repeatCommand, delay_secs = delay, hold_secs = hold_s)
    
  def remoteCommandDOWN(self,remote_id,device_name):
    repeatCommand = 5
    delay = 0.75
    hold_s = 2.5
    cmd = "DOWN"
    self.call_service("remote/send_command", entity_id = remote_id, device = device_name, command = cmd, num_repeats = repeatCommand, delay_secs = delay, hold_secs = hold_s)
    
  def TV_OFF_ON(self,remote_id,device_name,TV_ID,desired_state):
    self.log("------ TV ON/OFF TEMPORARELY DISABLED -----")
    return
    #get state of TV
    state = self.get_state(TV_ID)
    #set delay before retring IR signal
    run_in_s = 10
    #Create a log msg for debugging
    self.log("<><> The state of [{}] is [{}], we want it [{}]".format(TV_ID,state,desired_state))
    #check if tv is in the desired on/off state
    if state == desired_state:
        return
    else: #if not in the desired state, send the IR signal to power on/off
        self.remoteCommandTVPOWER(remote_id,device_name)
        #check if tv is in the desired on/off state [AGAIN]
        if self.run_in(self.get_state(TV_ID),2) == desired_state:
            return
        else:
            #Call function again if still not off
            self.log("TV did not return derired state ({}), trying again in {}".format(desired_state,run_in_s))
            self.run_in(self.TV_OFF_ON(remote_id,device_name,TV_ID,desired_state),run_in_s)
 
  def remoteCommandTVPOWER(self,remote_id,device_name):
    self.log("Sending power IR signal to {}".format(device_name))
    repeatCommand = 1
    delay = 0.2
    hold_s = 1
    cmd = "power_on1"
    device_name = "television"
    self.call_service("remote/send_command", entity_id = remote_id, device = device_name, command = cmd, num_repeats = repeatCommand, delay_secs = delay, hold_secs = hold_s)
    

Can anyone suggest a good card to control the lift/drop? I used a button card, but the up/down arrows you see on cover entities might be cool. I dont know how to create that tho.

Any suggestions welcome

6 Likes

Very cool, what do you use for your motorized shade? I would like to do something similar with one of my windows that is 84" wide.

Very cool, what do you use for your motorized shade?

I use the Rollease Acmeda Automate Pulse 2 , but both the blinds and the pulse 2 are really expensive :’( [for my budget at least]

I could not find a cheaper solution, but the price tag aside, im very happy with he product.

Where did you get that tv mount?

This is really nice.
You just gave me an idea!!!

1 Like

VIVO Electric Motorized Flip Down Pitched Roof Ceiling TV Mount for 23" to 55" Screen (MOUNT-E-FD55) https://www.amazon.ca/dp/B01GGR6I24/ref=cm_sw_r_wa_apap_Fhe6lkQmQAOm6

You can call the company directly. They have great customer service.

Thank you, I don’t think this is quite going to work for me (very odd ceiling). Nice setup though.

Hi Philip, I have the RM4 Pro and the MOUNT-E-FD70 mount (the larger version of your model). The remote is a RF remote, that I think operates in the 2.4 Ghz range (but not sure). Does the RM mini operate in that range? I can’t capture it… :frowning:
Can you clarify the range and if possible share the captured code? I just need the up and down action, as I will be using it as a condition of the TV’s power state.
Thanks in advance for any help!

Hey Brian,

My set up worked with the RM-Mini which only uses IR signal - My TV lift also only receives IR signal.

I have tried with other RF remotes to teach the RM4 to read my signal - but never succeeded. :frowning:

If your mount can receive IR signals I would recommend you go that way. I’ve had a much easier time with IR.

Gotcha. Different models, different controls. I’ll reach out to the company and see if they can help. If not, I saw a post for connecting my models remote to some relays. The long road… lol
But thanks so much for the reply. Your project looks great, love that surround the TV lifts into.