The penny drops. Have you added wh65_battery to your database schema? 
$current.wh65_battery will work without wh65_battery being in your schema 
but $day.wh65_battery requires wh65_battery be in your schema.

Refer to Adding a new type to the database 
<http://weewx.com/docs/customizing.htm#add_archive_type> in the 
Customization Guide.

Gary

On Friday, 18 December 2020 at 19:30:22 UTC+10 Vetti52 wrote:

> Thanks, Gary. The typo was here, not in seasons.inc. But I had another 
> assumption: When displaying the values $current.txBatteryStatus.raw and 
> $current.wh65_battery.raw , I could see, that the first one was empty, 
> and only the second value was existent. My assumption was, that  $
> day.txBatteryStatus had data from time of this day before switching from 
> interceptor to gw1000 driver, but $day.wh65_battery did not (yet). 
> So I tried this modification:
>
> #set $have_battery_status = 0
> #for $x in [$day.txBatteryStatus, $day.wh65_battery, 
> $day.windBatteryStatus, $day.rainBatteryStatus, $day.outTempBatteryStatus, 
> $day.inTempBatteryStatus]
>
>   #if $x.has_data
>     #set $have_battery_status = 1
>   #end if
> #end for
>
>
> If this was true, I expected, that the sensor section would be present 
> today, because 
>
> #if $have_battery_status
>     <tr><th>Batterie Status</th><th></th></tr>
> #if $day.txBatteryStatus.has_data
>     <tr>
>       <td class="label">$obs.label.wh65_batteryStatus</td>
>       <td class="data">$get_battery_status($current.wh65_battery.raw)</td>
>     </tr>
>
> #end if
>
> should result in the header line but no "Transmitter" data, because 
> $have_battery_status being true, but no content, because 
> $day.txBatteryStatus.has_data was supposed to be wrong since today. 
> However, unfortunately, the complete section disappeared. So, my assumption 
> is true only partially: Today there is no more $day.txBatteryStatus, but, 
> surprise,  there isn't  $day.wh65_battery either.
> What is wrong with it?
>  
> gjr80 schrieb am Donnerstag, 17. Dezember 2020 um 21:21:10 UTC+1:
>
>> Peter,
>>
>> Your understanding is correct. The logic in the code now appears correct 
>> but I think you are using the incorrect field name. Earlier you posted an 
>> archive record:
>>
>> REC:    2020-12-16 13:30:00 CET (1608121800) altimeter: 
>> 30.09246486970751, appTemp: 46.07291271146897, barometer: 
>> 30.092169667712717, cloudbase: 944.6426189788297, dateTime: 1608121800, 
>> daymaxwind: 3.6, dayRain: 0.0, dewpoint: 45.0455158818643, ET: 
>> 0.00012174671890853505, extraTemp1: 124.89439999999999, heatindex: 
>> 47.403000000000006, humidex: 48.934644083871206, inDewpoint: 
>> 50.88299985988465, inHumidity: 60.0, inTemp: 65.12, interval: 5.0, 
>> luminosity: 8184.0, maxSolarRad: 86.02828823732644, monthRain: 
>> 0.6653543307086613, outHumidity: 87.0, outTemp: 48.74, pressure: 
>> 29.97589031125, radiation: 64.59352801894238, rain: 0.0, rainEvent: 
>> 0.4015748031496063, rainRate: 0.0, relbarometer: 1019.2, usUnits: 1, UV: 
>> 0.0, uvradiation: 6.5, weekRain: 10.9, wh65_battery: 0.0, windchill: 
>> 48.74, windDir: 187.0, windGust: 3.3554127779089566, windGustDir: 187, 
>> windrun: 0.22369418519393044, windSpeed: 2.6843302223271652, yearRain: 
>> 29.17716535433071
>>
>> The field name is wh65_battery not wh_65battery. Anywhere you use $day 
>> or $current to access the WH65 battery state you need to be using 
>> $day.wh65_battery or $current.wh65_battery.
>>
>> Gary
>>
>> On Thursday, 17 December 2020 at 22:38:50 UTC+10 Vetti52 wrote:
>>
>>> Aaah, now I start to understand! The first part is just a definition. 
>>> Got it! Thanks!!!!
>>>
>>> In skin.conf stanza [Labels] [Generic] I found
>>>
>>>         txBatteryStatus      = Transmitter
>>>
>>> I replaced the left side with wh65_batteryStatus
>>>
>>> In Seasons.inc I found:
>>>
>>> #set $have_battery_status = 0
>>> #for $x in [$day.txBatteryStatus, $day.windBatteryStatus, 
>>> $day.rainBatteryStatus, $day.outTempBatteryStatus, $day.inTempBatteryStatus]
>>>   #if $x.has_data
>>>     #set $have_battery_status = 1
>>>   #end if
>>> #end for
>>>
>>> and later on:
>>>
>>> #if $have_battery_status
>>>     <tr><th>Batterie Status</th><th></th></tr>
>>> #if $day.txBatteryStatus.has_data
>>>     <tr>
>>>       <td class="label">$obs.label.txBatteryStatus</td>
>>>       <td class="data">$get_battery_status($current.txBatteryStatus
>>> .raw)</td>
>>>     </tr>
>>> #end if
>>>
>>> I replaced all txBatteryStatus entries by wh65_battery  except 
>>> $obs.label.wh65_batteryStatus according to the label in skin.conf. 
>>>
>>> First, all this looks simply logic. However, now the sensors data were 
>>> no longer displayed at all. Checked for typos. Nope. So, my logic failed 
>>> again.
>>>
>>> I then tried to replace all entries step by step. So, at first, it was 
>>> evident, that the expression #for $x in [$day.txBatteryStatus, ...  
>>> still results in status = 1, but not, when replaced with 
>>> $day.wh_65battery,. 
>>>
>>> Ok, next step. Then I have to keep the original condition also here:
>>>
>>> #if $have_battery_status
>>>     <tr><th>Batterie Status</th><th></th></tr>
>>> #if $day.txBatteryStatus.has_data
>>>     <tr>
>>>
>>> but still use the new values in the next two lines here:
>>>
>>>       <td class="label">$obs.label.wh65_batteryStatus</td>
>>>
>>>       <td class="data">$get_battery_status($current.wh65_battery.raw)
>>> </td>
>>>     </tr>
>>> #end if
>>>
>>>
>>> So, finally everything looks fine, same like the results from 
>>> interceptor.py. But why do I still need txBatteryStatus? Where does 
>>> this value come from? Obviously $current.wh65_battery returns a valid 
>>> result, thus providing data. But it is not suitable for evaluating $x. This 
>>> is still not logical to me...
>>>
>>> Actually to me it looks like txBatteryStatus is not the Ecowitt-client 
>>> field name, as mentioned in my first post here, but is an internal field 
>>> name in Weewx (or why is it regularily used in seasons.inc?). So, it could 
>>> have been much less complicated to map wh65_batt to txBatteryStatus. 
>>> But I am afraid, that there still was something wrong with it.
>>>
>>> Peter
>>>
>>>

-- 
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/d3860dca-e4f2-4342-8eb1-a54a25e0a488n%40googlegroups.com.

Reply via email to