Rfxtrx sensor data types get swapped

Hi, I’ve got a couple of rfxtrx sensors working in HA. But de data types (temperature and humidity) now and then get swapped after restarts. So gor instance sensor.garage gets swapped with sensor.garage_2 hence the values are displayed and logged in correct. That is the value itself is correct but the naming is incorrect.

How to prevent the swapping of the data types?

Can you post the related config?

from sensors.yaml:

- platform: rfxtrx
  automatic_add: False
  devices:
    0a520702c20e00bb370169:
      name: Slpkmr Thijmen
      data_type:
       - Humidity
       - Temperature

customize.yaml:

sensor.slpkmr_thijmen_2:
  friendly_name: Slaapkamer Thijmen temp.
  icon: mdi:thermometer
sensor.slpkmr_thijmen:
  friendly_name: Slaapkamer Thijmen hum.
  icon: mdi:water-percent

and groups.yaml:

binnen_temperaturen:
  name: Binnen temperaturen
  entities:
    - sensor.slpkmr_thijmen_2
    - sensor.slpkmr_thijmen

I tried unique friendly names (as you can see) and explicit icons. But the suffix _2 gets randomly append to either the temperature or humidity. At least that’s what it looks like to me.

After another restart it now looks fine. But as you can see from the graph sometimes the humidity is logged hence the high “temperatures”:

Seems to be a bug.
Removing the customize section will solve it for now

Thanks for looking into it. Should I report an issue on Github or somewhere else?

I’m not sure if this is related but i am also seeing some erratic temperature readings from a tfa pool sensor using rfxcom.

I am quite sure that is not related

I have the same problem but removing the customization doesn’t help as the _2 is randomly set to Humidity or Temperature by every restart.

So the result is still the same and what makes it worse I cannot control my heating and humidity any more as the automation doesn’t work anymore due to the wrong names.

Is there an open issue for this?

I do not think there is any open issue for this.

There is already a open issue (#4284).

Could you try this fix: https://github.com/home-assistant/home-assistant/compare/Bug_%234284?expand=1

It is untested code, so there might be some bugs there.
Please check that the entity_id is the same for all other rfxtrx sensors, so that this fix do not break any automation scripts for other users

I tried but not sure if I did right as it wasn’t starting RFX anymore

I copied it in /usr/local/lib/python3.4/dist-packages/homeassistant/components/rfxtrx.py

You should have copied it to
/usr/local/lib/python3.4/dist-packages/homeassistant/components/sensor/rfxtrx.py

or
YOUR_CONFIG_FOLDER/custom_components/sensor/rfxtrx.py

OK I first copied it to custom_components/sensor/rfxtrx.py and than non of the rfx sensors came up also no error msg’s

also if I copy it to /usr/local/lib/python3.4/dist-packages/homeassistant/components/sensor/rfxtrx.py i lost all my rfx sensors

I have a similar issue as well except this is happening on my Nest thermostat. Is there an open issue for it?

The issue is solved for the rfxtrx sensors: https://github.com/home-assistant/home-assistant/pull/4531