On Thu, May 2, 2024 at 6:32 PM Michael Frotscher <frotsc...@gmail.com> wrote:
> Here's the full code of my service: > > def new_archive_packet(self, event): > > if 'pressure' != None: > newpressure = ('pressure' * 10) > event.record['pb'] = newpressure > Strictly interpreted, you first ask whether the string "'pressure'" is equal to None. It's not, so we proceed to the next statement. Now you're trying to multiply a string ('pressure') by 10. Surprisingly, this will succeed, but likely does not give you the results you expect. The variable "newpressure" will actually be set to the string 'pressurepressurepressurepressurepressurepressurepressurepressurepressurepressure'. That is, the string 'pressure' concatenated 10 times. You want a *variable* pressure, not the literal string 'pressure'. Where will it come from? I would suggest taking an online Python course if this is unfamiliar to you. -tk -- You received this message because you are subscribed to the Google Groups "weewx-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-development+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/CAPq0zEDDunC-ku2AZ%3D1oGT1sMs_eS9NABsMtp9%3DSu5iE1ccpRQ%40mail.gmail.com.