Please help with MQTT

Hi everyone,
I need help again. I have a Kwikset lock that was working fine before a crash.
Long story short it was working,but now although it works i can not use it in any automations.
So I am thinking maybe MQTT. but I am not smart and I know nothing about MQTT.
so a bunch of questions
1} discovery <discovery_prefix>//[<node_id>/]<object_id>/config
So if I could break this down I go to the MQTT configuration and publish
discovery_preffix/component lets stop here on component my understanding is.
: One of the supported MQTT components.{how do I know if my kwikset lock is supported}

2}Node ID    my understanding is they want here is

<node_id> (Optional): ID of the node providing the topic, this is not used by Home Assistant
but may be used to structure the MQTT topic. The ID of the node must only consist of
characters from the character class [a-zA-Z0-9_-] (alphanumerics, underscore and hyphen).

Since this seems to be optional I may not need it. But will I need this later and is it saying
that i can make up any node ID
as long as it conforms the charactor class.

3]object id   my understanding is they want

<object_id>: The ID of the device. This is only to allow for separate topics for each device
and is not used for the entity_id. The ID of the device must only consist of
characters from the character class [a-zA-Z0-9_-] (alphanumerics, underscore and hyphen).

Again can i make up any object id as long as it conforms to charactor class

Oh and one more thing since i am looking for locks it seems i need to put just this in my configuration yamil file

Example configuration.yaml entry

lock:

  • platform: mqtt
    command_topic: “home/frontdoor/set”

I recommend this tutorial to everyone who want to understand how MQTT works:

HiveMQ - MQTT Essentials

Beyond that, here is how Home Assistant’s MQTT Discovery process works:

In a nutshell, if you publish a payload, containing information in a specific format, to a specific topic, known as a Discovery Topic, Home Assistant will use that information to create an entity (and, optionally, a device).

Here is an example of a Discovery Topic for creating a binary_sensor:

homeassistant/binary_sensor/garden/config

The component in that topic is “binary_sensor” and the object_id is “garden”. It has no node_id (which is optional).

Here is an example of a payload (published to the Discovery Topic shown above) that will create a binary_sensor called binary_sensor.garden with a motion device_class.

{"name": "garden", "device_class": "motion", "state_topic": "my_sensors/garden/state"}

Alternately, instead of using MQTT Discovery to create an entity you can define it using YAML.

binary_sensor:
  - platform: mqtt
    name: Garden
    state_topic: my_sensors/garden/state
    device_class: motion

In summary, you can use either MQTT Discovery, or YAML configurations, to create MQTT-based entities.

ok i have read all night and still dont understand
I have tried putting this:
lock:

  • platform: mqtt
    name: frontdoorlock
    state_topic: “home-assistant/frontdoor/”
    command_topic: “home-assistant/frontdoor/set”
    payload_lock: “LOCK”
    payload_unlock: “UNLOCK”
    state_locked: “LOCK”
    state_unlocked: “UNLOCK”
    optimistic: false
    qos: 1
    retain: true
    value_template: “{{ value.x }}”
    in my configuration file but i can not get lock to work when i publish anything i get Failed to call service mqtt/publish. Error talking to MQTT: The client is not currently connected.

The problem appears to be self-evident: Home Assistant is not connected to the MQTT Broker.

Are you using the Mosquitto MQTT Broker Add-on?

yes this also seems evident to me also
and yes i believe i am using mosquito

yes and i can see in the configuration of the mosquito broker that it has failed to connect any suggestions on how to get it connected

@Paul_Macie, just wondering…

Is core-mosquitto the domain name of your MQTT broker? Are you using the add-on or a separate, dedicated broker? If you using the add-on, make sure you are using the official one (see picture below) and follow this guide.

Hope this help.

thank you uninstalling the mosquito add on and reinstalling the mosquito add on and now it is connecting to mqtt now if I can get it to discover the kwikset 888 lock

Try this:

  • On HA, go to Configuration > Integration. Find the MQTT widget and click the devices link and see if your lock is one of them.

image

I have no devices I dont understand discovery

It looks like yours is communicating with your router 192.168.1.1 mine is not even doing that but i want it to communicate with my z-wave lock not sure how to do discovery of anything the instructions make no sense to me i will probably spend another 500 bucks to replace both locks and just get rid of z-wave all together i never have any problems with zigbee or wifi devices. every single problem i have ever had is with z-wave. If I can figure out MQTT that might help me. But who knows I am not a programmer just a regular stupid person but right now everything is working alarm system all my lights and all my plugs. z-wave is actually controling my locks with depreciated version but will do no automatons with locks all other automatons work fine

Don’t take mine as an indication. I have my MQTT broker installed in my Asus Router whereas your broker is an HA add-on.

Try this thread. People there may be able to offer better help:

So, the only reason you think you need mqtt is for a ZWAVE lock?

Are you using zwavejs2mqtt for communicating with the lock?

Otherwise I’m not seeing how zwave and mqtt are related at all.

ok this is what happened {and what i hope might help me fix it }
Everything was working fine then either an update {or my stupidity} crashed the system. I couldn’t get in to it. So I reformatted the sd card, Put Home assistant back on. That is when the fun started. I had the locks stuck in a hubz usb1 stick i couldnt connect to them nor could i remove them from hubz stick. so i bought a new Aotec gen 5 zstick to control my z-wave part of my smart home. Since z-wavejs had just come out I installed that add on. so js would connect to my kwikset 888 lock but it would not lock or unlock it even though I used secure inclusion. After researching and trying for a couple days to make it work i went back to z_wave depreciated.That integration found and controlled the locks but the locks do not work in any automation specifically alarm automation. I have tried just telling the entity to lock when the alarm is armed. Wont do it. I tried calling service lock.lock. it wont do it. I have checked the state of my alarm to make sure it is changing when i arm system. It is. I can tell the automation to run and it does lock my doors. But when i arm the system it does not lock my doors, I am just grabbing at straws hoping mqtt might be able to make them lock when alarm is armed

may I add this, even if it does not help me in this situation me learning a little more about anything is good. Plus i love getting mad and yelling at inanimate objects that don’t listen antway

Unfortunately, I don’t have any smart locks so my help with that specific thing is going to be limited. But I can try to help you a bit with the general stuff.

I have no idea where your system stands right no so I’ll start from the beginning. If you’ve already done any of this just skip it. But it might be a way to make sure you haven’t missed something.

First, you said your device was “locks stuck in a hubz usb1 stick i couldnt connect to them nor could i remove them from hubz stick”.

Did you try to do a factory reset on the lock? if it was indeed “stuck” then it shouldn’t have paired with the new stick at all.

Next, let’s eliminate MQTT all together and eliminate HA (for now).

In HA go to the zwave (deprecated) integration and under the configure tab click on “stop network”. You can also completely delete that integration but for now we can test things to a degree without that drastic of a step. The choice is yours.

Install the zwavejs2mqtt add-on if you are using HA OS/Supervised or via the docker container if not.

In the zwavejs2mqtt control panel (IP of machine running zwavejs2mqtt at port 8091) go to the “settings” tab and click on the toggle to disable the mqtt gateway. Make sure you select the correct hardware port and to put your security key (properly formatted) in the configuration in the “general” section. Then under the Home Assistant section make sure that the toggle for the WS server is turned on and that the port is set to 3000 (unless you have a reason to have it set to something else? Only you would know that.).

Now in HA add the zwavejs integration but make sure you uncheck the box that says “use supervised server” (or something to that effect) and make sure you set the integration to use the server IP:PORT of the machine running your zwavejs2mqtt system.

Hopefully you will get a “success” message.

Next go back to the zwavejs2mqtt control panel and look at the devices you have there. you should see the node for your lock in the list. If it hasn’t completed the interview process just wait for it to finish

under that device you should have a bunch of stuff that you should be able to use to control your lock. This is where my lack of locks will be a problem but there should be something in there that should allow you to lock and unlock the lock from within zwavejs2mqtt.

Is there anything there for that functionality? And if there is does it allow you to control the lock?

(I hope I haven’t forgotten anything)

Just seen this post.Thank you so very much and I am sorry that you have to explain in such detail I will get better at this. It will take me some time to implement the changes described in your post especially since I will not be able to work on this till this evening. But I will post here if I have success.

1 Like