Ah, that was my mistake, I deleted a few lines I should not have. Try this 
sensors.txt; same deal, download, rename and save as 
/etc/weewx/skins/Seasons/sensors.inc. No need to restart WeeWx this time, 
just wait for the report cycle to complete.

Gary

On Saturday, 16 January 2021 at 16:52:28 UTC+10 [email protected] 
wrote:

> i think it works now.
> I dont know what i did but i use the early sensor.inc code you gave me and 
> the readings is now this
>
> Connectivity
> WiFi Signal
> (57 dB)
> Outdoor Module Signal
> (66 dB)
> Anemometer Signal
> (69 dB)
> Rain Gauge Signal
> (62 dB)
>
> Battery Status
> Anemometer Battery
> (95%)
> Rain Gauge Battery
> (100%)
> Outdoor Module Battery
> (93%)
>
> lördag 16 januari 2021 kl. 07:35:56 UTC+1 skrev Rebecka Johansson:
>
>> I do as you described :)
>>
>> But got errors after i replaced the new sensors.inc code
>>
>> The log error shows this
>>
>> "Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> Generate failed with exception '<class 'Cheetah.Parser.ParseError'>'
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> **** Ignoring template /etc/weewx/skins/Seasons/index.html.tmpl
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> **** Reason: #012#012Some #directives are missing their corresponding #end 
>> ___ tag: if, if#012Line 153, column 7 in file 
>> /etc/weewx/skins/Seasons/sensors.inc#012#012Line|Cheetah 
>> Code#012----|-------------------------------------------------------------#012150
>>  
>> |  </div>#012151 |#012152 |</div>#012153 |#end if#012           ^
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Traceback (most recent call last):
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 323, in 
>> generate
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      unicode_string = compiled_template.respond()
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "_etc_weewx_skins_Seasons_index_html_tmpl.py", line 225, in 
>> respond
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 
>> 1685, in _handleCheetahInclude
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      file=file)
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 
>> 775, in compile
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      compiler.compile()
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Compiler.py", line 
>> 1799, in compile
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      self._parser.parse()
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Parser.py", line 1554, 
>> in parse
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      self.assertEmptyOpenDirectivesStack()
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Parser.py", line 2778, 
>> in assertEmptyOpenDirectivesStack
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      raise ParseError(self, msg=errorMsg)
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Cheetah.Parser.ParseError: 
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Some #directives are missing their corresponding #end ___ tag: if, if
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Line 153, column 7 in file /etc/weewx/skins/Seasons/sensors.inc
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Line|Cheetah Code
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  ----|-------------------------------------------------------------
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  150 |  </div>
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  151 |
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  152 |</div>
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  153 |#end if
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****             ^
>> Jan 16 07:33:21 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> Generate failed with exception '<class 'Cheetah.Parser.ParseError'>'
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> **** Ignoring template /etc/weewx/skins/Seasons/telemetry.html.tmpl
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> **** Reason: #012#012Some #directives are missing their corresponding #end 
>> ___ tag: if, if#012Line 153, column 7 in file 
>> /etc/weewx/skins/Seasons/sensors.inc#012#012Line|Cheetah 
>> Code#012----|-------------------------------------------------------------#012150
>>  
>> |  </div>#012151 |#012152 |</div>#012153 |#end if#012           ^
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Traceback (most recent call last):
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 323, in 
>> generate
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      unicode_string = compiled_template.respond()
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "_etc_weewx_skins_Seasons_telemetry_html_tmpl.py", line 195, 
>> in respond
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 
>> 1685, in _handleCheetahInclude
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      file=file)
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 
>> 775, in compile
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      compiler.compile()
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Compiler.py", line 
>> 1799, in compile
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      self._parser.parse()
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Parser.py", line 1554, 
>> in parse
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      self.assertEmptyOpenDirectivesStack()
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****    File "/usr/lib/python3/dist-packages/Cheetah/Parser.py", line 2778, 
>> in assertEmptyOpenDirectivesStack
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****      raise ParseError(self, msg=errorMsg)
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Cheetah.Parser.ParseError: 
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Some #directives are missing their corresponding #end ___ tag: if, if
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Line 153, column 7 in file /etc/weewx/skins/Seasons/sensors.inc
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  Line|Cheetah Code
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  ----|-------------------------------------------------------------
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  150 |  </div>
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  151 |
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  152 |</div>
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  153 |#end if
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****             ^
>> Jan 16 07:33:22 Raspi wee_reports[12432] ERROR weewx.cheetahgenerator: 
>> ****  
>> "
>>
>> lördag 16 januari 2021 kl. 06:59:41 UTC+1 skrev gjr80:
>>
>>> On Saturday, 16 January 2021 at 14:28:48 UTC+10 [email protected] 
>>> wrote:
>>>
>>>> Thank for answer and your will to help me! 
>>>>
>>> Im new on Netatmo and its more advanced to code haha. 
>>>> Sorry for late answere i think the county time differens between us. 
>>>> Clock is early in the morning now in sweden 05:40 AM
>>>>
>>>
>>> No problems, you have more netatmo experience than I! We do have a time 
>>> difference, I am nine hours ahead of you I believe, mid-afternoon here now 
>>> as I write this.
>>>  
>>>
>>>> I know battery_vp is from old firmware and battery_percent is the newer 
>>>> firmware.
>>>> The work with formatting its something i havent learn yet and its take 
>>>> time because my dyslexia and concentration because adhd. 
>>>> But thanks to you because you describe in the way i understand very 
>>>> well.
>>>>
>>>
>>> You are welcome.
>>>
>>> I have thinking on what i want in the reading and i wanted to have just 
>>>> the percentage. 
>>>> So as example from your tex above i want the readings to  "Anemometer 
>>>> Battery 95%" 
>>>>
>>>
>>> OK, that makes it easy, just a couple more things to do. We need to 
>>> modify sensors.inc again and then we need to tell WeeWX how to 
>>> interpret the xxxBatteryStatus  and xxx_rf_status fields. I have 
>>> attached a new copy of sensors.inc, again it is actually sensors.txt 
>>> due to Google Groups limitations, just download it, rename it to 
>>> sensors.inc and use it to replace your existing 
>>> /etc/weewx/skins/Seasons/sensors.inc. That will now give you just the 
>>> percentages for battery status and just the numbers for rf status, 
>>> something like:
>>>
>>>     Anemometer Battery 95.000000
>>>     Anemometer Signal 86.000000
>>>
>>> Still not formatted correctly and with no % symbol.
>>>
>>> Reading a bit more about the netatmo system it seems the rf signal level 
>>> values are RSSI (received signal strength indicator) values in decibels 
>>> (dB). Again your choice how you want to present them, you can present them 
>>> as just a number, eg:
>>>
>>>     Anemometer Signal 86
>>>
>>> or as a dB value eg:
>>>
>>>     Anemometer Signal 86dB
>>>
>>> Once you have decided hold on to that thought as we will use it shortly.
>>>
>>> To get the numbers formatted correctly we need to tell WeeWX how to 
>>> interpret the xxxBatteryStatus  and xxx_rf_status fields and we do that by 
>>> adding a few lines of code to /usr/share/weewx/user/extensions.py. To 
>>> make the changes to /usr/share/weewx/user/extensions.py:
>>>
>>> 1. open /usr/share/weewx/user/extensions.py in a text editor
>>>
>>> 2. add the following lines to the bottom of the file:
>>>
>>> import weewx.units
>>> weewx.units.obs_group_dict['windBatteryStatus'] = 'group_percent'
>>> weewx.units.obs_group_dict['rainBatteryStatus'] = 'group_percent'
>>> weewx.units.obs_group_dict['outTempBatteryStatus'] = 'group_percent'
>>>
>>> 3. if you want to display the rf signal status as just plain numbers add 
>>> the following lines:
>>>
>>> weewx.units.obs_group_dict['signal1'] = 'group_count'
>>> weewx.units.obs_group_dict['signal2'] = 'group_count'
>>> weewx.units.obs_group_dict['signal3'] = 'group_count'
>>> weewx.units.obs_group_dict['signal4'] = 'group_count'
>>>
>>> 4. if you want to display the rf signal status as decibels (with a dB 
>>> unit label) add the following lines:
>>>
>>> weewx.units.obs_group_dict['signal1'] = 'group_db'
>>> weewx.units.obs_group_dict['signal2'] = 'group_db'
>>> weewx.units.obs_group_dict['signal3'] = 'group_db'
>>> weewx.units.obs_group_dict['signal4'] = 'group_db'
>>>
>>> Make sure you do just one or the other of 3. and 4., don't add both.
>>>
>>> 5. save extensions.py
>>>
>>> That is all though this time you will need to restart WeeWX for the 
>>> changes in extensions.py to take effect. After you have restarted WeeWX 
>>> once the next report cycle completes you should see the sensor panel on the 
>>> Seasons home page updated accordingly. If the display is not as you expect 
>>> or something goes wrong post back here with details.
>>>
>>> About the Belchertown i will try fix that on my own. 
>>>> I have learn a little about sensor readings thanks to you! Its just the 
>>>> formatting now :) 
>>>>
>>>
>>> The Belchertown skin is quite popular and lots of folks here are 
>>> familiar with it and have customised it (unfortunately I am not one them). 
>>> If you get stuck with Belchertown open a new thread with your questions and 
>>> I am sure someone will help you.
>>>
>>> Gary
>>>  
>>>
>>

-- 
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/2d05a040-f776-48a6-a4ac-e1c16b705c23n%40googlegroups.com.
## sensors module for weewx skins
## Copyright Tom Keffer, Matthew Wall
## See LICENSE.txt for your rights
#errorCatcher Echo
#encoding UTF-8

## this is a conditional display of sensor data, including connectivity,
## battery status, and various voltages.  if there are no data available,
## then this degenerates to nothing displayed.

#def get_battery_status($x)
#if $x == 0
<span class="status_ok">OK</span>
#else
<span class="status_low">LOW</span>
#end if
#end def


## first see what sensor data are available

#set $have_conn = 0
#for $x in [$day.rxCheckPercent, $day.signal1, $day.signal2, $day.signal3, 
$day.signal4]
  #if $x.has_data
    #set $have_conn = 1
  #end if
#end for

#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

#set $have_voltage = 0
#for $x in [$day.consBatteryVoltage, $day.heatingVoltage, $day.supplyVoltage, 
$day.referenceVoltage]
  #if $x.has_data
    #set $have_voltage = 1
  #end if
#end for


## now display the available data only

#if $have_conn or $have_battery_status or $have_voltage
<div id='sensors_widget' class="widget">
  <div class="widget_title">
    <a href="telemetry.html">Sensor Status</a>
    <a class="widget_control"
      onclick="toggle_widget('sensors')">&diams;</a>
  </div>
  <div class="widget_contents">
  <table>

#if $have_conn
    <tr><th>Connectivity</th><th></th></tr>
#if $day.rxCheckPercent.has_data
    <tr>
      <td class="label">$obs.label.rxCheckPercent</td>
      <td class="data">$current.rxCheckPercent</td>
    </tr>
#end if
#if $day.signal1.has_data
    <tr>
      <td class="label">$obs.label.signal1</td>
      <td class="data">$current.signal1</td>
    </tr>
#end if
#if $day.signal2.has_data
    <tr>
      <td class="label">$obs.label.signal2</td>
      <td class="data">$current.signal2</td>
    </tr>
#end if
#if $day.signal3.has_data
    <tr>
      <td class="label">$obs.label.signal3</td>
      <td class="data">$current.signal3</td>
    </tr>
#end if
#if $day.signal4.has_data
    <tr>
      <td class="label">$obs.label.signal4</td>
      <td class="data">$current.signal4</td>
    </tr>
#end if
#end if

#if $have_battery_status
    <tr><th>Battery 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
#if $day.windBatteryStatus.has_data
    <tr>
      <td class="label">$obs.label.windBatteryStatus</td>
      <td class="data">$current.windBatteryStatus</td>
    </tr>
#end if
#if $day.rainBatteryStatus.has_data
    <tr>
      <td class="label">$obs.label.rainBatteryStatus</td>
      <td class="data">$current.rainBatteryStatus</td>
    </tr>
#end if
#if $day.rainBatteryStatus.has_data
    <tr>
      <td class="label">$obs.label.outTempBatteryStatus</td>
      <td class="data">$current.outTempBatteryStatus</td>
    </tr>
#end if
#if $day.inTempBatteryStatus.has_data
    <tr>
      <td class="label">$obs.label.inTempBatteryStatus</td>
      <td 
class="data">$get_battery_status($current.inTempBatteryStatus.raw)</td>
    </tr>
#end if
#end if

#if $have_voltage
    <tr><th>Voltage</th><th></th></tr>
#if $day.consBatteryVoltage.has_data
    <tr>
      <td class="label">$obs.label.consBatteryVoltage</td>
      <td class="data">$current.consBatteryVoltage</td>
    </tr>
#end if
#if $day.heatingVoltage.has_data
    <tr>
      <td class="label">$obs.label.heatingVoltage</td>
      <td class="data">$current.heatingVoltage</td>
    </tr>
#end if
#if $day.supplyVoltage.has_data
    <tr>
      <td class="label">$obs.label.supplyVoltage</td>
      <td class="data">$current.supplyVoltage</td>
    </tr>
#end if
#if $day.referenceVoltage.has_data
    <tr>
      <td class="label">$obs.label.referenceVoltage</td>
      <td class="data">$current.referenceVoltage</td>
    </tr>
#end if
#end if
  </table>
  </div>

</div>
#end if


Reply via email to