Skip to content

Hantoo/Unity_MQTT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unity_MQTT

This is an edited version of Unity3d_MQTT by vovacooper.

I have made the variables more accessable to the user along with adding a routing script to keep the routing seperate from the main MQTT scripts.

Usage

To use this script, first set the Client Settings 'Ip Address' to the address of your MQTT broker. The brokers port should be put in Broker_port feild. Ensure that a MQTT broker such as Mosquitto is running otherwise you'll get errors upon runtime. Ensure that you ensure the correct topics that you wish to subscribe too. All messages are routed throught the MQTT Routing script. Use this to cleanly breakdown the MQTT Topics and then prase the topic messages into usable data which you can then pass on to other functions or classes.

E.g.

 if (MqttMessage.Topic.Contains("Global/Temperature")){     
 
      TemperatureControl TempCtrl = new TemperatureControl ();     
 
      int value = int.Parse(System.Text.Encoding.UTF8.GetString(MqttMessage.Message));   
 
      TempCtrl .setTemp(value );    
 
 }     

Detail

UI

IP Address

IP of the broker.

Broker_Port

Port of the broker

Topic Prefix

Prefix that is added to all topics. E.g. in the example above, the topics subscriped to are: OC/TrackingPeople/IDs/#

Topics

This is a list of all the topics you wish to subscribe too. Use # as a wildcard

MQTT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages