TasMQTT Plug-in and Creating Devices on HomeSeer HS3

Unlike some HomeSeer plug-ins, GEN plug-in's don't create or delete any devices themselves. Device creation, renaming, deleting and modifying is entirely up to you. Its done like this because in my relatively short time of using Homeseer I've found that plug-ins which create/delete their devices have two things in common, firstly they delete and re-create devices after an update, config change, or just for no reason at all which breaks all my events, and secondly because some plug-ins create a mountain of devices most of which I don't want to see. Having complete control over my devices and knowing they aren't going to change ref and mess up all my events is the reason its done like this. If you'd prefer the plug-in create the devices for you then feel free to make that known as nothing's fixed in stone. 

Creating Binary (ON / OFF) devices for the TasMQTT Plugin

A binary Sonoff (or ESP8266) running Tasmota Firmware version 5 or above has a specific command and control format in MQTT. You will need to know the device name (the one you configured on the device itself either by building your own firmware or by using the TTL serial commands or Web Interface. You will also need to know how many outputs it has. The Sonoff Basic for example has one output whereas the Sonoff 4CH has 4. 

Firstly login to Homeseer's Web Interface and select View and Device Management. Then click the Green + symbol at the top right and you should get the screen below. 

image

Give your device a name, it matters not what it is but it should describe the device or purpose to some degree. In our example we're going to call it Side Light. Give it a Floor and Room as usual. If you want this device to be controlled by voice then tick the Voice Command box. If you want to give it a picture then click "Select Device Image" and give it one. Now move onto the Advanced Tab

In the Advanced Tab click the "Device Type (String)" Box and the usual Edit Value box will be shown. This is where the magic happens. In our example we're going to be connecting a device we've named sonoff4 and its a Sonoff Basic with one output. To configure this we enter a Device Type (String) as 

MQTT:sonoff4/POWER

The Device Type (String) is the key to this working. The format is MQTT: followed by the name you gave the device, a forward slash / and finally the name of the output, which in this case is POWER. The entire string is case sensitive so Sonoff4 is not the same as sonoff4 and Power is not the same as POWER. Get it wrong and it won't work. Press OK and now move onto the Status Graphics Page. 

We need to change the 'On' value from 100 to 1 as shown below. 

Offline State (Optional)

If you want to be able to tell if the Sonoff device has gone offline (been powered off, lost connection to Wifi etc) then you can do this by adding another Status Value Pair for the Value 2. To do this click Add New Single Value, which should be added as 2. Click 'Change me' and enter OFFLINE and leave control use as Not Specified. If you wish you can go ahead and add a graphic for this value 2. I've used the Homeseer built in image status/custom.gif as below

And your all done so click DONE and your device will be created.

Repeat the above steps to create devices for all your Sonoff Tasmota units. As a general rule devices with only one output will call it POWER whereas devices with more than one call them POWER1, POWER2, etc. A Sonoff 4CH for example has 4 outputs named POWER1, POWER2, POWER3 and POWER4 whereas a Sonoff DUAL has two outputs named POWER1 and POWER2.  

 

Creating Sensor Devices for the TasMQTT Plug-in

In the same way that we need to create devices for Binary Outputs we can create devices to receive sensor data from your Sonoff's. A good example would be the Sonoff TH16 which sends Temperature and Humidity Data, or the Sonoff POW which sends power usage data. Because your creating the devices and not the plug-in then you choose what you want to receive. We're going to setup a device here for receiving the Temperature reading of a Sonoff TH16 but the process is the same for any sensor value. Firstly, we need to create a virtual device using the Green + in the top right. We're going to call our device Livingroom Temperature but you can call it anything you like. 

Once you've given the device a name, selected a room and floor then move on to the Advanced Tab and enter the Device Type (String) in the format MQTT:sonoffth1/Temperature as below

Now move on to the Status Graphics Page. As this is your device you can customise this to suit your needs but for a Temperature reading we're going to probably want to see the value to two decimal places and with a 'c' or 'f' after it. To do this delete the single values 0 and 100 and remove the status graphics. Now create a New Range Value and give it a sensible range -99 to 99. Set the prefix to nothing, the suffix to " c " or " F " and click Status under "Status-Control". Now you can add a "New Range Graphic" and add some icons to the range. Your screen should look something like this

You can of course customse this to your needs. For example here you could have three ranges, -99 to 0 which could be a 'freeze' icon, 1 to 20 which could be a normal icon and 21 to 99 which could be a Hot icon. Its your device so configure it how you see fit. The plug-in simple needs to have somewhere to store the value, the rest is up to you. 

Now click DONE and repeat the steps above for any additional sensors you want to setup. 

Remember, you create devices for the sensor values you want and only the ones you want. The Sonoff POW for example has a range of values but the only one I want to see is the current Wattage. 

KEY FACT: The plug-in looks for a topic which has "POWER" in it, if it finds that then it assumes its a binary on/off device, otherwise I assumes its a sensor. For example here in the Sonoff POW you could have two devices MQTT:sonoffpow/POWER which is considered ON/OFF and MQTT:sonoffpow/Power which is a sensor for Power used. 

 

Sonoff Tasmota Outputs and Sensor Names

 

Sonoff Device Output/Sensor Name
Sonoff Basic POWER
Sonoff DUAL

POWER1

POWER2

Sonoff TH16

POWER

Temperature

Humidity

Sonoff 4CH

POWER1

POWER2

POWER3

POWER4

 Sonoff SC (Socket)  
 Sonoff Touch

POWER1

POWER2

POWER3

 Sonoff POW

POWER

Total

Yesterday

Today

Period

Power

Factor

Voltage

Current

 

For some background and an overview of Design and Development Follow this link

 

Development and Support for this plug-ins is free or charge. If you appreciate our work then please consider a small donation.

Amount