Home Assistant MQTT Discovery

Posted on
Thu Apr 23, 2020 6:06 am
siclark offline
Posts: 1333
Joined: Jun 13, 2017
Location: UK

Re: Home Assistant MQTT Discovery

Hackencrash wrote:
The big picture is to integrate Android and iPhones together using your plugin, so you can say "Hey Siri" or "OK Google" and control all devices the same.

I have all my devices in Indigo as the central hub and getting Siri to work was easy - Homebridge.

To use Google Android, I will need to create replicas of all the Indigo devices in Home Assistant via MQTT and subsequently link this to Google Home Assistant for OK Google speech control to work.

I want to be able to create a device once in Indigo and for that to be automatically visible via Google.

No more phone wars, everything is just a device that works!


I am keen to see how the HAAS link up comes along, but for anyone else wanting a simple way to get both Alexa and Google Home Assistant working, the Alexa node-red skill that several of us are using to get Alexa working again also works for Google,. So if you are using for Alexa, you get it free for Google.

Posted on
Thu Apr 23, 2020 10:41 am
Hackencrash offline
User avatar
Posts: 203
Joined: Dec 16, 2015
Location: UK

Re: Home Assistant MQTT Discovery

I've previously looked at the HassBridge plugin by the way - posted an outstanding issue on Github which is currently preventing me moving forward with that plugin. Plugin looks great but I need something that is working today.

Posted on
Thu Apr 23, 2020 11:26 am
FlyingDiver offline
User avatar
Posts: 4261
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Home Assistant MQTT Discovery

Release 0.4.2 will be on the plugin store momentarily.

Added device capability keys to the dictionary available for publishing templates. The dict now looks something like this:

{
'name': u'Example Sensor',
'deviceId': 1379277130,
'address': u'123456',
'model': u'Example On/Off Sensor Module',
'states': [
{'name': u'backlightBrightness', 'value': 0},
{'name': u'sensorValue', 'value': 82.4},
{'name': u'sensorValue.ui', 'value': u'82.4 \xb0F'}
],
'supportsAllLightsOnOff': True,
'supportsAllOff': True,
'supportsOnState': True,
'supportsSensorValue': True,
'supportsStatusRequest': True,
}
The "supportsXXX" keys are new. All device attributes starting with "supports" are added to the list. The actual keys present will be different for different devices. Only "True" keys will be included.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Apr 23, 2020 11:51 am
Hackencrash offline
User avatar
Posts: 203
Joined: Dec 16, 2015
Location: UK

Re: Home Assistant MQTT Discovery

Thanks for this - downloaded.

In the Device Publishing Template, how do I specify to include all the supportsXXX keys?

Something like "supports": { {{#supports}} "{{name}}": "{{value}}", {{/supports}} } } ??

If you have changed this default template, please could you post the new one as it's kept my old settings for the upgrade?

Posted on
Thu Apr 23, 2020 12:06 pm
FlyingDiver offline
User avatar
Posts: 4261
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Home Assistant MQTT Discovery

Oops. That was probably not the best way to include that data. I've pulled the 0.4.2 release, and will upload a 0.4.2 release shortly.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Apr 23, 2020 12:19 pm
FlyingDiver offline
User avatar
Posts: 4261
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Home Assistant MQTT Discovery

Release 0.4.3 has replaced 0.4.2.

Replaces 0.4.2 template data method. Template data dict now looks like:

Code: Select all
{
    "name": "Example Sensor",
    "deviceId":"1379277130",
    "model": "Example On/Off Sensor Module",
    "address": "123456",
    "states": {
        "backlightBrightness": "0",
        "sensorValue": "78.1",
        "sensorValue.ui": "78.1 °F"
    },
    "capabilities": {
        "supportsAllLightsOnOff": "True",
        "supportsAllOff": "True",
        "supportsOnState": "True",
        "supportsSensorValue": "True",
        "supportsStatusRequest": "True"
    }
}

Updated default templates in devices to match. Template now looks like:

Code: Select all
"name": "{{name}}",
"deviceId": "{{deviceId}}",
"model": "{{model}}",
"address": "{{address}}",
"states":   { {{#states}} "{{name}}": "{{value}}", {{/states}} } },
"capabilities": { {{#capabilities}} "{{name}}": "{{value}}", {{/capabilities}} } }


Which gives a payload like this (from MQTT Explorer):
Code: Select all
{"name": "Example Sensor", "deviceId":"1379277130","model": "Example On/Off Sensor Module", "address": "123456", "states": { "backlightBrightness": "0", "sensorValue": "78.1", "sensorValue.ui": "78.1 °F" }, "capabilities": { "supportsAllLightsOnOff": "True", "supportsAllOff": "True", "supportsOnState": "True", "supportsSensorValue": "True", "supportsStatusRequest": "True" } }

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Apr 23, 2020 12:39 pm
Hackencrash offline
User avatar
Posts: 203
Joined: Dec 16, 2015
Location: UK

Re: Home Assistant MQTT Discovery

Great - thanks for this.

I'm guessing the default Device Publishing Template Topic is still indigo/devices/{{deviceId}}/update ?

Would it make sense do you think to have a way of reverting back to defaults for the template values as reinstalling the plugin or deleting all the data (2 options I've tried) does not restore this?

I like the new supportsXXX stuff. I'm seeing a lot of unusual supportsXXX keys for my devices. I'm guessing that these are only the writable settings that can be set which makes sense?

Posted on
Thu Apr 23, 2020 12:55 pm
FlyingDiver offline
User avatar
Posts: 4261
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Home Assistant MQTT Discovery

Hackencrash wrote:
Great - thanks for this.

I'm guessing the default Device Publishing Template Topic is still indigo/devices/{{deviceId}}/update ?


There was no reason to change that.

Hackencrash wrote:
Would it make sense do you think to have a way of reverting back to defaults for the template values as reinstalling the plugin or deleting all the data (2 options I've tried) does not restore this?


That's a lot of work, with no good place in the UI for the control. You should be able to copy and paste from my post above easily enough. Or copy it to an editor (if you've already made changes) make the change, and copy it back. Or just recreate the connector device.

Hackencrash wrote:
I like the new supportsXXX stuff. I'm seeing a lot of unusual supportsXXX keys for my devices. I'm guessing that these are only the writable settings that can be set which makes sense?


There's a lot of them that Indigo supports, but there isn't a single place that they're listed, that I know of. Each device type has their own list of possible attributes. I'm just pulling them from the device on the fly (as it's being published), so I don't have a list of them either.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Apr 23, 2020 1:48 pm
Hackencrash offline
User avatar
Posts: 203
Joined: Dec 16, 2015
Location: UK

Re: Home Assistant MQTT Discovery

I'm not too sure what to make of this supportsXXX data.

What is shown below is a mains plug-in z-wave light dimmer which somehow is shown here to have the ability to support RGB Colour :?

Code: Select all
"name": "Dining Room Desk Light",
"deviceId": "1121785643",
 "model": "Mulitlevel Switch",
"address": "9",
"states": { "brightnessLevel": "30", "onOffState": "True" } },
"capabilities": { "supportsAllLightsOnOff": "True", "supportsAllOff": "True", "supportsColor": "True", "supportsRGB": "True", "supportsRGBandWhiteSimultaneously": "True", "supportsStatusRequest": "True", "supportsTwoWhiteLevels": "True", "supportsTwoWhiteLevelsSimultaneously": "True", "supportsWhite": "True", "supportsWhiteTemperature": "True" } }


How would I go about verifying that this data is correct as this is only a dimmer?

As this is a z-wave device, is it saying that the z-wave plugin in general has the ability to support colour perhaps?

Posted on
Thu Apr 23, 2020 2:02 pm
matt (support) offline
Site Admin
User avatar
Posts: 20037
Joined: Jan 27, 2003
Location: Texas

Re: Home Assistant MQTT Discovery

Does that dimmer create a group of devices (shown as tabs/panels in its Device dialog)? Some dimmers will report they support additional Z-Wave command classes (like color) but sometimes that only refers to the status LED on the dimmer switch itself, not the type of load connected to the dimmer. In these cases we normally create an Indigo device definition so that the status LED is shown as its own device (within a group that includes the device for the load controller).

What specific model dimmer is this? And can you re-sync it in Indigo and copy/paste the Event Log results into a reply so I can see all the details of what it is reporting?

Image

Posted on
Thu Apr 23, 2020 2:10 pm
FlyingDiver offline
User avatar
Posts: 4261
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Home Assistant MQTT Discovery

FYI, I'm creating that dict like this:
Code: Select all
    for key in dir(device):
        if key.find("supports") > -1:
            dev_data['capabilities'].append({'name': key, 'value': True})

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Apr 23, 2020 3:36 pm
Hackencrash offline
User avatar
Posts: 203
Joined: Dec 16, 2015
Location: UK

Re: Home Assistant MQTT Discovery

This is only one z-wave device - no tabs. It is a UK plug-in dimmer module

HomePro Lamp Module ZDP210

Here is the sync log:

Z-Wave Syncing - started for "Dining Room Desk Light"
Z-Wave Syncing - retrieved module neighbors list: 5, 7, 10, 11, 12, 18, 34, 39, 44, 51, 54, 57, 61, 67, 68
Z-Wave Syncing - retrieved class hierarchy: Slave : Mulitlevel Switch : -- (03 : 11 : 00, base 26)
Z-Wave Syncing - retrieved command classes: 20v1 75v1 26v1 27v1
Z-Wave Syncing - retrieved encrypt commands: - none -
Z-Wave Syncing - retrieved capabilities: - none -
Z-Wave Syncing - complete
Z-Wave sent "Dining Room Desk Light" status request
Z-Wave received "Dining Room Desk Light" status update brightness 34

Posted on
Thu Apr 23, 2020 3:50 pm
Hackencrash offline
User avatar
Posts: 203
Joined: Dec 16, 2015
Location: UK

Re: Home Assistant MQTT Discovery

Here is a list of keys from that device. It contains no 'supports' that I can see:

>>> for key in dir(1121785643):
... print key
...
__abs__
__add__
__and__
__class__
__cmp__
__coerce__
__delattr__
__div__
__divmod__
__doc__
__float__
__floordiv__
__format__
__getattribute__
__getnewargs__
__hash__
__hex__
__index__
__init__
__int__
__invert__
__long__
__lshift__
__mod__
__mul__
__neg__
__new__
__nonzero__
__oct__
__or__
__pos__
__pow__
__radd__
__rand__
__rdiv__
__rdivmod__
__reduce__
__reduce_ex__
__repr__
__rfloordiv__
__rlshift__
__rmod__
__rmul__
__ror__
__rpow__
__rrshift__
__rshift__
__rsub__
__rtruediv__
__rxor__
__setattr__
__sizeof__
__str__
__sub__
__subclasshook__
__truediv__
__trunc__
__xor__
bit_length
conjugate
denominator
imag
numerator
real

Posted on
Thu Apr 23, 2020 4:51 pm
jay (support) offline
Site Admin
User avatar
Posts: 16271
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Home Assistant MQTT Discovery

That's a dir on the integer 1121785643, so not useful... :wink:

You'd want to do dir() on the instance itself, not the ID.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Apr 23, 2020 4:56 pm
FlyingDiver offline
User avatar
Posts: 4261
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Home Assistant MQTT Discovery

Even better, do:

Code: Select all
indigo.server.log(unicode(indigo.devices[1121785643]))

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 0 guests