Is it possible to define a Shim for device1 and get the temperature mapped to the main UI state and the battery added as states of that device. Also if I was to create an equivalent humidity device based on device1, could I also get the battery mapped to a state for that device as well?Topic = topic1/device1/temperature, Raw payload = 24.50
Topic = topic1/device1/humidity, Raw payload = 80
Topic = topic1/device1/battery, Raw payload = 100
Multiple topics mapped to same Indigo Shim device?
Multiple topics mapped to same Indigo Shim device?
If I have messages such as:
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Multiple topics mapped to same Indigo Shim device?
No, not with individual topics with raw payloads. You can only get multiple values per device with JSON payloads.
I think. Let me check something...
I think. Let me check something...
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Multiple topics mapped to same Indigo Shim device?
On second thought, this is probably a good place to try out the somewhat experimental aggregator feature in the connector plugin.
Use the Connector Plugin menu command "Manage aggregators". Create an aggregator with the topic base "topic1/device1". The get the device to emit all the possible topics/payloads. Then use the menu command "Print aggregator data to log". That'll show what the payload for that topic will be if you set up a trigger to send it to a shim.
Just be warned that the key paths for the various fields in the payload are not what you might think they would be. Look at the payload carefully.
Use the Connector Plugin menu command "Manage aggregators". Create an aggregator with the topic base "topic1/device1". The get the device to emit all the possible topics/payloads. Then use the menu command "Print aggregator data to log". That'll show what the payload for that topic will be if you set up a trigger to send it to a shim.
Just be warned that the key paths for the various fields in the payload are not what you might think they would be. Look at the payload carefully.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: Multiple topics mapped to same Indigo Shim device?
Trying it out now.
I am getting the payload:
What is the best way to set-up the Shim to pull out the three states: Battery, Temperature and Humidity?
I have tried this:but I am getting an error:
I am getting the payload:
Code: Select all
{"topics": {"battery": {"payload": 100}, "temperature": {"payload": 28.41}, "humidity": {"payload": 30}}}I have tried this:but I am getting an error:
Code: Select all
Trigger he-temperature-02
MQTT Shims Debug received notification of MQTT message type ##he-temperature-02## from MQTT Connector
Trigger he-temperature-02
MQTT Shims Debug received notification of MQTT message type ##he-temperature-02## from MQTT Connector
Trigger he-temperature-02
MQTT Shims Debug received notification of MQTT message type ##he-temperature-02## from MQTT Connector
MQTT Shims Debug he-temperature-02: processMessages: '##he-temperature-02##' hubitat/home-hub-000d/he-temperature-02-sonoff-201 -> {"topics": {"battery": {"payload": 100}, "temperature": {"payload": 28.41}, "humidity": {"payload": 30}}}
MQTT Shims Debug he-temperature-02: update topic message_address = he-temperature-02-sonoff-201
MQTT Shims Debug he-temperature-02: update state_location_payload, key = topics.temperature.payload
MQTT Shims Debug recurseDict key_string = topics.temperature.payload, data_dict= {u'topics': {u'battery': {u'payload': 100}, u'temperature': {u'payload': 28.41}, u'humidity': {u'payload': 30}}}
MQTT Shims Debug recurseDict split[0] = topics, split[1] = temperature.payload
MQTT Shims Debug recurseDict key_string = temperature.payload, data_dict= {u'battery': {u'payload': 100}, u'temperature': {u'payload': 28.41}, u'humidity': {u'payload': 30}}
MQTT Shims Debug recurseDict split[0] = temperature, split[1] = payload
MQTT Shims Debug recurseDict key_string = payload, data_dict= {u'payload': 28.41}
MQTT Shims Debug he-temperature-02: shimValueSensor, key = topics.temperature.payload, data = {u'topics': {u'battery': {u'payload': 100}, u'temperature': {u'payload': 28.41}, u'humidity': {u'payload': 30}}}, value = 28.41
MQTT Shims Debug he-temperature-02: update adjustmentFunction: ''
MQTT Shims Debug he-temperature-02: Updating state to 28.41
MQTT Shims Debug recurseDict key_string = topics.battery.payload, data_dict= {u'topics': {u'battery': {u'payload': 100}, u'temperature': {u'payload': 28.41}, u'humidity': {u'payload': 30}}}
MQTT Shims Debug recurseDict split[0] = topics, split[1] = battery.payload
MQTT Shims Debug recurseDict key_string = battery.payload, data_dict= {u'battery': {u'payload': 100}, u'temperature': {u'payload': 28.41}, u'humidity': {u'payload': 30}}
MQTT Shims Debug recurseDict split[0] = battery, split[1] = payload
MQTT Shims Debug recurseDict key_string = payload, data_dict= {u'payload': 100}
MQTT Shims Debug he-temperature-02: update state_dict_payload_key, key = topics
MQTT Shims Debug recurseDict key_string = topics, data_dict= {u'topics': {u'battery': {u'payload': 100}, u'temperature': {u'payload': 28.41}, u'humidity': {u'payload': 30}}}
MQTT Shims Debug he-temperature-02: update, new states_list: Item : (list)
Item : battery (string)
Item : temperature (string)
Item : humidity (string)
MQTT Shims Debug he-temperature-02: getDeviceStateList returning: States : (list)
Item : (dict)
Disabled : false (bool)
Key : battery (string)
StateLabel : battery (string)
TriggerLabel : battery (string)
Type : 150 (integer)
Item : (dict)
Disabled : false (bool)
Key : temperature (string)
StateLabel : temperature (string)
TriggerLabel : temperature (string)
Type : 150 (integer)
Item : (dict)
Disabled : false (bool)
Key : humidity (string)
StateLabel : humidity (string)
TriggerLabel : humidity (string)
Type : 150 (integer)
MQTT Shims Error Error in plugin execution runConcurrentThread:
Traceback (most recent call last):
File "plugin.py", line 115, in runConcurrentThread
File "plugin.py", line 139, in processMessages
File "plugin.py", line 742, in update
TypeError: state value type must be bool, int, real, or string
MQTT Shims Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
SQL Logger adding column "batterylevel_ui" to table device_history_1363320665 ("he-temperature-02")
SQL Logger adding column "battery" to table device_history_1363320665 ("he-temperature-02")
SQL Logger adding column "humidity" to table device_history_1363320665 ("he-temperature-02")
SQL Logger adding column "temperature" to table device_history_1363320665 ("he-temperature-02")
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Multiple topics mapped to same Indigo Shim device?
You won't be able to use multi-states because of the way the payloads are nested. But you should be able to define a temp shim and a humidity shim, both showing battery status.
I had to do it that way because of varying topic lengths for the same topic base.
I had to do it that way because of varying topic lengths for the same topic base.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: Multiple topics mapped to same Indigo Shim device?
I removed topics from Multi-States Key and am now getting this:
The custom states are listed but empty.
The battery status is being shown as 100% OK.
Is this what you would expect?
It will work for me in its current state.
The battery status is being shown as 100% OK.
Is this what you would expect?
It will work for me in its current state.
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Multiple topics mapped to same Indigo Shim device?
Yeah, it created those states before you changed the setup, but it wasn't able to populate them. If you created this device from scratch without the multi-states field, they wouldn't be there.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: Multiple topics mapped to same Indigo Shim device?
As you suggested, I deleted and recreated the devices and now it is working perfectly.
The aggregator is a useful and nice feature!
No custom states now listed and both Indigo devices running off the same source device, a Sonoff temperature sensor.
The aggregator is a useful and nice feature!
No custom states now listed and both Indigo devices running off the same source device, a Sonoff temperature sensor.