MQTT interface... time for some testing. Where are my experts?
-
I'm probably going to release my first pass at the MQTTController for Reactor (aka MSR) this week. It doesn't yet intrinsically know about a lot of devices, but you can train it for pretty much anything, I think, and it would be great if a couple of our heavy MQTT users could help check it out and maybe help contribute some device templates.
I'm hoping to package it up for mid-week, assuming the rest of life stays on track.
Success factors for the test: solid familiarity with MQTT, a big mix of devices, and comfortable editing YAML (for creating the templates/mappings).
-
I’m busy with work at the moment, but count me in. I hope it’d be possible to use an external broker as well.
-
I'm fairly new to MQTT but think I got the hang of it. Plenty of different Sonoff/Tasmota devices. Happy to try.
-
toggledbitsreplied to therealdb on Nov 8, 2021, 1:05 PM last edited by toggledbits Nov 8, 2021, 10:03 AM
@therealdb said in MQTT interface... time for some testing. Where are my experts?:
I hope it’d be possible to use an external broker as well.
It doesn't incorporate a broker so you can use whatever you like. I've just been using
mosquitto
on an RPi4. Lots of things available to fulfill that role.I suppose if I ever do a full OS distribution/installer, I'd include one, but I'd still keep it agnostic. I like freedom of choice.
Edit: by the way, some time ago, I had asked Eduard at Vera/Ezlo to include
mosquitto
as an installable package for the Vera firmware/OS. I believe it's available to install on the recent 7.32 builds. -
Yep, mosquito is available in 7.32.
I’ve written my own broker because why not, and I’ve bridged my Vera to mqtt using the udp client posted by @akbooer. I’m slowly removing the logic from the Vera because I’ve incorporated a lot of thing into mqtt (Shelly, tasmota, ecovacs, LG tv, cams, notifications, fully kiosk) and I’m already using mqtt as the message bus of my system. I’m really looking forward to test this new feature.
-
Looking forward to it, MQTT running on Homeseer controlling RFXCom (so far) however far away from being a Power User with a mixed bag of devices.
-
Everyone, I'm going to hold off releasing this, not because it isn't ready, but because I'm not ready to handle install issues and questions for it (it's a separate add-on, and has its own all new configuration requirements, of course). The complication is that I'm travelling starting Friday morning on a college preview/visit for my older son, and I really need to give that (and him) my undivided attention.
So, I'll push this out when I return, either Sunday night or Monday morning. Sorry for the delay.
-
toggledbitswrote on Nov 15, 2021, 6:48 PM last edited by toggledbits Nov 15, 2021, 3:23 PM
OK. MQTTController is now published. A few things to know:
- It's a separate component you need to download and install;
- Instructions for getting it, installing it, and configuring it are here;
- Please make sure your posts and new topics (especially questions and reports of possible bugs) follow the posting guidelines (see pinned post in this category).
-
Am I correct to assume there's no support for authentication yet? I could not find anything about it in the documentation.
-
Working on it, but not in that release.
-
Turns out, you can do it with a workaround for now...
After
source
, addoptions
, withusername
andpassword
, like this:... implementation: MQTTController config: source: "mqtt://127.0.0.1:1883/" options: username: whoever password: whatever
-
Sweet, it's up and running!
-
May I suggest that the
init
is an optional parameter set in reactor.yaml likeunit
in the templates for Tasmota devices, as openLuup ignores the retain flag so every device has to be polled at Reactor startup to not show null values. -
It's done. It's that. I didn't announce the release, but
init
is in 21326 of MQTTController, here: https://reactor.toggledbits.com/download/extras/MQTTController/ -
I have this in my custom template for temperature:
my_tasmota_sensor_temperature: type: ValueSensor capabilities: [temperature_sensor] primary_attribute: temperature_sensor.value init: - topic: "cmnd/%topic%/STATUS" payload: 10 type: raw events: "tele/%topic%/SENSOR": "temperature_sensor.value": expr: 'payload[ source ?? "Global" ]?.Temperature' "temperature_sensor.units": expr: payload.TempUnit "stat/%topic%/STATUS10": "temperature_sensor.value": expr: 'payload.StatusSNS[ source ?? "Global" ]?.Temperature' "temperature_sensor.units": expr: payload.StatusSNS.TempUnit
I can't figure out how to use
init
to acheive this using the stock template.
I actually updated to 21326 before posting, following the docs for installation/upgrade but the version number in the template file says 21321 and has no notes ofinit
-
toggledbitswrote on Nov 24, 2021, 5:05 PM last edited by toggledbits Nov 24, 2021, 12:06 PM
The template file is not relevant for version number, look at MQTTController.js.
Can you show me the rest of your config for this entity/Tasmota node?
Also you don't need to make a custom template just to add
init
. You can use the stock template and putinit
in the configuration (e.g. next touses_template
). -
Ah, of cource.
For now it's"pooltemp": name: "Pooltemp" topic: "Pooltemp" source: "DS18B20" uses_template: my_tasmota_sensor_temperature
Best guessing I've tried this
"pooltemp": name: "Pooltemp" topic: "Pooltemp" source: "DS18B20" init: - topic: "cmnd/%topic%/STATUS" payload: 10 type: raw uses_template: tasmota_sensor_temperature
-
You need to make sure the response to that command actually includes the data you want. I've found that some Tasmota devices return incomplete state on this query. For example, I have a node set up with two relays, and this query does not provide the state of the two relays. The alternate choice, then, is to send
cmnd/%topic%Power
with no payload, and the node replies with aRESULT
topic and the current state (which the template understands).My guess is this issue is moot, however, if you're using an MQTT broker that supports QoS and retain.
-
xAPPOreplied to toggledbits on Jan 7, 2022, 2:23 AM last edited by xAPPO Jan 6, 2022, 9:28 PM
I'm really sorry but I'm failing getting this running - It seems to not be able to find the MQTT files on startup. Running in Docker and have created the correct directory structure with files. It can read my edited config yaml files from home/kevin/reactor/config OK. Permissions are OK.
Have a lot of MQTT experience but not so hot on Linux/Docker this was my run command
docker run --name reactor -d --restart on-failure -p 8111:8111 -v /home/kevin/reactor:/var/reactor --mount type=bind,src=/etc/localtime,target=/etc/localtime toggledbits/reactor:latest-generic-amd64
[latest-22004]2022-01-07T02:08:16.554Z <Structure:INFO> Structure#1 loading controller interface mqtt (MQTTController) [latest-22004]2022-01-07T02:08:16.560Z <MQTTController:null> Module MQTTController v21361 [latest-22004]2022-01-07T02:08:16.561Z <Controller:CRIT> Controller: failed to load mqtt implementation file:///var/reactor/ext/MQTTController/MQTTController.js: [Error]Error: Cannot find module 'mqtt' Require stack: - /var/reactor/ext/MQTTController/MQTTController.js [latest-22004]2022-01-07T02:08:16.562Z <Controller:CRIT> Error: Cannot find module 'mqtt' Require stack: - /var/reactor/ext/MQTTController/MQTTController.js Error: Cannot find module 'mqtt' Require stack: - /var/reactor/ext/MQTTController/MQTTController.js ...
-
Did you just drop it in the folder, or did you go through all the installation steps? The message logged suggests that step 5 wasn't completed.