esprfid / esp-rfid

ESP8266 RFID (RC522, PN532, Wiegand, RDM6300) Access Control system featuring WebSocket, JSON, NTP Client, Javascript, SPIFFS
MIT License
1.36k stars 423 forks source link

Connect to Domoticz over MQTT #443

Open djpostka opened 3 years ago

djpostka commented 3 years ago

Hello,

I would like to connect the esp to Domoticz via MQTT, however, Domoticz works with IDX (identifiers) but the configuration of the ESP does not allow me to enter an IDX. Do you have a solution? Thank you.

matjack1 commented 2 years ago

hey @djpostka can you please give me a bit more info on what you would like to do? What should an IDX be? Do you need an extra field on the MQTT message?

marktn commented 2 years ago

I think he wants to send the RIFD status to Domoticz. Something i also want.

I have a MQTT server and node red. I am not a mqtt expert, but it looks that the RIFD can not send mqtt commands? Looks like the same question, https://github.com/esprfid/esp-rfid/issues/404

djpostka commented 2 years ago

hey @djpostka can you please give me a bit more info on what you would like to do? What should an IDX be? Do you need an extra field on the MQTT message?

Hello,

Yeah, Domoticz user an extra fiels named "IDX" for the device identification on "Dummy device/virtual device". The domoticez docs explain this: https://www.domoticz.com/wiki/MQTT

matjack1 commented 2 years ago

thank you @djpostka, I see now. Yes, we would need to add an IDX field for each relay (at least, maybe also for the leds, buttons?) so that you can configure them in esp-rfid and use them in the MQTT messages, right?

I think there needs to be a new page in the settings where you set all the IDXs for all the things that you want to expose and then if the Domoticz integration is enabled, pass the extra IDX in all the MQTT calls.

I'm not familiar with Domoticz and I'm not interested in developing it myself, but I can offer code reviews and suggestions if someone wants to implement it.

marktn commented 2 years ago

thank you @djpostka, I see now. Yes, we would need to add an IDX field for each relay (at least, maybe also for the leds, buttons?) so that you can configure them in esp-rfid and use them in the MQTT messages, right?

I think there needs to be a new page in the settings where you set all the IDXs for all the things that you want to expose and then if the Domoticz integration is enabled, pass the extra IDX in all the MQTT calls.

I'm not familiar with Domoticz and I'm not interested in developing it myself, but I can offer code reviews and suggestions if someone wants to implement it.

Yes that would be nice! Maybe a idx for each user. The you can see in domoticz who is logging in, and use it for switching lights, warnings, alarm etc.. Idx for Status door sensor, and idx for opening a door.

Is it possible to let the mqtt send json to node red?

matjack1 commented 2 years ago

Is it possible to let the mqtt send json to node red?

Sure! It's already sending MQTT messages on a lot of actions, it's Node Red that should read those messages and do something accordingly.

marktn commented 2 years ago

Is it possible to let the mqtt send json to node red?

Sure! It's already sending MQTT messages on a lot of actions, it's Node Red that should read those messages and do something accordingly.

I didn't get it at work. MQTT is working with nodered and domoticz, so that works fine.

matjack1 commented 2 years ago

Did you configure the MQTT broker correctly? Are you listening to the right MQTT topics?

You should find here: https://github.com/esprfid/esp-rfid/blob/dev/README-ADDON.md the documentation around the MQTT topics that are used, OK? Let me know how it goes!

marktn commented 2 years ago

Hi,

I think it is correct, maybe i am missing something... In the MQTT explorer and serial it all looks fine.

Update:, when i delete the topic in the MQTT explorer it gives an error.

MQTT-Explorer_2022-04-02_12-17-32

firefox_2022-04-02_12-18-48

firefox_2022-04-02_12-22-10

firefox_2022-04-02_17-54-51

matjack1 commented 2 years ago

Hey @marktn I think we are hijacking this issue to something else from the Domoticz integration? :)

Maybe you can open a separate issue where we continue discussing about the Nodered integration. While we are on the topic though, can you help me reproduce your setup so that I can try understanding better how this works? I'm not familiar with Nodered, sorry.

marktn commented 2 years ago

Yes and no. When MQTT to Node-red works, it can send the information to Domoticz. I will make a seperate issue! MQTT to node-red.