Integration Solutions using MQTT

I have started testing the MQTT humidity device.

Zigbee humidity measurement from SmartThings to MQTT broker is operating. Humidity measurement is updated every time the measurement value changes in SmartThings’ hub. This is implemented using Rules API.
Also periodic updates are possible.

Rules API for Zigbee to MQTT sending (when Zigbee humidity measurement changes):

{
  "name": "Humidity Changes - MQTT",
  "actions": [
    {
      "if": {
		"not": {
			"equals": {
			"left": {
            "device": {
              "devices": [
                "id zigbee device"
				],
				"component": "main",
				"capability": "relativeHumidityMeasurement",
				"attribute": "humidity"
				}
			},
			"right": {
            "device": {
              "devices": [
                "id mqtt device"
				],
				"component": "main",
				"capability": "relativeHumidityMeasurement",
				"attribute": "humidity"
				}			
			}
			}
        },
        "then": [
          {
            "command": {
              "devices": [
                "id mqtt device"
              ],
              "commands": [
                {
                  "component": "main",
                  "capability": "partyvoice23922.vhumidityset",
                  "command": "setvHumidity",
                  "arguments": [
                    {
                      "device": {
                        "devices": [
                          "id zigbee device"
                        ],
                        "component": "main",
                        "capability": "relativeHumidityMeasurement",
                        "attribute": "humidity"
                      }
                    }
                  ]
                }
              ]
            }
          }
        ]
	}
	}
	]
}

Rules API for Zigbee to MQTT sending (periodic updates):

{
  "name": "Humidity Every 10 min - MQTT",
  "actions": [
        {
            "every": {
                "interval": {
                    "value": {
                        "integer": 10
                    },
                    "unit": "Minute"
                },
			  "actions": [
						 {
						"command": {
						  "devices": [
							"id mqtt device"
						  ],
						  "commands": [
							{
							  "component": "main",
							  "capability": "partyvoice23922.vhumidityset",
							  "command": "setvHumidity",
							  "arguments": [
								{
								  "device": {
									"devices": [
									  "id zigbee device"
									],
									"component": "main",
									"capability": "relativeHumidityMeasurement",
									"attribute": "humidity"
								  }
								}
							  ]
							}
						  ]
						}
					  }
					]
	         }
	     }
	]
}

Copy rule and just change device ids. Don’t change anything else.

1 Like