REST API to control the app

Is there a way to trigger a Scene by a webhook call generated by an external system?

All I can think of is using a separate server, where the webhook modifies a flag, and that flag is continuously monitored by an HR device plugin (generating lots of traffic)

Why not use MQTT or a WebSocket?

You aren’t limited to only HTTP REST calls in a plugin. You can use a protocol that doesn’t require polling.

Ha! will need to expand my knowledge for that. Have an example project using a websocket that I could study?

Yes. There’s a simple Echo example in the docs you can study.

1 Like

I’m trying to figure out how MQTT works but it’s very difficult to find explanations or examples for me.
Help links don’t actually give help about the topic…
Any scripting for that matter, just a reference page of all the things you can use, but not how to use them.
Unless I’m an idiot and not finding it?
So I searched around and found the Homie MQTT plugin.
After some trial and error I created a plugin which receives the MQTT messages.
So now I want to use OpenDeviceDetails, but as was the case with MQTT, I can’t find anything about it how to use it except in a forum thread about a button…
Can you link me the explanation on how to use this function / method? (or any function / method really)


You won’t be able to call OpenDeviceDetails directly in the Plugin. You will need to have your Plugin update a Device object & then have that Device object trigger a Scene. Take a look at the Scene in this DoorBird example. Your Scene will look very similar to that.

As for the page navigation functions, I posted a write up here on how they work & how they differ from one another.

You don’t necessarily have to use a Plugin either for MQTT. There is this other MQTT Client you can also use. The main benefit to the plugin is that you can automate your device object generation & use the XAML templating features. If you’ve only got a few topics you are monitoring this could be an easier option for you.

What you need to focus on first is verify the Home Remote can read your MQTT device. Configure a Label on a simple XAML page that shows the current value of your MQTT topic. Make sure it shows the value you expect.

I don’t understand why this must be a scene?
From what I can tell this seems to require its own tile & details xaml file when the device I want to control already has one.
I’m sorry but this is all too vague for me.

I already saw your MQTT example but it’s for switches, not just listening and doing something.
I just want something to happen when a certain payload has been sent to a specific topic.
I tried using it but I could not get it to do what I want it to do.
When I added the MQTT “device” I set the topic and configured the ValueChanged script but nothing happened.
Not even the console.log on the first line when something was posted on the topic.
But I don’t even know if I’m correctly configuring the topic / subscription, the example gives me more questions that answers.
Clicking help gives me no explanation of what I’m witnessing or how it actually should be configured.

The page navigation page you link is only informing me of something that exists I could use but not how I can use it. I expected I could change the homey plugin (since the MQTT device didn’t do anything) to do what I want to do.
The plugin does everything except the command you link, so back to square one for me.

Don’t get me wrong, I know it’s all possible with your software and much more.
I’m just having a hard time trying to find documentation and examples of what I’m trying to do.
All the video’s that are linked are about remotes, but I don’t want (tv / home theater /…) remotes, I want simple wall tablets.

The plugin show’s me that the topic can be subscribed to and that the payload is correctly received.
Ideally I would add an MQTT device source, subscribe to the payload and do something simple when that payload is received with the ValueChanged script.
Is this at all possible?
Or do I really have to jump through hoops like custom devices, pages and screens to control a device with one command that’s already there?

Thank you for your patience.

The Tile is optional. That’s only necessary if you want to manually trigger the scene. You can leave that blank for an automated scene.

+1 for a HTTP API.

Imperihome is easy to send HTTP commands to from another system.

I have my Vera controller send HTTP commands to the Imperihome tablets to perform certain actions, like having Imperihome nativigate to a certain dashboard page or bring up an IP cameras image.

Vera is my controller. I wouldn’t really want Home Remote to be doing any monitoring or logic, can it even do that when the Android tablet is asleep?

How does this work? Is ImperiHome running a webserver on the tablet? Do you give Vera the IP address of your Android tablet?

My guess is that ImperiHome managed this in the cloud. The Home Remote does not host or run anything in the cloud. It’s only running when the app is open on your device.

No its not cloud.

Imperihome app you can turn on a local HTTP API.

All my Imperihome tablets I have set a static LAN IP address for them.

Vera sends HTTP commands directly to the Imperihome tablets on my LAN.

@WEHA Have you successfully linked your MQTT topic to a Label?

That’s the only thing you should be trying to do right now. We need to take this 1 step at a time.

Please share your HRP. I can be of much better help if I can actually see what I’m working with. Just be sure to remove any sensitive information like passwords.

The Imperihome Local API documentation is no longer available online from their sites which are now dead.

Just saw this Youtube video however about it.

Thanks for sharing. I suppose this is something that could be added in the future.

@WEHA Attached is a very simple working example I put together for you. When the MQTT variable Switch_Raw turns on, it opens a page AlertPage.xaml.

MqttClient_Scene.hrp (8.1 KB)

Imperihome does indeed run a local webserver where you can control certain aspects like the ones in my OP
If I can get MQTT working I can accomplish the same.
But for some things it’s way easier to just post / put / get an http url.
MQTT requires running / using a broker while HTTP calls can be called from many devices / software (Like Doorbird / BlueIris)

So I tried your file:

  • changed the ip address to my mqtt broker
  • changed the SubscribeTopic to the one I’m using
  • changed the trigger content in the scene from “true” to “back” (as in back camera)
    After pressing play and triggering the payload, nothing happens.
    I have a mqtt client on my phone and the trigger is received so the MQTT broker is working.
  • changed the DataTriggers from true & false to back & front
  • changed the eventriggers to the same
    After pressing play, the switch does not change state

There is no log from what I can tell so I have no I idea what is going wrong.

When you send the payload, does your Label show the new value you sent?

Again, the 1st thing you need to do is verify the app is reading your MQTT topic correctly. If it doesn’t show your “back” in your Label, it’s not going to trigger the scene.

Realize too this is based on state changes. If your topic is always showing “back”, it’s never going to trigger the scene. You’ll need to reset it back to some other value once you’ve handled the event.

For all practical purposes you can delete those other controls on that page. The ONLY control you should care about is the Label. DataTriggers & EventTriggers are irrelevant & not necessary.

Attached is a new project with that other stuff removed because I think it was confusing you.
MqttClient_Scene_v2.hrp (4.1 KB)

Well, I really meant nothing, so no, the label does not change :frowning:
Only state change? Well than this is useless to me I’m afraid.
It needs to do something regardless if it’s the same payload.
If I can reset the state myself with a script after like 30 seconds, that could be a solution.

I take that back. I don’t think it’s dependent on state change. If you start the app & that value is set it will trigger the scene.

Does the Label show “back” or “front” when you start the app?

Can you share a screenshot or video capture of it? I really want to see it just so I know for certain it is reading the topic from your MQTT server.

And please post your project. You probably have a minor mistake that I can spot somewhere in your scene configuration. There isn’t a lot that needs to be done for this to work & I feel like I’ve shared everything you need to know. If your project is using a 192.168.X.X address nobody else can access it. It’s a private IP. The only thing you should remove is a password if you are using one. I don’t need that.