You’ve got something working, I wouldn’t change it. But for future 
searches/reference, MQTTSubscribeService does have limited caching support (
https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Additional-Options#expires_after
).
The primary limitation is that MQTTSubscribeService must be bound to the 
NEW_ARCHIVE_RECORD event if the driver is running in ‘record_generation = 
hardware’ mode. Some additional information on this limitation is here, 
https://github.com/bellrichm/WeeWX-MQTTSubscribe/issues/178.
- rich
On Saturday 16 March 2024 at 04:38:29 UTC-4 Greg from Oz wrote:

> I use home automation (openHab) and the inside humidity and inside 
> temperature is something I am putting into the home automation so I used 
> that to resend every 2 minutes to weew mqttsubscribe. The openHab keeps the 
> last data it was sent. I use JSON.stringify to make it a json data pakage.
>
> Here is the openhab code (javascript)
>
> var TOPIC="weewx"
> temperature=(items.getItem("Zigbee_temperature_bedroom_xiaomi_greg").state)
> humidity=(items.getItem("Zigbee_humidity_bedroom_xiaomi_greg").state)
> var PAYLOAD=(JSON.stringify({"humidity": humidity, "temperature": 
> temperature}))
>
> result = actions.Exec.executeCommandLine(time.Duration.ofSeconds(5), 
> "/usr/bin/mosquitto_pub","\-h","192.168.1.164","\-t","" + TOPIC,"\-m","" + 
> PAYLOAD);
>
> console.log(JSON.stringify({"humidity": humidity, "temperature": 
> temperature}))
>
>
> And here is the weew.conf part.
>         # The second topic to subscribe to. 
>         [[[weewx]]]
>         #[[[zigbee2mqtt/sensor-xiaomi-greg]]]
>             ignore = true    # opt out of processing fields for this topic 
> by default - override per field
>            [[[[temperature]]]]
>                 name = inTemp
>
>                 # True if the incoming data should not be processed into 
> WeeWX.
>                 # Valid values: True, False
>                 # Default is False
>                 ignore = False
>
>                 # True if the incoming data is cumulative.
>                 # Valid values: True, False
>                 # Default is False
>                 contains_total = False
>            [[[[humidity]]]]
>                 name = inHumidity
>
>                 # True if the incoming data should not be processed into 
> WeeWX.
>                 # Valid values: True, False
>                 # Default is False
>                 ignore = False
>
> And here is the data that is being sent:
> {"humidity":"47.06","temperature":"23.97"}
>
> Also thanks for the link of the bme280 device I still may get one anyway.
>
> Hopefully now my graphs will look good again!
>
> Thanks again for all the ideas.
> On Saturday 16 March 2024 at 11:06:47 UTC+11 Jimi Lawson wrote:
>
>> This is the bme280 and where I got it from 
>> https://shop.pimoroni.com/search?q=Adafruit%20BME280%20I2C%20or%20SPI%20Temperature%20Humidity%20Pressure%20Sensor%20-%20STEMMA%20QT
>>
>> Regards
>> Jimi
>>
>> On Friday 15 March 2024 at 23:52:57 UTC p q wrote:
>>
>>> I do it the dumb way. I have my sensors send data when they're ready. I 
>>> have a service running on the weewx box that subscribes to the MQTT 
>>> messages and writes them to a temp file. I modified the driver to read from 
>>> the temp file. I check to see if the data is older than 20 minutes and 
>>> ignore it if it is.
>>>
>>> There's probably a proper way to do this, without editing driver code.
>>>
>>> On Fri, Mar 15, 2024 at 4:18 PM Greg from Oz <[email protected]> wrote:
>>>
>>>> My bme280 only does pressure and temperature. I have it on a sonoff SV.
>>>> What bme280 are you using? Do you have a part number?
>>>> I am getting the humidity and temp from the zigbee because it is in the 
>>>> house and the bme280 is in the shed and it is hot in there but I can add 
>>>> one for the house I guess?
>>>> I will see if I can get the same BME280 as you are using.
>>>> Do you have info where you bought it?
>>>> Thanks
>>>>
>>>> On Saturday 16 March 2024 at 10:10:57 UTC+11 Jimi Lawson wrote:
>>>>
>>>>> What device does your station/weewx run on, couldn't you connect the 
>>>>> bme280 to it and use the temp/humidity/pressure reading from it ? that's 
>>>>> what I do.
>>>>>
>>>>> On Friday 15 March 2024 at 21:21:37 UTC Greg from Oz wrote:
>>>>>
>>>>>> Thanks Tom.
>>>>>>
>>>>>> Probably not something I could do. I know nothing about python.
>>>>>> Maybe later when I have time to look at it again.
>>>>>> I will see if I can find a device that transmits in regular intervals.
>>>>>>
>>>>>> On Friday 15 March 2024 at 23:55:13 UTC+11 Tom Keffer wrote:
>>>>>>
>>>>>>> You have many single data points, separated with long stretches of 
>>>>>>> nulls --- no lines. That's why line_gap_fraction isn't working.
>>>>>>>
>>>>>>> By design, WeeWX drivers don't cache data. See the guidelines 
>>>>>>> <https://www.weewx.com/docs/5.0/custom/drivers/#general-guidelines> for 
>>>>>>> writing drivers.
>>>>>>>
>>>>>>> However, you could write a simple service that retains the last 
>>>>>>> value and uses it if a null value is seen. Perhaps up to a maximum 
>>>>>>> time. 
>>>>>>> But, there's nothing like that in WeeWX.
>>>>>>>
>>>>>>> On Thu, Mar 14, 2024 at 6:54 PM Greg from Oz <[email protected]> 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Here is a snippet of the database:
>>>>>>>> select dateTime ,inTemp, inHumidity, pressure from archive where 
>>>>>>>> dateTime >= 1710459900 ;
>>>>>>>> +------------+--------+--------------------+-------------------+
>>>>>>>> | dateTime   | inTemp | inHumidity         | pressure          |
>>>>>>>> +------------+--------+--------------------+-------------------+
>>>>>>>> | 1710459900 |  23.99 | 54.019999999999996 | 968.3500000000003 |
>>>>>>>> | 1710460200 |   NULL |               NULL | 968.3142857142858 |
>>>>>>>> | 1710460500 |   NULL |               NULL | 968.3166666666667 |
>>>>>>>> | 1710460800 |   NULL |               NULL | 968.2166666666667 |
>>>>>>>> | 1710461100 |   NULL |               NULL | 968.1583333333334 |
>>>>>>>> | 1710461400 |  24.26 |              53.23 | 968.1000000000001 |
>>>>>>>> | 1710461700 |   24.5 |              53.34 | 968.0833333333335 |
>>>>>>>> | 1710462000 |   NULL |               NULL | 968.1416666666668 |
>>>>>>>> | 1710462300 |   NULL |               NULL | 968.0916666666667 |
>>>>>>>> | 1710462600 |   NULL |               NULL | 968.1285714285715 |
>>>>>>>> | 1710462900 |   NULL |               NULL |           968.225 |
>>>>>>>> | 1710463200 |  25.01 |             52.795 | 968.1666666666666 |
>>>>>>>> | 1710463500 |   NULL |               NULL | 968.1083333333335 |
>>>>>>>> | 1710463800 |  25.52 | 51.754999999999995 | 968.1357142857144 |
>>>>>>>> | 1710464100 |   NULL |               NULL | 968.1083333333332 |
>>>>>>>> | 1710464400 |   NULL |               NULL | 968.0916666666667 |
>>>>>>>> | 1710464700 |   NULL |               NULL | 968.0083333333332 |
>>>>>>>> | 1710465000 |  25.82 |              50.49 | 968.0142857142857 |
>>>>>>>> | 1710465300 |  26.03 |             50.535 | 967.9583333333334 |
>>>>>>>> | 1710465600 |   NULL |               NULL | 967.8333333333335 |
>>>>>>>> | 1710465900 |   NULL |               NULL | 967.8000000000001 |
>>>>>>>> | 1710466200 |   NULL |               NULL |            967.75 |
>>>>>>>> | 1710466500 |  26.54 |             50.095 | 967.6833333333334 |
>>>>>>>> | 1710466800 |   NULL |               NULL | 967.6916666666666 |
>>>>>>>> | 1710467100 |   NULL |               NULL | 967.6999999999999 |
>>>>>>>> | 1710467400 |   NULL |               NULL | 967.7500000000001 |
>>>>>>>> +------------+--------+--------------------+-------------------+
>>>>>>>> 26 rows in set (0.000 sec)
>>>>>>>>
>>>>>>>> On Friday 15 March 2024 at 08:39:12 UTC+11 Tom Keffer wrote:
>>>>>>>>
>>>>>>>>> You may just have the option line_gap_fraction 
>>>>>>>>> <https://www.weewx.com/docs/5.0/reference/skin-options/imagegenerator/#line_gap_fraction>
>>>>>>>>>  
>>>>>>>>> set too low.
>>>>>>>>>
>>>>>>>>> On Thu, Mar 14, 2024 at 2:18 PM Greg from Oz <[email protected]> 
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>> I have removed my fineoffset usb and replaced it with SDR but the 
>>>>>>>>>> outside fine offset station doesn't sent inside temperature, inside 
>>>>>>>>>> humidity or barometer.
>>>>>>>>>>
>>>>>>>>>> I have added a BME280 sensor and can get the barometer readings 
>>>>>>>>>> every 30 seconds and that is working and graphing OK.
>>>>>>>>>>
>>>>>>>>>> I have a zigbee battery powered device that I am using to get the 
>>>>>>>>>> inside temperature and inside humidity but I cannot get the graphs 
>>>>>>>>>> to show 
>>>>>>>>>> a solid line nor can I get the readings to consistently show on my 
>>>>>>>>>> web page 
>>>>>>>>>> because those readings come in a random times.
>>>>>>>>>>
>>>>>>>>>> Is there any way to make the readings "stick" until a new reading 
>>>>>>>>>> is received so the graphs look right and the readings are always on 
>>>>>>>>>> the web 
>>>>>>>>>> page?
>>>>>>>>>>
>>>>>>>>>> Look at the inside temperature graph on my web page to see what I 
>>>>>>>>>> mean:
>>>>>>>>>> https://weather.ubeaut.work/
>>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> 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/555c8101-8f4f-45ad-8dc7-03a7b2fbb7ean%40googlegroups.com
>>>>>>>>>>  
>>>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/555c8101-8f4f-45ad-8dc7-03a7b2fbb7ean%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>> .
>>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>> 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/53147a8b-34d0-49fa-ab86-78bf8c931029n%40googlegroups.com
>>>>>>>>  
>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/53147a8b-34d0-49fa-ab86-78bf8c931029n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> -- 
>>>> 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/79dc9f68-8550-4906-a69c-c08f744a9609n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/weewx-user/79dc9f68-8550-4906-a69c-c08f744a9609n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> -- 
>>> Peter Quinn
>>> (415)794-2264 <(415)%20794-2264>
>>>
>>

-- 
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/913dfa24-f466-4f75-8ad6-4ef0ae0d58een%40googlegroups.com.

Reply via email to