Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.76k stars 1.64k forks source link

Option for non-JSON output #493

Closed stoinov closed 5 years ago

stoinov commented 5 years ago

This is more of a general question: would it be feasible to add option so that each attribute to be separate entry on the MQTT path. So instead of: zigbee2mqtt/0x00158d0002219 {"battery":"39.00","voltage":2995,"temperature":18.87,"humidity":60.87} We get:

zigbee2mqtt/0x00158d0002219/battery 39.00
zigbee2mqtt/0x00158d0002219/voltage 2995
zigbee2mqtt/0x00158d0002219/temperature 18.87
zigbee2mqtt/0x00158d0002219/humidity 60.87

I am trying to setup my own automation without actually using HA, and I hit a roadblock with the homebridge setup - it does need simple strings to work, so I have to parse the JSON and republish them to make it work.

krzyk commented 4 years ago

I used this feature for read-only attributes, but now I have an IKEA light bulb and would like to control it without using json.

Is it possible? What are the topics?

zigbee2mqtt/[FRIENDLY_NAME]/brightness
zigbee2mqtt/[FRIENDLY_NAME]/color/r
zigbee2mqtt/[FRIENDLY_NAME]/color/g
zigbee2mqtt/[FRIENDLY_NAME]/color/b

How about transitions, if it is no longer a single json(/transaction) it would be hard to do transition to given state, so how it is handled right now?

I know that the setting for that (and this issue) is about output but it would be good to have json-less input also.

kianusch commented 4 years ago

zigbee2mqtt/[FRIENDLY_NAME]/set/brightness

seems to work.

zigbee2mqtt/[FRIENDLY_NAME]/set

works with with ON|OFF payload.

Although this works also without "output: attribute" entry in the configuration.

nicomania commented 1 year ago

Hello all, red through this and I am not sure how to enable the feature of non-Json output. I have put

  publish_as_json: false
  publish_as_key_topics: true

in my configuration.yaml. I tried it at mqtt: and advanced: but non worked. I still get json mqtt messages only. As it is not mentioned in documentation, can somebody please help me to set this up? Thank you!

nicomania commented 1 year ago

figured it out. For everybody facing the same: put output: 'attribute' under advanced: of yaml. Greetings!