MQTT comunication between Indigo and Home assistant

Posted on
Fri Mar 20, 2020 8:43 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: MQTT comunication between Indigo and Home assistant

Unfortunately still no go.

Not sure if it is relevant, but when I try to validate the json that is the default device template I get the following. Is there an error in the json?
Attachments
Skjermbilde 2020-03-20 kl. 15.41.17.png
Skjermbilde 2020-03-20 kl. 15.41.17.png (47.44 KiB) Viewed 2145 times

Håvard

Posted on
Fri Mar 20, 2020 8:46 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: MQTT comunication between Indigo and Home assistant

The template itself is not valid JSON. You need to attempt to validate the string after it's gone through the template engine and the values have been substituted into the template.

Turn on debug logging, update a device that's published, and look in the log. You'll see a line like this:

Code: Select all
   MQTT Connector Debug            Motion Sensor: deviceUpdated: publishing device - payload = {"name": "Motion Sensor", "deviceId":"900634645","model": "Example On/Off Sensor Module", "address": "123456", "states": { "backlightBrightness": "0", "onOffState": "False" } }


The string after the "payload = " should be valid JSON:

Code: Select all
 {"name": "Motion Sensor", "deviceId":"900634645","model": "Example On/Off Sensor Module", "address": "123456", "states": { "backlightBrightness": "0", "onOffState": "False" } }

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

Posted on
Fri Mar 20, 2020 8:49 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: MQTT comunication between Indigo and Home assistant

I did just make a change so that the default templates use double-quotes instead of single quotes. Try changing your template to this:

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

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

Posted on
Fri Mar 20, 2020 8:59 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: MQTT comunication between Indigo and Home assistant

I only get this information when enabling debugging messages and activate the sensor:

Code: Select all
   Z-Wave                          received "MS - Motion - Office" status update is on
   Trigger                         Last Motion - Kontor
   MQTT Connector Debug            MS - Motion - Office: deviceUpdated: publishing device


It is the MQTT Connector plugin 0.3.3 that I should for this?

Håvard

Posted on
Fri Mar 20, 2020 9:07 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: MQTT comunication between Indigo and Home assistant

Oops. I added that additional info in my internal build. I'll probably release it later today. I'm testing a fix for a different issue now.

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

Posted on
Fri Mar 20, 2020 9:11 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: MQTT comunication between Indigo and Home assistant

No worries
I tried your double quotes, but no success. It looks like the picture below when recieved on HA. And the variable is working instantly... So a bit confusing.
Attachments
Skjermbilde 2020-03-20 kl. 16.09.52.png
Skjermbilde 2020-03-20 kl. 16.09.52.png (38.91 KiB) Viewed 2153 times

Håvard

Posted on
Fri Mar 20, 2020 9:16 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: MQTT comunication between Indigo and Home assistant

That certainly looks correct. What's the config.yaml entry look like?

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

Posted on
Fri Mar 20, 2020 9:22 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: MQTT comunication between Indigo and Home assistant

Excellent!
I tried one more time with the doubble quotes and your suggestion for value_template, and now it seams to update :D

Code: Select all
  - platform: mqtt
    name: "Motion Sensor Office"
    state_topic: "indigo/devices/1358686939/update"
    payload_on: "True"
    payload_off: "False"
    qos: 0
    device_class: motion
    value_template: '{{value_json.states.onOffState}}'

Håvard

Posted on
Fri Mar 20, 2020 9:27 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: MQTT comunication between Indigo and Home assistant

Great. Do you see how to duplicate that to get other values from the payload? Looks pretty straightforward.

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

Posted on
Fri Mar 20, 2020 9:29 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: MQTT comunication between Indigo and Home assistant

Yes I think so. Let me play with it a little and see if I figure it out :)
My goal is to use this to implement google home in my setup. Thanks a lot for your help.

Håvard

Posted on
Mon Mar 23, 2020 4:20 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: MQTT comunication between Indigo and Home assistant

I have now been testing with some different sensors and it is very stable.
I have been able to pull out motion, temperature and light level so far with the publish template. But if I am going to control something in Indigo with google home integrated to HA I am going to need the communication to go both directions.

Is it possible today, to control an Indigo (dimmer) externally with your plugins? I have looked at creating a mqtt device in HA and have the following in the configuration.yaml

Code: Select all
  # mqtt dimmer
  - platform: mqtt
    name: "Living room downlight couch"
    state_topic: "light/livingroom/couch/status"
    command_topic: "light/livingroom/couch/switch"
    brightness_state_topic: 'light/livingroom/couch/brightness'
    brightness_command_topic: 'light/livingroom/couch/brightness/set'
    qos: 0
    payload_on: "ON"
    payload_off: "OFF"
    optimistic: false


So the intended device to control is a z-wave device connected to Indigo.

Håvard

Posted on
Mon Mar 23, 2020 7:58 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: MQTT comunication between Indigo and Home assistant

It's certainly possible, but not simple. You would need to create an Event Trigger that runs when the specific device control topic is received, probably with a condition to check the payload (ON or OFF, for example), then the action required. For a switch type device, that would require two triggers. For a dimmer, three triggers. If you want to do multiple devices, it's going to add up to a lot of triggers.

That particular use case was not one that I accounted for in the design of the plugin. It's sort of the inverse of the Shim device usage.

I'll take a look at adding functionality to the plugin to make this easier to implement.

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

Posted on
Mon Mar 23, 2020 8:27 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: MQTT comunication between Indigo and Home assistant

Based on that I think I will hold on and hope for a future release


Sent from my iPhone using Tapatalk

Håvard

Posted on
Sat Mar 28, 2020 9:35 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: MQTT comunication between Indigo and Home assistant


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

Posted on
Sun Mar 29, 2020 10:22 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: MQTT comunication between Indigo and Home assistant

Exiting!
This is definitely something to play around with.
I have been able to trigger a on/off command from my Mqtt Explorer (OSX app), but I am as of now struggling a bit more to do it from HA.

The on/off command that comes from my Switch in HA looks like this

Code: Select all
Message 15 received on indigo/devices/1752710570/command at 6:15 PM:
off


How would I need to configure it on the Indigo side to receive this message?

Also, in Indigo it looks like this when I recieve on or off on the subscribed topic:
Code: Select all
   MQTT Connector Debug            MQTT: Message received: indigo/devices/1752710570/command/, payload: off
   MQTT Connector Debug            MQTT: Saved states, topic: indigo/devices/1752710570/command/, payload: off
   MQTT Connector Debug            MQTT: Device command match, DevId: 1752710570, command: , payload: off
   MQTT Connector Debug            MQTT: Message received: indigo/devices/1752710570/command/, payload: on
   MQTT Connector Debug            MQTT: Saved states, topic: indigo/devices/1752710570/command/, payload: on
   MQTT Connector Debug            MQTT: Device command match, DevId: 1752710570, command: , payload: on

Håvard

Who is online

Users browsing this forum: No registered users and 3 guests