Mr. MQTT Jedi, while you have a chance to work on the Nexia plugin, I am trying to get a few details from my Nexia thermostat using MQTT and Home Assistant. Got the temperature and humidity without any issues. However, having a problem understanding how to get the "system status", a string, configured.
The topic looks like this:
So, trying to configure the device as such:
Device type: Generic JSON
What am I doing wrong?
Thank you!!
JP
Getting value from JSON into device
Getting value from JSON into device
- Attachments
-
- Screen Shot 2021-10-18 at 9.36.23 AM.png (163.38 KiB) Viewed 2007 times
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Getting value from JSON into device
It doesn't look like you're showing the complete topic string there. It easier to see what's going on if you configure the MQTT Connector plugin to subscribe to the topics you want, then put it in debug level logging so it logs the topics and payloads.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: Getting value from JSON into device
This is from the debug mgs and exactly the info I would like to collect via a Shims device:
processMessages: '##haSensors##' homeassistant/sensor/house_system_status/state -> System Idle
is this enough to point me in the right direction?
JP
processMessages: '##haSensors##' homeassistant/sensor/house_system_status/state -> System Idle
is this enough to point me in the right direction?
JP
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Getting value from JSON into device
From that, it looks like the payload for that topic is NOT a JSON string, but a plain text string. I'm not sure the Shims plugin can deal with that the way you want. Is there any way to get HA to send actual JSON?
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: Getting value from JSON into device
Not sure, but I will check. Will let you know
Thank you!
Thank you!
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Getting value from JSON into device
If not, you can modify this script to get the payload and put it in a variable. Edit as needed and run as an external script.
The deviceid in the call to mqttPlugin.executeAction() is the MQTT Connector device.
Code: Select all
#! /usr/bin/env python
# -*- coding: utf-8 -*-
####################
import json
import time
import indigo
mqttPlugin = indigo.server.getPlugin("com.flyingdiver.indigoplugin.mqtt")
if mqttPlugin.isEnabled():
props = {
'message_type':"#Test#"
}
while True:
message_data = mqttPlugin.executeAction("fetchQueuedMessage", deviceId=1867973662, props=props, waitUntilDone=True)
if message_data != None:
indigo.server.log("Queue Fetch, version = {}, message_type = {}, topic_parts = {}".format(message_data["version"], message_data["message_type"], message_data["topic_parts"]))
payload = json.loads(message_data["payload"])
indigo.server.log("Queue Fetch, payload = {}".format(payload))
else:
time.sleep(1.0)
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: Getting value from JSON into device
as always, you rock!! thank you!
JP
JP