Sorry, I should have read your second post related to JSON and nested JSON. I was able to get the ON and OFF working with the mapping below. I'll see if I can get the other attributes mapped.
The color value with the nested 'color' R G and B values is going to be problematic as HE expects hue & sat values. If you want to see the state or set color via MQTT you may have to use RM, NodeRED or something to massage this value.
I do have inbuilt conversions for these RGB values when used with homie and HomeAssistant but not usable with these 'adhoc' MQTT devices. That's maybe a useful feature for me to add.
As you I'm sure know your cmd topic for the switch _CMD is wrong - you'll need to add the json bit there.
topic1/topic2/topic3{state:}
or topic1/topic2/topic3{state:}{key2:3,key3:"whatever"}
if you need extra keys - I don't think you will.
switch_Cmd: kitchen/esps/cabinet/set{state:}
I don't think I support nested json for cmd's although there may be a work around for that which you'd need if you want RGB for example.
I 'think' but can't remember that the switch_MAP mappings will get used in reverse automatically so will publish 'ON' and 'OFF' rather than 'on' and 'off'. If they don't I should add this behaviour.
I'll have a good lookover this shortly. cursory glance looks OK and it looks like it's checking for HA devices. When you re-run the app are any discovered devices now listed here ?
What I would do is install MQTT Explorer as this allows you to see what's actually being sent to MQTT. It's a great app - a must have.
Thanks Kevin for the reply, I checked the logs and am seeing this error:
MQTT> MQTT connect failed attempt:[null], try again in 10 secs
dev:29522020-09-08 04:26:45.963 pm infoMQTT> Connecting as Hubitat_temporary to MQTT broker null
I'll download the tool as you suggested to see if I can connect. Once I get this all working, happy to put together a how to with screenshots if that's helpful.
Ahh. known annoying issue... with new installs, Will be fixed in next (final) version.
Try deleting the MQTT client device - (not the driver) and then re-running the app. Recommend you reboot the hub after that too to stop the previous driver from running.
OK, so after a restart it was able to discover devices. I've selected a bunch of climate devices, but should it then create virtual devices for these? As nothing seems to happen after selecting them and clicking done..
Hello. I've been trying to set up MQTT for HE and HA to talk to each other. I've gotten the point where HA is at least publishing some data and I can see it with MQTT Explorer, but I can't get the MQTT app in HE to connect to the broker.
It's the same null broker config messages as mentioned above, but I am not sure what you mean by "re-running the app" after deleting the child device.
I did try yesterday to delete the child and remove the app, then re-add the app. It didn't change anything.
Okay, I think I got the child app communicating correctly. I deleted the child device, rebooted the hub, then loaded the MQTT app again. Checked the child device and it seems to see the broker now.
Now on to figuring out how to get HA devices to be discovered. I'll head to the other topic for that.
@Kevin I’ve been using the MQTT beta 3d for sometime without issue - via virtual devices. I have just tried to add these 3 devices via the discover in to HE option. I can find the 3 devices, but selecting them doesn’t create the devices... is there anything about these lights which isn’t supported? Thanks!
@kevin any idea what could be causing this null pointer exception? I can see the values coming in but the virtual device doesn’t get updated, but instead throws this error:
app:34912020-11-02 11:11:01.367 pm errorjava.lang.NullPointerException: Cannot get property 'value' on null object on line 5918 (HASensorEventP)
I had to reset my hub and after installing the mqtt driver and app now I keep getting this message when trying to update a virtual device I make. I have tried deleting the driver client and restarting, restarted the hub. I'm not that much of a programmer but i found this sentence in a catch some place. The hub version is 2.2.4.145.
" This device Big Garage Door was not created within this app and so can't be edited here".
The virtual devices used within the MQTT app are created as child devices of the app. If you delete the app it will also delete these child devices. So upon re-install you would have to recreate the devices again within the app.
The message you are getting confirms that the device you are trying to edit was not created within the current app.