More supported RFXTRX sensor data types

My personal weather station sensors provide more information that I can currently add with the available data_type options. I would like to help and add more data types.

Since I’m pretty new to HA, where to start?

Example:
Rain: rain_total (mm)
Wind: wind_speed (Kph)
General: battery (%)

cc @Danielhiversen

1 Like

You need to add support for it to the library we are using https://github.com/Danielhiversen/pyRFXtrx

Would that be around this line:

https://github.com/Danielhiversen/pyRFXtrx/blob/master/RFXtrx/init.py#L352

Browsing that code and looking at the sensor attributes in HA, I can see that a number of values are already in the library. I need / like to have them as separate sensors in HA, so they should be added to the sensor.rfxtrx component, don’t they?

Looks like the library does have the necessary sensor packet types :wink:

    if isinstance(pkt, lowlevel.Rain):
        self.values['Rain rate'] = pkt.rainrate
        self.values['Rain total'] = pkt.raintotal
    if isinstance(pkt, lowlevel.Wind):
        self.values['Wind direction'] = pkt.direction
        self.values['Wind average speed'] = pkt.average_speed
        self.values['Wind gust'] = pkt.gust
        self.values['Temperature'] = pkt.temperature
        self.values['Chill'] = pkt.chill

I have not been around lately. Has this been fixed in the meantime?

I’m interested in this functionality as well. I have a rainmeter that I have added as a rfxtrx sensor. It’s a
Oregon PCR800. I can use the “Rain rate” datatype but I can not access the “Rain total” data the sensor delivers, as a own datatype. Is it possible to do this?
sensor.rain_cum_rain_rate 0.0
Rain rate: 0
Rain total: 75.6
Battery numeric: 9
Rssi numeric: 7
unit_of_measurement:
friendly_name: rain_cum Rain rate

Got it. Figured out hot to access it with template sensor and sensor attribute data:
value_template: '{{ states.sensor.rain_cum_rain_rate.attributes["Rain total"] }}'

I also have a wish more data types for RFXTRX.

Since the data is visable in HA (they are displayed if you select the sensor), but can’t be added as own sensors I think it should be a easy fix?

Can the file:

home-assistant/homeassistant/components/rfxtrx/init.py

be updated with som more data types from today’s list:

DATA_TYPES = OrderedDict([
(‘Temperature’, TEMP_CELSIUS),
(‘Temperature2’, TEMP_CELSIUS),
(‘Humidity’, ‘%’),
(‘Barometer’, ‘’),
(‘Wind direction’, ‘’),
(‘Rain rate’, ‘’),
(‘Energy usage’, POWER_WATT),
(‘Total usage’, POWER_WATT),
(‘Sound’, ‘’),
(‘Sensor Status’, ‘’),
(‘Counter value’, ‘’),
(‘UV’, ‘uv’)])

To include some more of the supported types:

My sensor is also sending (Oregon WGR800, wind sensor- displayed in HA when displaying data from the sensor) the following:

Wind average speed
Wind gust
Chill
Battery numeric

I think the complete list of supported data types for the component is listed in the “SensorEvent class” in:

https://github.com/Danielhiversen/pyRFXtrx/blob/master/RFXtrx/init.py

Did you have any success with this? A friend have me an Oregon Wgr800 and I am on my way home to check it out with Rfxcom and Home Assistant

The Wgr800 included fine with hass/Rfxtrx433. I use template sensors to show all attributes as sensors. But the Temperature and Chill attributes do not seem to update and keep reporting a fixed value that makes no sense to me. Will start a new thread on that one.

Daniel has made an update :slight_smile:

Hello,

could you please give more detail on this:

I just purchased this device too and Home Assistant already “sees” 433 activity, but it displays the wind sensor this way:

I really don’t know how to access the wind attributes. No idea why HA taggs this device as “temperature” and no idea either why the sensor seems to be publishing temperature, even less when the values it reports are non-sense. I must be missing something.

I am on my phone, so cannot post yaml example right now, but sensors have a state. The state is what you typically see in the GUI. But in addition, sensors can also have attributes. The state of this wind sensor is temperature, I don’t know why.

In order to use the attributes as states, you have to define new sensors that read this wind sensors attributes. Look up template sensors in the documentation, they do just that.

Thanks a lot @Marius!!

I will read the documentation but if you ever get around to doing it, I would be very thankful if you could post your setup. That would be awesome. Just to confirm: you are suggesting I can find the information here right?

Thank you,

Sure!

I have had a server crash, so this is from an old (yes, I feel stupid and ashamed :slight_smile: ) backup. I am not 100% sure it will work right out of the box, because I changed it a little (translated to English from Norwegian) without testing it afterwards.

This example shows how to extract sensor attributes into sensor states, each attribute will be a single (template) sensor.

The yaml below is my sensors.yaml which is included in configuration.yaml by the include directive sensor: !include sensors.yaml

- platform: template
  sensors:
    wgr_800_battery_state:
      friendly_name: Wind battery
      value_template: '{{state_attr("sensor.oregon_wgr_800", "Battery numeric") }}'
      unit_of_measurement: "%"
    wgr_800_temperature:
      friendly_name: Wind temperature #Not working right
      value_template: '{{state_attr("sensor.oregon_wgr_800_temperature", "Temperature") }}'
      unit_of_measurement: "°C"
    wgr_800_windchill:
      friendly_name: Wind chill #Not working right
      value_template: '{{state_attr("sensor.oregon_wgr_800_temperature", "Chill") }}'
      unit_of_measurement: "°C"
    wgr_800_windspeed_average:
      friendly_name: Wind average
      value_template: '{{state_attr("sensor.oregon_wgr_800_temperature", "Wind average speed") }}'
      unit_of_measurement: "m/s"
    wgr_800_windspeed_gust:
      friendly_name: Wind gust
      value_template: '{{state_attr("sensor.oregon_wgr_800_temperature", "Wind gust") }}'
      unit_of_measurement: "m/s"
    wgr_800_wind_direction:
      friendly_name: Wind direction
      value_template: '{{state_attr("sensor.oregon_wgr_800_temperature", "Wind direction") }}'
      unit_of_measurement: "°"
    wgr_800_wind_direction_text:
      friendly_name: Wind direction text
      value_template:  >-
        '{% if not is_state("sensor.wgr_800_wind_direction", "None") %}
          {% set wd = states("sensor.wgr_800_wind_direction") | int %}
          {% if wd <= 11 or wd > 348 %}N
          {% elif wd >11 and wd <=34 %}NNE
          {% elif wd >34 and wd <=56 %}NE
          {% elif wd >56 and wd <=79 %}ENE
          {% elif wd >79 and wd <=101 %}E
          {% elif wd >101 and wd <=124 %}ESE
          {% elif wd >124 and wd <=146 %}SE
          {% elif wd >146 and wd <=169 %}SSE
          {% elif wd >169 and wd <=191 %}S
          {% elif wd >191 and wd <=214 %}SSW
          {% elif wd >214 and wd <=236 %}SW
          {% elif wd >236 and wd <=259 %}WSW
          {% elif wd >259 and wd <=281 %}W
          {% elif wd >281 and wd <=304 %}WNW
          {% elif wd >304 and wd <=326 %}NW
          {% elif wd >326 and wd <=348 %}NNW
          {% endif %}
        {% else %}       
          Invalid direction
        {% endif %}'

What I will probably do when I have the time, is to use these sensors in a statistics sensor, to get less noisy data and be able to see max/min values. But first have have some work to do putting my new NUC together and install Ubuntu with Docker…

Hi all,

I receive the weather station information from my neighbor and the temperature is a swapping. I see the same value in the print screen from kitus. The temperate swaps between the actual temperature and a fixed value “Temperature: 2674”. What is this 2674 and how to show the right temp. in HA?