trarbr / vernemq_elixir_plugin

A basic example of writing a VerneMQ plugin in Elixir
11 stars 2 forks source link

Unable to Load Plugin. #4

Closed uwejan closed 4 years ago

uwejan commented 4 years ago

After following the guide on the ReadMe. after enabling the plugin manually i get the following error. Can't enable plugin: vernemq_elixir_plugin due to {no_matching_fun_in_module, 'Elixir.VernemqElixirPlugin', auth_on_register,5} Any advice please?

trarbr commented 4 years ago

Hi there 👋

The error is saying that Verne can't find the function auth_on_register with arity 5 in the VernemqElixirPlugin module. Please double-check that the name of the function is spelled correctly, and that the function takes 5 arguments.

uwejan commented 4 years ago

@trarbr Hi, have no idea what wet wrong, u cloned the repo and all works. Am having trouble with no background on elixir, going to try lua, as it seems easier. One question though if you can guide me on, am trying to build sensors presence system. to be more specific on_gune or on_offline hook, is where the problem is. it takes 1 argument as i see, what i wish for is to take 5 arguments. say sensor a went offline, so it automatically use a webhook that modify the topic to sensors/status with payload sensor a offline. What would you advice me on how to do that? If there are any other lua or any plugins does the same please link me. I appreciate it.

trarbr commented 4 years ago

For such functionality you should probably look into using Last Will messages. You can read more about these types of messages here: https://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament/.