gabriel.klein
Posts: 10
Joined: Wed Aug 03, 2016 2:09 pm

MQTT support in mame

Hello, thank you for the great work!

I have a strange request that may make sense after all.

Would it be possible to add support to MQTT in mame?

What is MQTT?
MQTT is an easy way to transmit data from senders to receivers.

You first need a server - as an example mosquitto.

Publisher will send data to a "channel", as an example /mame/emu
Listeners will "listen" to a few channel and react to these messages.

Why?
MQTT is heavily standardised in IOT devices. It means lamps, lights, screen, temperature easily transmit data through this communication channel.

As an example if I have a philips hue lamp, I can easily integrate it in a home system.
If the home system see the message "left,red" on the channel "/mame/emu", it will change the color of the philips hue lamp to red.

It could be a really cool way to integrate mame games in a room.

As an example, in chase hq: https://www.youtube.com/watch?v=45mi0fFKXms
You have 2 lamps: red and blue that switch on at some levels.

I can easily in my home system setup a rule that change the color of the lamp based on the messages sent by mame.

As an example, the following MQTT messages sent by mame would be great.
  • When we start a game, send the name of the game, send stop when we quit the game.
  • When we insert a credit, send the information that the credit was inserted.
  • When some signal are sent by mame. As an example when mame request to switch on/off some lights. ChaseHQ is an example. (Many of them in pinball)
The following MQTT messages received by mame would be great
  • Request to start a game.
  • Request to stop mame (example: shutdown from external source).
  • When some signal are "received" by mame. As an example when I press a button or touch some surface. (Many of them in pinball)
With these simple messages, we could improve our integration in existing systems :)

Difficulty?
It should not be too difficult as these systems were made for embedded systems and are mostly opensource.
gabriel.klein
Posts: 10
Joined: Wed Aug 03, 2016 2:09 pm

Re: MQTT support in mame

An idea of implementation...

Register some events as lua script

Example
emu.register_start(function()
io.popen("mosquitto_pub -h 10.0.0.60 -t '/test' -m '" .. emu.gamename() .. "'")
end)

I saw some mqtt lua library... need to learn how it works.
https://github.com/geekscape/mqtt_lua#download

Could be a "clean way" to start games, add credit and other fun functions available through LUA.

Return to “MAME Discussion”