Pilight sensor - not possible to have multiple sensors?

I bought two door/window sensors and successfully integrated them in pilight.

The problem is that in HA configuration there are no options where HA could differentiate between those two sensors because uuid is the same - config looks like that:

- platform: pilight
  name: 'Terrace Doors'
  variable: state
  payload:
    uuid: '0000-b8-27-eb-7b7b97'
    
- platform: pilight
  name: 'Front Doors'
  variable: state
  payload:
    uuid: '0000-b8-27-eb-7b7b97'

Am I missing something? Are there any options to also set IDs or other unique parameters (like with pilight.switch) so HA could differentiate between both sensors?

Edit: Deleting the previous post for wrong information.

Did you try to run:

pilight-receive

to check which information is sent from the sensor?

Yes, I ran pilight-receive to get sensor information. Sensor sends signal for opening the door, closing the door and it also has a temper switch. My pilight-receive output looks like that:

{
        "message": {
                "systemcode": 27,
                "unitcode": 25,
                "state": "off"
        },
        "origin": "receiver",
        "protocol": "elro_800_switch",
        "uuid": "0000-b8-27-eb-7b7b97",
        "repeats": 30
}
{
        "message": {
                "id": 1,
                "systemcode": 624,
                "unit": 6,
                "state": "off"
        },
        "origin": "receiver",
        "protocol": "daycom",
        "uuid": "0000-b8-27-eb-7b7b97",
        "repeats": 30
}
{
        "message": {
                "unitcode": 495087,
                "state": "opened"
        },
        "origin": "receiver",
        "protocol": "ev1527",
        "uuid": "0000-b8-27-eb-7b7b97",
        "repeats": 30
}
{
        "message": {
                "systemcode": 27,
                "unitcode": 25,
                "state": "off"
        },
        "origin": "receiver",
        "protocol": "heitech",
        "uuid": "0000-b8-27-eb-7b7b97",
        "repeats": 31
}
{
        "message": {
                "systemcode": 17008,
                "unitcode": 6,
                "state": "off"
        },
        "origin": "receiver",
        "protocol": "logilink_switch",
        "uuid": "0000-b8-27-eb-7b7b97",
        "repeats": 31
}
{
        "message": {
                "id": 5,
                "state": "on"
        },
        "origin": "receiver",
        "protocol": "ehome",
        "uuid": "0000-b8-27-eb-7b7b97",
        "repeats": 31
}
{
        "message": {
                "systemcode": 27,
                "unitcode": 25,
                "state": "closed"
        },
        "origin": "receiver",
        "protocol": "elro_800_contact",
        "uuid": "0000-b8-27-eb-7b7b97",
        "repeats": 21
}

I need to extract information from protocol elro_800_contact and ev1527. I can successflly get it to work with elro_800_contact , but ev1527 is stil giving me trouble. If I use unitcode I get from pilight-receive pilight config json is invalid, because unitcode has to be between 0 and 20 - Ev1527 documentation . I think it has to do smth with converting to binary, then inverting? Similar to this LINK . Not really sure. If anyone knows how to get it working I would really appreciate it.

as @daenny said, run:

pilight-receive

in your terminal. Trigger the sensor/switch/etc and copy down the output of that. Then you can use that information to trigger your automations. You don’t need to create a switch/sensor for the device if it’s just a door/window/motion sensor, as you can simply have pilight place the action on the event bus and automate against that. I’ve included an example below of one of my automations for a (closet) door sensor. The sensor is a 433 MHz sensor that sends an open/closed/tamper code. My automation logs the event to the logbook, then either turns the light on or off depending on whether the door opened or closed. The light switch is called switch.door1 in my switches.yaml file.

automation:
  - alias: "Door Sensor 1 Closed"
    trigger:
      platform: event
      event_type: pilight_received
      event_data:
        protocol: ev1527
        uuid: 0000-b8-27-eb-4ffabc
        unitcode: 187263
        state: 'closed'
    action:
      - service: logbook.log
        data:
          name: "Automation Triggered (Door 1): "
          message: "Door 1 Closed"
      - service:
          switch.turn_off
        entity_id: switch.door1

  - alias: "Door Sensor 1 Opened"
    trigger:
      platform: event
      event_type: pilight_received
      event_data:
        protocol: ev1527
        uuid: 0000-b8-27-eb-4ffabc
        unitcode: 187263
        state: 'opened'
    action:
      - service: logbook.log
        data:
          name: "Automation Triggered (Door 1): "
          message: "Door 1 Open"
      - service:
          switch.turn_on
        entity_id: switch.door1

Hopefully this helps. You can get the unitcode/id/state/etc from pilight-receive. Keep in mind that your device may use multiple protocols, so use the one that works best for you.

So you may be using sensors similar to mine. In my case, here’s how my sensors work:

  • When the door sensor is open or tampered, the UNITCODE is the same (188277), but the STATE is different. The STATE is either reported as OPENED (open) or CLOSED (tamper).
  • When the door sensor is closed, the UNITCODE is a different code (188271) from the opened/tampered UNITCODE. The STATE is always reported as CLOSED.

In my automations, I use the pilight-received code posted above to exactly match the event placed on the event bus by pilight. This allows me to have a specific automation for each state of the sensor. Mine are working well, assuming you don’t trigger them back to back (open, closed, open, closed, etc) in a short period of time. I’ve found that they need about 1.5 seconds between state changes for HASS to keep up with pilight placing them on the event bus.

I had modified the code in the example above to make things simple, but I can paste a more detailed example of my automations if you still need them.

Thank you very much for your replies. I agree, I don’t actually need to create a separate pilight.sensor because I will also use it just to automate things. Thank you for your code, I’ll try to do something similar and report back if it’s working.

Can you also post your more detailed example, I think I can learn a lot from seeing how you’ve done your automations.

Thank you for your code, I got it working perfectly - as you said, I didn’t really need to see the state, I only needed it for my automations.

I have different a problem now.

I have an old weather station with 2 sensors, which communicate with RF and send info about temperature, humidity and battery. I can only add one sensor to hass, because again if I try to add both of them there are no configuration options in yaml to differentiate between them.

Can you give them different aliases? Or is this one of those “it sends both RF codes at the same time” thing?

I can give them different aliases and HASS then creates two sensors, but they both report the same data…so when the first sensor sends RF signal, both sensors would say e.g. 10 °C, and when the other sensor sends information both sensors in HASS would update according to this information.

And I’m assuming that there is not any sort of unique code sent with the data? Have you sniffed it with something like pilight-receive to see if there is anything that is unique that can help distinguish between the sensors?

Actually there is always a uniqie code sent with the data, like id, unitcode, etc. it’s only that HASS doesn’t support using those parameters, at least in documentation there is no such options…

I don’t know why it couldn’t be like in pilight.switch, where this unique data helps HASS differentiate between different switches.

Try setting up pilight to place all the received data on the event bus. Then run HASS from the cli and confirm that all the data is placed on the event bus. If it’s there, but HASS can’t interpret it, I’d submit it as a feature request. One of the developers should be able to knock that out fairly easily, however that also depends on the amount of data and overall workload.

If there is a unique code send with the data you can differentiate with this which weather station is talking. You just have to define them as message payload as mentioned in the manual.

E.g.:

sensor:
  - platform: pilight
    variable: temperature
    payload:
      unitcode: 123  # Code of first station
  - platform: pilight
    variable: temperature
    payload:
      unitcode: 456  # Code of second station

Have fun,
David

Hi everyone,

I hope it is okay to re-activate this topic, as it seems to desribe my current problem to some extent.

My setup: Home Assistant running as a Docker container on my QNAP NAS. Raspberry Pi 3 with the latest pilight build to control my 433 MHz sockets. I have setup HA to communicate with the pilight node on the RPi3. This works pretty well so far. Controlling the switches through HA works perfectly.

Unfortunately I have trouble when it comes toforwarding temperature sensor information from pilight to HA. I have two DS18S20 temp sensors attached via GPIO of the RPi3. Values are read correctly by pilight. But after some hours of playing around with it I can’t get the HA sensor to show any value. (It is visible in the HA states menu though, but only showing " - ".)

What I have tried so far in terms of config:

sensor:
  - platform: pilight
    name: 'Temperature'
    variable: 'temperature'
    payload:
      id: 0008030dfe83   ### GPIO adress of sensor
    unit_of_measurement: 'C'

… and further different combinations of adding in the UUID of the pilight node, etc.

Can someone point me in the right direction? Is this even possible?

My pilight conf-file reads the sensor correctly with the following setup:

devices.....

"tempIn": {
						"protocol": [ "ds18s20" ],
						"id": [{
						"id": "0008030dfe83"
						}],
						"temperature": 19.562 #initial value
													},

Thanks,
Nils