Connecting It All Together

Tameion

New Zealand
Skip to comments

Hey Everyone...

I wanted to start a discussion on my goal to have a smart house with a Jarvis (Ironman) / Sarah (Eureka) like AI and my little ARC robot servants roaming around.

So feel free to jump in and contribute...
______________________________

I have been using a combination of open source programs with my ARC software and EZBv3 boards. ARC is the brains of my system and provides me with the intelligent front end that responds to voice commands and communicates to my four EZB-3 boards. Lawrence, as I like to call it, replies to my voice commands using the Ivona Brian voice file. Sound very like Jarvis.

After recognising the voice command Lawrence selects what to say back to me from a pool of scripted phrases. This addresses repetitiveness in responses and adds a nice human-ish touch.

At the same time Lawrence is replying several scripts are firing commands to other applications or devices through an MQTT broker that I have installed. This Broker, from the Mosquitto open source project, acts like my AI's nervous system or neural net. I store values that are stored in the broker, similar to database that get reloaded to my various devices when they wake up.... I find this easier than an a database.

Various other devices are subscribed to the broker topics and act appropriately but you must have your own broker installed. I run mine on a separate Raspberry Pi elsewhere on my network. I keep it as a stand alone device as everything connects to it so if I need to reboot my PC it does not cause problems. It is fast, works well on the newer Pi3 and supposedly can handle 100,000 posts per second... I have only rebooted it a couple of times since installation and that was only because I wanted to move it.

So I post directly from ARC to my MQTT neural net with the EXEC command like this:

Code:

exec("C:\Program Files\mosquitto\mosquitto_pub.exe", "-h 10.1.1.120 -p 1883 -t /HOME/EZ-BUILDER/COMMAND -m Command:Lounge_Lights_On' ")


I also use a second program called EventGhost that watches for those MQTT messages and fires commands to other devices on my network that ARC can't talk to. I complete this action by triggering events in EventGhost with the same exec command in EZ-Builder:

Code:

exec("Eventghost", "-event Guest.Welcome.Video.Fullscreen")
exec("Eventghost", "-event It's_Spa_Time")


Another big player in my system is Rainmeter which adds great visuals to my screen. It lets me change the entire look and feel of the PC. While not tied directly to ARC I can launch ARC from a fancy picture on my desktop. This simple script in Rainmeter simply launches ARC when I click it. (I know I could use a shortcut but this looks way cooler)

Code:


[Rainmeter]
Author=Wayne
MiddleMouseDownAction=!DeactivateConfig
Update=86400000
MouseActionCursor=0

[Metadata]
Version=1.0
Information=Phone_Wayne TextItem
License=Creative Commons Attribution-NonCommercial-NoDerivs 3.0

[Variables]
height=60

[noimage]
Meter=Image
ImageName=#CURRENTPATH#\Tablet.jpg
W=(#Height#)
LeftMouseUpAction=["C:\Program Files (x86)\EZ-Robot Inc\EZ-Builder\EZ-Builder.exe" "C:\Users\Wayne\Dropbox\My Robotics\Launcher.EZB" "Autostart"]

[Title]
Meter=STRING
MeterStyle=sTitle
Text=WAYNE
FontSize=9
X=10
Y=55
FontColor=255,255,133,255


And of course OpenHAB is the most recent player to come to my table. As it can communicate with the same MQTT broker I am now extending my domain out from my workshop to the rest of the house. OpenHAB is giving me a nice web front end with switches and buttons, status updates, etc. This means ARC can now turn on my lights through MQTT from a simple voice command.

So friends .... My goal of Home automation with a responsive AI and little robot servants roaming the property is slowly becoming a reality thanks to EZ-Builder.

What have you been doing?

By — Last update
#22  
@Tameion I'm very glad to hear you are pursuing the mqtt plugin...will be very interested to integrate with my openhab instance at home!
New Zealand
#23  
Would you mind sharing a little about your OpenHab project? It might help with development at this end.
#24  
I have openHAB tied into the following systems :

1. Omnilink Binding - for HAI automation panel - Security/UPB lighting/Zwave lock support/Relays for garage doors (some basic programs on this, but more complex rules running on openHAB).
2. Ecobee Binding - Ecobee thermostats
3. Amazon Echo voice control (command only via "echobridge" docker (http) for items/rules) states update in OH
4. Logitech Harmony Hub Binding for A/V control
5. Logitech Squeezebox Binding for multi-room audio
6. MIOS Binding - two-way communication with Vera for other Z-wave, etc.
7. MQTT Binding - two-way communication with multiple arduino nodes for sensor readings, LED RGB strip lighting control, relay activation, etc.
8. emoncms - energy monitoring getting updated sensor readings passed through openHAB from Vera
9. Network monitoring for server(s) status
10. Camera streams in app
11. IFTTT integration through myopenhab ("Automatic" vehicle diagnostic and location)
12. Project "Rotini" for android based cheap wall panels
13. Weather Binding - for forecast and current conditions

Thats an overview of the implementation I have, but with an MQTT plugin for ez-robot I could see where any openHAB event or item setup with a topic could be used for integration of the "bot" for controls or feedback.

I haven't really thought too much yet about the things I would like to achieve as I am still trying to get my first ez-robot (omnibot) completed. I have most things working (RGB led eyes, 2x16 lcd screen, CV, ultrasonic sensor, H-bridge motor drive) except for servo arms yet to do. But with full two-way communication with openhab more easily possible with MQTT I can see that there would be alot of possibilities that could be achieved relatively easily.
#25  
Was wondering if you guys might be kind enough to answer a question about your MQTT Broker setup.
In your code your have:

Code:



exec("C:\Program Files\mosquitto\mosquitto_pub.exe", "-h 10.1.1.120 -p 1883 -t /HOME/ARC/COMMAND -m Command:Lounge_Lights_On' ")


Could you please explain the :

/HOME/ARC/COMMAND

part?

Thanks in advance.
New Zealand
#26  
The command posts a message to your MQTT broker on TOPIC
/HOME/ARC/COMMAND

This has within it a payload of
Lounge_Lights_On

If you are monitoring your Broker and subscribed to the topic above you should see a message to this effect appear in the stream of data.

Use an APP something like MQTTLens to monitor your broker.
www.hivemq.com/blog/seven-best-mqtt-client-tools

We have a plugin in beta at the moment and it loads a single variable with the payload of whatever topic you are subscribed to ...

Project is on go slow as a key member is overseas for another month but we will get back to it soon....
#27  
Thanks for your reply.
I have setup Home Assistant www.Home-Assistant.io and have one switch working, now looking to see how to tie it into EZB.
Would like to have at least one working example here before diving in head first.
It looks simple enough from your example but as I have found out, looks can be deceiving ... lol.
Later today when time permits we'll give it a run and see what happens.

Thanks again for your assistants.
#28  
Hello Again ... lol

My MQTT Broker is running from a Raspberry Pi.
The script example above runs from a MQTT broker on the PC.
I could not for the life of me figure out how to get it to run from the Pi.

Headaches, hair pulling and yelling at the computer brings me here again!
Was curious, if either of you guys here with MQTT on your Windows PC had any trouble installing it?
I have spent the better part of two days trying on three different PC to get up and running!
I have Googled & Googled read EVERYTHING on the net (lol) still no luck.
I am aware of the .dll's that need to be in place, Visual Studio Redist., still no go.
So, did it go smooth for you guys?
New Zealand
#29  
Yes the code example above in post #26 is for the PC. It was a one liner in an ARC script that sends messages directly to your broker and of course needs to have ARC and Broker on the same PC for this to work.

I did have some trouble installing on a Windows PC.

Had to fiddle with the firewall. Worked well on 127.0.0.1 but Windows security caused me grief.

So I stayed with the Raspberry Pi Broker. I need the broker to be in an "always ON" state and stable. I seldom have to restart it unlike my PC !
#30  
Finally got the PC mqtt broker up and running last night.
I was getting a error on .dll files.
Decided to try another openssl version and that did the trick.
Now getting ready here to give the example code above a go.

You say you stayed with the Raspberry Pi broker.
(I don't think you can beat a Pi, as it seems really stable and cheap to run.)
I assume that you are bridging the pc broker to the Pi broker?

If so, did you run into any trouble doing it?
#31  
I'm back:)
New problem:(

Code:


exec("C:\Program Files\mosquitto\mosquitto_pub.exe", "-h x.x.x.x -p 1883 -t /SAMPLE_TOPIC/ARC/COMMAND -m Command:Sample_Command' ")



I am running into an EZB error.
Yours: "C:\Program Files\mosquitto\mosquitto_pub.exe"
Mine: "C:\Program Files (x86)\mosquitto\mosquitto_pub.exe"
When I put the (x86) into EZB code I receive ... error line 1 Missing ) in expression.
Taking the (x86) out of the code I receive ... error can not find file, or something like that.

Any ideas?

Maybe DJ will read this too and give a idea what to do.
#32  
you are missing an opening quote in the path (at least from what you copied and pasted. Better to copy and paste the entire line, rather than an excerpt for proper troubleshooting.

Alan
#33  
In my script I do have the quote.
When I copied and pasted it, the quote was missed, now corrected.
Your right, it is better to copy the whole script line.
I just wanted for people to see the comparison side by side.

Thanks for looking at it Alan.
#34  
So, this may be something DJ needs to fix, or you may need to install mosquitto to an alternate directory than the default.

On 32 bit windows systems, everything gets installed in \program files.

On 64 bit Windows. 32 bit programs get installed in \program files (x86) and 64 bit programs get installed in \program files.

The issue is that parenthesis mean something in EZ-B script language, and unlike some scripting languages, there is not a "escape" character to tell the script to ignore the following parenthesis.

Quickest fix would be to re-install mosquitto, and during the install, choose a custom install path - either c:\mosquitto or put it in c:\program files instead of c:\program files(x86)

Long term, this is something DJ will need to fix I think.

Alan
PRO
USA
#35  
@Alan, @Fob

If the problem is the " ) " you can replace program files (x86) with the equivalent short name.

check the thread (post #11):
https://www.ez-robot.com/Community/Forum/Thread?threadId=9006&page=2

something like this:

Code:


exec("c:\progra~2\mosquitto\mosquitto_pub.exe", "-h x.x.x.x -p 1883 -t /SAMPLE_TOPIC/ARC/COMMAND -m Command:Sample_Command' ")
#36  
I forgot all about short names. Excellent solution!

Alan
#37  
Thanks for the reply and the link:)
Will give it a shot when returning home.
I must have had a brain fart or something not trying the install it into another path after the code did not work:(
Never new the way the link shows?
Glad we have this forum and people to help and share.
#38  
MQTT broker is up and running, code from EZB to broker is now working ... it's a Christmas Miracle!
Now on to the next step, isn't there always a next step?
Would like to thank all for the help!
I really do appreciate it.
#39  
@Fob You know you could really show your appreciation by giving back to the forum... How about a video on what you are exactly doing?... Maybe others (I know I am curious) want to see what this is all about...
#40  
Yes! Please share with a video and pics! We love that stuff!

Feel free to build a project page documenting your process with discussion, pics and video. others can follow, add their ideas, help with problems and learn from you. :)
#41  
Your right Richard R.
My daughter has a video camera, I'll see if I can borrow it.
My phone is too cheap to do one with.
I am just starting in this direction, MQTT broker and home automation, as you can see but it might get others interested knowing what it can do.
We all want our bots to do as much as it can.
EZB is a great platform for this also.