vdomos / domogik-plugin-mqtt

Domogik Plugin for send or receive MQTT messages
2 stars 0 forks source link

JSON formatted messages #7

Closed axboct closed 7 years ago

axboct commented 7 years ago

how you feel about add plug-in decoding of JSON formatted messages? interesting to me https://github.com/owagner/kodi2mqtt and https://github.com/gonzalezcalleja/zmeventserver/blob/master/zmeventnotification.pl

tikismoke commented 7 years ago

Same for me about zoneminder but pretty sure we must start thinking about a dedicated plugin for it.

vdomos commented 7 years ago

Not sure to understand.

It's for pushing command json formated value ? Or receiving mulitple values in a json mqtt message ?

Can you give me a example and a use case with Domogik ?

2017-03-05 21:52 GMT+01:00 tikismoke notifications@github.com:

Same for me about zoneminder but pretty sure we must start thinking about a dedicated plugin for it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vdomos/domogik-plugin-mqtt/issues/7#issuecomment-284261613, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMwCV8T3uDSPgUnHrjnREQr15v36UWJks5riyB8gaJpZM4MTiuj .

axboct commented 7 years ago

push and receive. plugin will understand the huge number of devices operating on mqtt

tikismoke commented 7 years ago

@axboct why introducing mqtt and not a dedicated plugin for kodi too? (except that they do not exist and that it will be ''faster to use this'')

axboct commented 7 years ago

I ask me to understand and to forgive. Probably a dedicated plugin will have more functions. I forgot that XBMC can be controlled through the JSON-RPC :) However, there is always the probability of finding the hardware that will only work with MQTT-JSON Close the ticket.

vdomos commented 7 years ago

Using JSON payload could be possible only if the device is declared with the expected json format in the plugin. For example: this JSON message '{"temperature": "28.2","humidity":69}' will be for for a device type with DT_Temp and DT_Humidity with sensor name "temperature" "humidity"

Which means that for each JSON fomat this implies a "device type" to be added to the file info.json Coud not be generic, I think

This may be an idea to test if there is a use

Give me examples of messages expected or to send, I'll think about it

tikismoke commented 7 years ago

Indeed the plugin should be hable to read/write json formatted value in futur. Maybe just to extract in domos example into 2 existing device ( one mqqt temperature and another mqtt Humidity). For example in zwave plugin even if not all device_type exist, simple device type are available and could reach a physical device sensor by noeId, in MQTT case by topic and json name for value. So user could create such 2 device refering to same json topics and value (with differents sensor type).

We must find time to write those 2 other plugins. Just confirm me your zoneminder needs. (event notification/commands to set manually alarm with duration and title/move camera/show live view/show events).

Access will be spliited in 2/3 parts:

What do you thing if i start a repo for zoneminder to list as issues the needs? and start some discuss in it. For KODI, i hope domos (one of our most plugins dev) could look at it and do same (starting an empty repo for sames reasons).

Hope everyone understand, and is agree :)

tikismoke commented 7 years ago

@axboct https://github.com/tikismoke/domogik-plugin-zoneminder/issues

vdomos commented 6 years ago

Hello,

Can you give me some json mqtt messages examples and what information you need to get. I thought about a simple solution to support json messages.

thanks

tikismoke commented 6 years ago

Quick simple example from zoneminder docs:

Authentication messages

To connect with the server you need to send the following JSON object (replace username/password) Note this payload is NOT encrypted. If you are not using SSL, it will be sent in clear.

Authentication messages can be sent multiple times. It is necessary that you send the first one within 20 seconds of opening a connection or the server will terminate your connection.

Client --> Server:

{"event":"auth","data":{"user":"","password":""}}

Server --> Client: The server will send back one of the following responses

Authentication successful:

{"event":"auth", "type":"", "version":"0.2","status":"Success","reason":""}

Note that it also sends its version number for convenience

Incorrect credentials:

{"event":"auth", "type":"", "status":"Fail","reason":"BADAUTH"}

No authentication received in time limit:

{"event":"auth","type":"", "status":"Fail","reason":"NOAUTH"}

Le 31 août 2017 07:47:04 GMT+02:00, vdomos notifications@github.com a écrit :

Hello,

Can you give me some json mqtt messages examples and what information you need to get. I thought about a simple solution to support json messages.

thanks

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/vdomos/domogik-plugin-mqtt/issues/7#issuecomment-326196085

-- Envoyé de mon appareil Android avec K-9 Mail. Veuillez excuser ma brièveté.

vdomos commented 6 years ago

Hello @tikismoke ,

Yes but what information do you need to save in domogik ?

For now, the idea is to parse a json MQTT message to extract a uniq value (number, boolean or string).

A device parameter like 'dataCadran.0.niveauPluie' to get ['dataCadran'][0][niveauPluie] value" can be use.

One device type => one sensor value (possiblilitie to create multiple device with same topic but with different parse parameter)

As the info.json file is static, I can not extract each data from a json and save it in a device domogik otherwise it would require a device type per json message.