Using this data point that you posted earlier, I formatted it a bit to 
better show the json structure.
21:54:27.154 MQT: sensors/BMP280/SENSOR = 
{
  "Time":"2021-05-12T21:54:27",
  " BMP280":
    {
      "Temperature":22.0,
      "Pressure":990.8
    },
  "PressureUnit":"hPa",
  "TempUnit":"C"
}

You’ve got one topic, ‘sensors/BMP280/SENSOR’ that is publishing json data.
You’ve got four top level fields, ‘Time’, ‘BMP280’, ‘PressureUnit’, and 
‘TempUnit’.
‘BMP280’ is an object consisting of two fields, ‘ Temperature’, and 
‘Pressure’. I am calling this ‘nested json’. This will result in 2 fields 
named ‘BMP280_Temperature’ and ‘BMP280_Pressure’.

So, your configuration should be something like this.
# The message handler to use
    [[message_callback]]
        # The format of the MQTT payload.
        # Currently support: individual, json, keyword
        # Must be specified.
        type = json
    
    # The topics to subscribe to.
    [[topics]]
        # Units for MQTT payloads without unit value.
        # Valid values: US, METRIC, METRICWX
        # Default is: US
        unit_system = METRIC

        [[[sensors/BMP280/SENSOR]]]
            [[[[Time]]]]
                ignore = true         
            
            [[[[BMP280_Temperature]]]]
                # The WeeWX name.
                # Default is the name from MQTT.
                name = appTemp1

            [[[[BMP280_Pressure]]]]
                # The WeeWX name.
                # Default is the name from MQTT.
                name = barometer
                
            # The incoming field name from MQTT.
            [[[[PressureUnit]]]]
                ignore = true
                
            # The incoming field name from MQTT.
            [[[[TemperatureUnit]]]]
                ignore = true

rich
On Thursday, 13 May 2021 at 10:37:54 UTC-4 [email protected] wrote:

> I've been looking at Rich Bell's nested json example here:
> https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/json-example
> He shows a first topic, second topic, third topic, etc.
>
> If you include the time, I think this BMP280 has 5 topics?  (Time, 
> Temperature, Pressure, PressureUnit, TempUnit)
> Here's what I've got now: in my weewx.conf file:
>
>     # The message handler to use
>     [[message_callback]]
>         # The format of the MQTT payload.
>         # Currently support: individual, json, keyword
>         # Must be specified.
>         type = json
>     
>         # When the json is nested, the delimiter between the hierarchies.
>         # Default is _.
>         flatten_delimiter = "_"
>     
>     # The topics to subscribe to.
>     [[topics]]
>         # Units for MQTT payloads without unit value.
>         # Valid values: US, METRIC, METRICWX
>         # Default is: US
>         unit_system = METRIC
>   
>         use_server_datetime = True
>         ignore_start_time = True
>         ignore_end_time = True
>         
>         [[[first/topic]]]
>             # The incoming field name from MQTT.
>             [[[[Time]]]]
>                 ignore = true         
>             
>         [[[second/topic]]]                
>             [[[[BME280_Temperature]]]]
>                 # The WeeWX name.
>                 # Default is the name from MQTT.
>                 name = appTemp1
>                 units = degree_C  
>
>             [[[[BME280_Pressure]]]]
>                 # The WeeWX name.
>                 # Default is the name from MQTT.
>                 name = barometer
>                 units = hPa
>                 
>         [[[third/topic]]]
>             # The incoming field name from MQTT.
>             [[[[PressureUnit]]]]
>                 ignore = true
>                 
>         [[[fourth/topic]]]
>             # The incoming field name from MQTT.
>             [[[[TemperatureUnit]]]]
>                 ignore = true
>
>
>> Op donderdag 13 mei 2021 om 05:32:15 UTC+2 schreef [email protected]:
>>
>>> Here's what I've got in my weewx.conf file thus far.  
>>> Does this look close to correct, when you compare it to the MQTT message 
>>> from the Tasmota log?
>>>
>>>
>>> 21:54:27.154 MQT: sensors/BMP280/SENSOR = 
>>> {"Time":"2021-05-12T21:54:27","BMP280":{"Temperature":22.0,"Pressure":990.8},"PressureUnit":"hPa","TempUnit":"C"}
>>>
>>>
>>> ############################################################################
>>> # Options for 'MQTTSubscribeService'
>>> [MQTTSubscribeService]
>>>     # This section is for the MQTTSubscribe service.
>>>     
>>>     # Turn the service on and off.
>>>     # Default is: true
>>>     # Only used by the service.
>>>     enable = false
>>>     
>>>     # The MQTT server.
>>>     # Default is localhost.
>>>     host = localhost
>>>     
>>>     # The port to connect to.
>>>     # Default is 1883.
>>>     port = 1883
>>>     
>>>     # Maximum period in seconds allowed between communications with the 
>>> broker.
>>>     # Default is 60.
>>>     keepalive = 60
>>>     
>>>     # username for broker authentication.
>>>     # Default is None.
>>>     username = None
>>>     
>>>     # password for broker authentication.
>>>     # Default is None.
>>>     password = None
>>>     
>>>     # The binding, loop or archive.
>>>     # Default is: loop
>>>     # Only used by the service.
>>>     binding = loop
>>>     
>>>     # The message handler to use
>>>     [[message_callback]]
>>>         # The format of the MQTT payload.
>>>         # Currently support: individual, json, keyword
>>>         # Must be specified.
>>>         type = json
>>>     
>>>         # When the json is nested, the delimiter between the hierarchies.
>>>         # Default is _.
>>>         flatten_delimiter = "_"
>>>     
>>>     # The topics to subscribe to.
>>>     [[topics]]
>>>         # Units for MQTT payloads without unit value.
>>>         # Valid values: US, METRIC, METRICWX
>>>         # Default is: US
>>>         unit_system = METRIC
>>>         
>>>         [[[first/topic]]]
>>>             # The incoming field name from MQTT.
>>>             [[[[Time]]]]
>>>                 # left side is the name from MQTT.
>>>                 # right side is the WeeWX name.
>>>                 Time = dateTime           
>>>             
>>>         [[[second/topic]]]      
>>>             # The incoming field name from MQTT.          
>>>             [[[[BME280_Temperature]]]]
>>>                 # left side is the name from MQTT.
>>>                 # right side is the WeeWX name.
>>>                 Temperature = extraTemp1
>>>
>>>             [[[[BME280_Pressure]]]]
>>>                 # left side is the name from MQTT.
>>>                 # right side is the WeeWX name.
>>>                 Pressure = barometer
>>>                 
>>>         [[[third/topic]]]
>>>             # The incoming field name from MQTT.
>>>             [[[[PressureUnit]]]]
>>>                 # left side is the name from MQTT.
>>>                 # right side is the WeeWX name.
>>>                 PressureUnit = ??
>>>                 
>>>         [[[fourth/topic]]]
>>>             # The incoming field name from MQTT.
>>>             [[[[TemperatureUnit]]]]
>>>                 # left side is the name from MQTT.
>>>                 # right side is the WeeWX name.
>>>                 TempUnit = ??
>>>
>>> On Wednesday, May 12, 2021 at 10:05:22 PM UTC-5 Eric Koester wrote:
>>>
>>>> Maybe this line from the Tasmota Console (log) is a clue?
>>>>
>>>> 21:54:27.154 MQT: sensors/BMP280/SENSOR = 
>>>> {"Time":"2021-05-12T21:54:27","BMP280":{"Temperature":22.0,"Pressure":990.8},"PressureUnit":"hPa","TempUnit":"C"}
>>>>
>>>> On Wed, May 12, 2021 at 9:54 PM Eric Koester <[email protected]> 
>>>> wrote:
>>>>
>>>>> I've got a BMP280 sensor (only 2 internal sensors) connected to an 
>>>>> ESP-12F module, running Tasmota firmware.
>>>>> The example I'm following is a BME280 which has 3 internal sensors.
>>>>> https://tasmota.github.io/docs/BME280/
>>>>> Rich Bell mentioned that the BME280 (and BMP280) data is json and 
>>>>> nested and that the data would come through as BMP280_Temperature, 
>>>>> BMP280_Pressure.
>>>>> [image: Tasmota_Main-screen_BMP280.jpg]
>>>>>
>>>>> I roughly configured the MQTT settings in Tasmota and you can see it's 
>>>>> made connection with the mosquitto broker.
>>>>> section of /var/log/mosquitto/mosquitto.log file:
>>>>> *1620871934: New connection from 192.168.7.132 on port 1883.*
>>>>> *1620871934: New client connected from 192.168.7.132 as ESP-12F_1 (p2, 
>>>>> c1, k30, u'ESP-12F_USER').*
>>>>> *1620872759: Saving in-memory database to 
>>>>> /var/lib/mosquitto/mosquitto.db.*
>>>>>
>>>>> I'm not clear what I should set the Topic and Full Topic fields to in 
>>>>> the Tasmota MQTT screen.
>>>>>
>>>>> [image: Tasmota_MQTT-settings_1.jpg]  
>>>>>
>>>>>
>>>>> On Wednesday, May 12, 2021 at 6:24:46 PM UTC-5 Eric Koester wrote:
>>>>>
>>>>>> For those following along, I discovered that the mosquitto_pub & 
>>>>>> mosquitto_sub clients were automatically installed when I installed 
>>>>>> mosquitto into Ubuntu.  Here was the tip-off:
>>>>>> *weewx@Ubuntu20-WEEWX:~$ sudo apt install mosquitto-clients*
>>>>>> *Reading package lists... Done*
>>>>>> *Building dependency tree       *
>>>>>> *Reading state information... Done*
>>>>>> *mosquitto-clients is already the newest version (1.6.12-1).*
>>>>>> *0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.*
>>>>>>
>>>>>> I found some Youtube videos by Steve Cope which show examples of 
>>>>>> using the commands.
>>>>>> https://youtu.be/J4pqv9__uzE
>>>>>>
>>>>>> He mentions using the debug switch (-d) so you can see that the 
>>>>>> commands are doing something - very useful!
>>>>>>
>>>>>> Running mosquitto_pub in one terminal window and mosquitto_sub in 
>>>>>> another is showing feedback of success!
>>>>>>
>>>>>> *weewx@Ubuntu20-WEEWX:~$ mosquitto_pub -h 192.168.7.22 -p 1883 -t 
>>>>>> sensors/temperature -m "1266193804 32" -d*
>>>>>> *Client mosq-6o6U1MqsMVovfxfZta sending CONNECT*
>>>>>> *Client mosq-6o6U1MqsMVovfxfZta received CONNACK (0)*
>>>>>> *Client mosq-6o6U1MqsMVovfxfZta sending PUBLISH (d0, q0, r0, m1, 
>>>>>> 'sensors/temperature', ... (13 bytes))*
>>>>>> *Client mosq-6o6U1MqsMVovfxfZta sending DISCONNECT*
>>>>>>
>>>>>> *weewx@Ubuntu20-WEEWX:/etc/mosquitto$ mosquitto_sub -h 192.168.7.22 
>>>>>> -p 1883 -t sensors/temperature -d*
>>>>>> *Client mosq-VJoHFtTvE0io4OBXfe sending CONNECT*
>>>>>> *Client mosq-VJoHFtTvE0io4OBXfe received CONNACK (0)*
>>>>>> *Client mosq-VJoHFtTvE0io4OBXfe sending SUBSCRIBE (Mid: 1, Topic: 
>>>>>> sensors/temperature, QoS: 0, Options: 0x00)*
>>>>>> *Client mosq-VJoHFtTvE0io4OBXfe received SUBACK*
>>>>>> *Subscribed (mid: 1): 0*
>>>>>> *Client mosq-VJoHFtTvE0io4OBXfe received PUBLISH (d0, q0, r0, m0, 
>>>>>> 'sensors/temperature', ... (13 bytes))*
>>>>>> *1266193804 32*
>>>>>> *Client mosq-VJoHFtTvE0io4OBXfe sending PINGREQ*
>>>>>> *Client mosq-VJoHFtTvE0io4OBXfe received PINGRESP*
>>>>>>
>>>>>  
>>>
>>>> On Wednesday, May 12, 2021 at 3:20:05 PM UTC-5 [email protected] wrote:
>>>>>>
>>>>>>> As Greg said, make sure your MQTT infrastructure is up and running 
>>>>>>> correctly. Since you installed your own broker, a first check is to use 
>>>>>>> mosquitto_sub and mosquitto_pub to a test topic. Once that is working, 
>>>>>>> use 
>>>>>>> mosquitto_sub to subscribe to the broker and topic(s) that you want 
>>>>>>> MQTTSubscribe to subscribe to. This will also provide you with the MQTT 
>>>>>>> message. The actual message will be useful as you configure 
>>>>>>> WeeWX/MQTTSubscribe.
>>>>>>>
>>>>>>> Next read https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki. 
>>>>>>> This will outline the install steps and point you to 
>>>>>>> https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring, 
>>>>>>> which has the information on configuring WeeWX/MQTTSubscribe. This page 
>>>>>>> will also provide you with links to configuration examples by payload 
>>>>>>> ‘type’.
>>>>>>> rich
>>>>>>>
>>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/472f3a4b-26a8-462a-be77-5357fff6a989n%40googlegroups.com.

Reply via email to