-
Platform information:
- Hardware: CPUArchitecture/RAM/storage
- OS: what OS is used and which version
- Java Runtime Environment: which java platform is used and what version
- openHAB version: OpenHab 3.2.0
I have added MQTT-Broker, is online, so o.k.
I have added a Generic MQTT Thing, is online, so o.k.
With Mqtt.fx subscribing
“tasmota/discovery/F008D1D7F180/sensors”
i receive
{"sn":{"Time":"2022-02-28T15:35:44","COUNTER":{"C1":4,"C2":93,"C3":58},"ESP32":{"Temperature":34.4},"TempUnit":"C"},"ver":1}
my channel is
`UID: mqtt:topic:NanoPiM4:ESP32
label: Generic MQTT Thing
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:NanoPiM4
channels:
- id: Counter1
channelTypeUID: mqtt:number
label: Counter Gas
description: “”
configuration:
stateTopic: tasmota/discovery/F008D1D7F180/sensors
postCommand: false`
How can I set this in a way that i get “COUNTER C1”, COUNTER C2 and COUNTER C3 in separate channels.
-
Issue of the topic: please be detailed explaining your issue
-
Please post configurations (if applicable):
- Items configuration related to the issue
- Sitemap configuration related to the issue
- Rules code related to the issue
- Services configuration related to the issue
-
If logs where generated please post these here using code fences:
Welcome to the openHAB forum :wave
In the present config your channel receives the complete JSON string. Using JSONPath transformation you can limit that to the needed value. Create three channels, each with a different transformation pattern.
JSONPath transformation needs to be installed for that.
For the temperature you would need a pattern like:
transformationPattern:
JSONPATH:$.sn.ESP32.Temperature
Thank You very much for the hint.
I will think about that but my knowledge on that is quite limited.
I’d prefer flashing the esp32 with arduino and define the counters seperatly.