Talking ImperiHome

I just added another useful tool to the home control arsenal – speech – not on the PC but on my phone. As regular readers know I use ImperiHome a lot – talking directly to Node-Red to control stuff – and that’s fine – it works – it’s not the only package – I also use Blynk. I just found another reason to concentrate on ImperiHome.

Today I discovered what the “API http server” in ImperiHome is for, at least, one use for it. You don’t normally need this with Node-Red as the phone talks to the Node-Red http link and that’s all that is needed. However I was aware that there was a TTS Engine available in ImperiHome but had never taken the time to find out what it could do.

Now I know. You can fire text at the API from Node-Red and it will speak the text, even when the phone is sitting idle and it sounds ok!!

So the first thing you need to know – in SETTINGS, GENERAL PREFERENCES in ImperiHome, tick the API server.

You need to know the IP address of your phone  – so that kills using this outside of the house or office unless someone can think of a wheeze. You should ideally do an IP-MAC binding on your router to ensure the phone always get the same internal address when on the WIFI.

And with that done, you’re almost up and running.  In Node-Red you need this simple SUBFLOW – create a new sub-flow, call it “My phone” for want of a better name and create this.

SubflowThe HTTP request is empty – the work is done in the orange function – put this in the function…

msg.url=”” + msg.payload;
return msg;

That’s it – you’re done. Whatever you send in the payload to that sub-flow will speak on the phone. Couldn’t be easier.  Oh, that IP address – that needs to be the IP address of your phone.

June 2, 2016: I have found a slight bug. So you can let the phone go idle and run other tasks – the speech continues to work – but if you go out of signal area, perhaps onto a mobile network then come back in – noting that the mobile signal is now off and you are on the same IP address, no speech. Bring the app to the foreground – the speech comes back.  I reported it and for once got quite a quick response – they think it might be Google power management shutting the API down – so looks like some re-writing may be in order.. will have to wait and see but at least they’re aware of it.


6 thoughts on “Talking ImperiHome

  1. even easier: put this in a function node connected the http get for Imperihome – it will return the IP address of the device talking to Imperihome. (Thanks Nick O’Leary!).
    Good for internal use and external (direct or proxy)

    msg.payload = msg.req.headers[‘x-forwarded-for’] || msg.req.connection.remoteAddress;
    return msg;

    1. Two issues with that one Tony – thanks for that info – I’m learning by the second – but it returns the external, not the internal address (just tried with my data off and wifi on – on the phone) – not sure how much use that is as you’d presumably need port redirects wherever you were… and it doesnt’ return anything until Imperihome presses a button… imagine the phone turned off – then move – then on – no sign of the change of address… hmmm.

      1. 1) I tried it connected by wifi and got the internal ip. I tried with a web browser (didnt try Imperihome but should be the same) to the node red flow outside (using LTE) and got the external IP. Are you linking it to the Systems/Devices/Rooms GET for Imperihome?
        2) On mine, with the Imperihome dashboard running, it is doing the 5 sec refresh which triggers the GET and therefore I can see the IP (and populate a list of devices maybe?).

  2. Oh yes it’s not the free version – I would never expect this much functionality in something totally free – but as you say the price is paltry – and unlike BLYNK there are no extra costs later on…. mind you – they also don’t respond to any of my emails 🙂 but it DOES work.

  3. Pete, You tweaked my interest, so I went off and downloaded ImperiHome onto my tablet, but it turns out that this is one option that is only available with the “Pro” version. Not a complaint (my initial impression is that it looks well worth the fairly paltry purchase price, especially with your series of articles to help get everything set up), but just to let people know.

Comments are closed.