Make switch state to show sensor state and still works as a switch

Long story short, I got this “blackbox” RF/IR based security system, so far I can only interface through ssh/netcat (monitor events in its log file) and RF switch in HA (send signal to trigger linked actions).

I’m using in HA, a MQTT sensor and a RF switch, to toggle a RF controlled light and get its state. It works like this:

  1. RF wall button pushed (light on/off)
  2. “blackbox” detects that button signal(1), add event(A) in the log file
  3. HA script pick up event(A) from log file, publish to topic
  4. MQTT sensor updated
    OR
  5. HA RF switch triggered
  6. “blackbox” detects HA’s signal(2), trigger the linked action to send signal(1) (light on/off), add event(B) in log file
  7. HA script pick up event(B) from log file, publish to topic
  8. MQTT sensor updated

Is there a way to update the switch state using the sensor state without triggering the switch action?
Or a way to show the sensor state as the switch state?

In case there is a better way to interface, that blackbox is Geeklink Thinker, has iphone/android apps and Alexa-enabled.

Exactly what you are looking for. The state of the device is determined using a jinja template. The on and off are not triggered when that state changes.

1 Like

Great, thanks!!
I’ll look into this.

Just tested the template switch, works perfectly and exactly what I wanted.
Thanks again.
Now if I could interface that blackbox directly…

1 Like

Hello JT,

Did you manage to control the Geeklink? would you mind sharing how you did it? I have another geeklink and I would like to be able to control it directly. Appreciate your help. Kind regards,

Agustin

Hi Agustin,

When I started this post, I was controlling Geeklink via RF remote to trigger Geeklink actions.

I since switched to using Geeklink skill in Alexa.
If you have Alexa, you should definitely try it, all Geeklink macros show up as switches in Alexa.

The setup I have now is:
-run continuous bash script on Geeklink to monitor the /var/topapp.log for sensor/linkage status and update MQTT for HA sensors, i.e. door sensors
-use Geeklink skill in Alexa to run Geeklink macros/actions, i.e. turn on RF light, etc.

Hope this help.

Hello JT,

Thank you so much. I am a beginner. I just ordered my Alexa echo to try. May I contact you again for further details on how to do it? After that you can control everything with HA? I guess that you can also use Google Home with HA after everything is done, right?

Thanks again. Kind regards,

Agustin

I don’t own Google Home so can tell you about it. I don’t remember Geeklink being compatible with Google Home.

Let me know when you get Alexa, I would better happy to share and help with Geeklink.
Just to set your expectation, I can see all the Geeklink Onkey macros in Alexa and control them directly in Alexa app. For example, to control individual device in each room, I have to create Onkey macros in Geeklink app, i.e. turn on Kitchen light. To control from HA, I also need to create Alexa routines that HA can trigger.

So, you’ll need to set up one of the HA Alexa modules that can run Alexa routines. You may want to read up on this while waiting for your Alexa.

Hey @JTPublic,
I got an Geeklink Mini Pi (https://www.alibaba.com/product-detail/Geeklink-Large-Stock-Best-Quality-Black_60810988330.html?spm=a2700.icbuShop.90.2.3502c5011w56o2) which I’m using to control my TV, Fan, and air condition. I would like to add it to HA and doing some research but have no clue. Could you help me please?

Hi blitzer, welcome to the community!!
Regarding Mini Pi, that’s new to me. I only have the Thinker.

Like I posted earlier, the only way I know of to use HA to control Thinker is through the Geeklink app integration with Alexa or Google Assistant.

In my case, I installed the Geeklink skill in Alexa app which enables Alexa to ‘see’ switches in Geeklink app, then I set up the alexa_remote_control.sh in HA to control Alexa, HA can then send command via shell_command or python_script to Alexa to turn on/off Thinker-controlled devices.

Hope that helps.