Yes, it works. So the problem was not within MQTTSubscribe service, but in the configuration of the accumulator service. And it was no software issue, but a knowledge issue of the user. :-)
Karen K schrieb am Donnerstag, 11. Februar 2021 um 10:11:48 UTC+1: > That's new to me. Thank you very much for that information. I will try it. > > [email protected] schrieb am Mittwoch, 10. Februar 2021 um 19:56:29 UTC+1: > >> Yes, it would be something like >> [Accumulator] >> [[W567470c]] >> accumulator = firstlast >> extractor = last >> >> See, https://github.com/weewx/weewx/wiki/Accumulators for additional >> information >> >> On Wednesday, 10 February 2021 at 13:51:08 UTC-5 [email protected] wrote: >> >>> There is no such section. Should I have one? >>> >>> [email protected] schrieb am Mittwoch, 10. Februar 2021 um 19:44:55 >>> UTC+1: >>> >>>> Looks like a bug when running as a service, I'll take a look. >>>> What does your [Accumulator] section look like? >>>> >>>> On Wednesday, 10 February 2021 at 13:41:47 UTC-5 [email protected] >>>> wrote: >>>> >>>>> For me it still does not work. >>>>> >>>>> The configuration is: >>>>> [[[pegel/567470/alarmcolor]]] >>>>> name = W567470c >>>>> conversion_type = None >>>>> expires_after = 4000 >>>>> >>>>> And the log is: >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: Caught >>>>> unrecoverable exception: >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** could >>>>> not convert string to float: '#c5e566' >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> Traceback (most recent call last): >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/weewxd", line 157, in main >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> engine.run() >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/weewx/engine.py", line 210, in run >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> self.dispatchEvent(weewx.Event(weewx.NEW_LOOP_PACKET, packet=packet)) >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/weewx/engine.py", line 245, in dispatchEvent >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> callback(event) >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/user/MQTTSubscribe.py", line 1591, in new_loop_packet >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> target_data = self.subscriber.get_accumulated_data(queue, >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/user/MQTTSubscribe.py", line 1478, in >>>>> get_accumulated_data >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** return >>>>> self.manager.get_accumulated_data(queue, start_ts, end_ts, units) # >>>>> pragma: >>>>> no cover >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/user/MQTTSubscribe.py", line 937, in >>>>> get_accumulated_data >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> accumulator.addRecord(data) >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/weewx/accum.py", line 436, in addRecord >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> func(self, record, obs_type, add_hilo, weight) >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/weewx/accum.py", line 495, in add_value >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> self[obs_type].addHiLo(val, record['dateTime']) >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/weewx/accum.py", line 168, in addHiLo >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** val = >>>>> to_float(val) >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** File >>>>> "/usr/share/weewx/weeutil/weeutil.py", line 1250, in to_float >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** return >>>>> float(x) if x is not None else None >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> ValueError: could not convert string to float: '#c5e566' >>>>> Feb 10 19:32:47 LokalWiki weewx[378692] CRITICAL __main__: **** >>>>> Exiting. >>>>> >>>>> I tried "none" and "None" in the configuration to the same result. >>>>> >>>>> >>>>> >>>>> Tarmo schrieb am Montag, 8. Februar 2021 um 23:42:34 UTC+1: >>>>> >>>>>> "If you get this working, I’d like to ‘steal’ the details/steps for a >>>>>> wiki page. >>>>>> -rich" >>>>>> >>>>>> you own this. this is your work and people around the world are >>>>>> thankful for this. >>>>>> >>>>>> >>>>>> On Monday, February 8, 2021 at 3:19:36 AM UTC+2 [email protected] >>>>>> wrote: >>>>>> >>>>>>> It should be doable. I do something similar with a few temperature >>>>>>> sensors/fields. The fact that you are dealing with string data does add >>>>>>> some complexity. >>>>>>> First, for the field configuration you will need to set the >>>>>>> conversion_type = None. Although it is not documented on the wiki, see >>>>>>> https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring#conversion_type >>>>>>> >>>>>>> This will stop MQTTSubscribe from trying to convert the incoming data. >>>>>>> >>>>>>> Next, you will need to configure the accumulator for this >>>>>>> field/type. See, https://github.com/weewx/weewx/wiki/Accumulators. >>>>>>> It looks like for this field/type you want to set accumulator = >>>>>>> firstlast >>>>>>> and extractor = last. >>>>>>> >>>>>>> Now you should be able to access it via $current. field/type name. >>>>>>> >>>>>>> If you get this working, I’d like to ‘steal’ the details/steps for a >>>>>>> wiki page. >>>>>>> -rich >>>>>>> >>>>>>> On Sunday, 7 February 2021 at 17:05:51 UTC-5 Tarmo wrote: >>>>>>> >>>>>>>> Can I do it? I have a text in MQTT like "Cloudy with clear spells" >>>>>>>> which I would like to display on my website. Although, there is no >>>>>>>> need to >>>>>>>> store it in the weewx database. I would like to just to update it at >>>>>>>> every >>>>>>>> archive interval. >>>>>>>> >>>>>>> -- 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/ad6e2560-62a2-4872-bb5d-eb2606482cfan%40googlegroups.com.
