#Anyone have an example for a mqtt

1 messages ยท Page 1 of 1 (latest)

rigid shell
#
service: mqtt.publish
data:
  qos: 0
  retain: false
  payload: "blah blah blah blah {{ states('input_text.something') }}"
heavy wolf
#

Great

#

Thanks very much!

rigid shell
#

@fair rock did all the hard work ๐Ÿ˜„

fair rock
#

lmao... copypasta ๐Ÿ™‚

heavy wolf
#

YEah.. I'm trying to make a custom publish hahaha

#

Thanks guys

fair rock
heavy wolf
#

service: mqtt.publish
metadata: {}
data:
qos: 0
retain: false
topic: yaleLock
payload_template: >-
'{"pin_code":{"pin_code":123456,"user":11,"user_enabled":false,"user_type":"unrestricted"}}'

#

I'm missing something?

fair rock
#

Where's the template? That's just a string that isn't being parsed right.

#

If you just want to send a string, just send it in payload:.

heavy wolf
#

service: mqtt.publish
metadata: {}
data:
qos: 0
retain: false
topic: yaleLock
payload: >-
{"pin_code":{"pin_code":992991,"user":11,"user_enabled":false,"user_type":"unrestricted"}}

fair rock
#

Ah, ok. So, payload_template requires a template. That string should work though.

#

in payload:

heavy wolf
#

I don't see that publish on z2m log after i run the action, but I dont see any errors running it

fair rock
#

You wouldn't see that on Z2M unless yaleLock is your Z2M topic.

#

Ok, let's start over... it looks like you are trying to set a pin code for a yale zigbee lock through z2m, right?

heavy wolf
#

Oh im so dumb

#

forgot the zigbee2mqtt/ hahahha

#

Yeah, that worked now

fair rock
#

Ok ๐Ÿ™‚ Awesome.

heavy wolf
#

I can't check the lock itself but I can see the publish correctly on log

#

Thanks very much!

fair rock
#

Don't forget to add the /set to your topic.

heavy wolf
#

yeah, i was missing both zigbee2mqtt and set

#

Let me try to put the input_text now

#

service: mqtt.publish
metadata: {}
data:
qos: 0
retain: false
topic: zigbee2mqtt/yaleLock/set
payload: >-
{"pin_code":{"pin_code":{{ states('input_text.yalepinuser11') }},"user":11,"user_enabled":false,"user_type":"unrestricted"}}

#

Perfect

#

Thanks!!!

fair rock
#

Anytime ๐Ÿ™‚ Happy to help!

heavy wolf
#

Now i need a way to only allow numbers in my input_text, seems regex is broken?

#

๐Ÿ˜‚