Wyze Sense Motion and Contact Sensor Integration via IFTTT handled through Node Red

Yes, in your configuration.yaml file.

If you’re trying to do this outside of Node RED I think this is how the automation would look. It passes as a valid configuration but I have not tested it.

- alias: IFTTT Received
  initial_state: 'on'
  hide_entity: true
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      trigger_type: motion_sensor
      trigger_type: contact_sensor
  action:
    service_template: >
      {% if trigger.event.data.trigger_status == "on" %}
      homeassistant.turn_on
      {% elif trigger.event.data.trigger_status == "off" %}
      homeassistant.turn_off
      {% endif %}
    data_template:
      entity_id: input_boolean.{{trigger.event.data.trigger_name}}
2 Likes

Getting this error. I do have a “Sensors.yaml” It doesnt go in there?

Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/configuration.yaml”, line 153, column 10

Yes, if you have a sensors.yaml file you’ll want to place them in it vice the configuration file.

You see what I am doing wrong? Line 152 is… sensor: !include sensor.yaml

image

image

Ok. So you mentioned template sensors originally. Those go in the sensors.yaml file for you since you have it setup that way.

The automation should go in your automations.yaml file, not your sensors file.

So template sensor is nothing more than a storage spot for the value of a different sensor?

It is a template that fills in data depending on what it was fed, so you can write it once, and have it work for say, 5 different door sensors.

@hoffdad Thanks for this. I did all the automation in HA, and what you posted worked great!

2 Likes

@Bunnywinkles I am trying to do same automation all in HA, but can’t seem to trigger it. I know IFTTT applet is running and posting data to the webhook. But HA automation never triggers. Do you mind posting your code for automation?

- alias: IFTTT Received
  initial_state: 'on'
  hide_entity: true
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      trigger_type: contact_sensor
  action:
    service_template: '{% if trigger.event.data.trigger_status == "on" %} homeassistant.turn_on
      {% elif trigger.event.data.trigger_status == "off" %} homeassistant.turn_off
      {% endif %}

      '
    data_template:
      entity_id: input_boolean.{{trigger.event.data.trigger_name}}
  id: d36912ecb4cf4836a31761c8912206ad

I can’t get the service node working like you did? I get

Error call service, home assistant api error. Error Message: Service not found.

on the

turn_{{payload.event.trigger_status}}

line. (The entity ID line works fine however?)

I verified that IFTTT is sending the right trigger_status. Any ideas? What version is your NodeRed?

Thanks, Bob

Nevermind! I just realized my NodeRed was way old, updated and no longer a prob.

Thanks for posting this little project, I learned a lot about using IFTTT with NodeRed.

But I have to wonder: if the Wyze stuff can talk to IFTTT, they must have an API right? And if so, then why don’t we have a Home Assistant integration for Wyze devices?

Anyway, great work!
Bob

This is pretty cool/exciting but IFTTT delays can sometimes be longer than I’d like for a motion-based automation. (I’m looking at the Wyze stuff more for turning lights on/off automatically.) I haven’t really used webhooks in IFTTT; is it inherently faster than other IFTTT services? Any way to point it at an internal IP address (or even localhost) to eliminate the external call and further minimize delays? Sorry if those are stupid questions. I probably need to bone up on IFTTT webhooks.

Has anyone else seen this solution break after updating Node-Red to 4.0.6 in HASSIO? I should note that I was running Node-Red 4.0.2 before the update. This was working great until the call-service HA node was updated from version 0 to 1 at which point it seems to be failing to interpret the entity_id statement correctly input_boolean.{{payload.event.trigger_name}} and it seems to be sending that literal text instead of replacing the dynamic portion with the trigger name from the webhook. The service portion that states turn_{{payload.event.trigger_status}} is correctly dynamically inserting “on” or “off” based on the payload of the webhook but not the entity_id. I don’t know the best way to report this as a bug, if it in fact is one, with Node-Red. I don’t want to have to explicitly break out the sensor names instead of using this dynamic solution but I may have to if I can’t figure out why this is no longer working. I’m basing this assumption from debug output:

1 Like

I now see why this post didn’t prompt much attention. I doubt anyone is using it anymore, at least for the Sense line. A local solution was devised. Great work by this ever impressive community.

HOW TO INTEGRATE WYZE SENSE WITH HOME ASSISTANT

Hi !!! Does someone here using Wyze Sensors + IFTTT + Node Red + HA ? Mine stopped to work last Friday. Looks like Wyze is triggering IFTTT that is saying is triggering Node Red but looking Node Red Debug, I can’t see anything coming.

I was using that setup but have since moved on to the component in my previous post in this thread. Initially, I had to go into IFTTT and “touch” the Wyze service to get the triggering to pass to HA. I had to do this every 24 hours or so or the triggers would just stop. I even created a script to automate the steps for me since I had to do it every day. Just a couple of weeks before switching to the component this seemed to stop and the service stayed active without having to edit the Wyze service in IFTTT. Others reported having the same issue and other people didn’t. It’s possible that issue may have started for you.

The other thing that happened was that a Node Red update seemed to break being able to use a formula. You can see the detail of that in my other post in this thread. I ended up having to break out each individual sensor in Node Red to get them to change the input boolean. I don’t know what happened with that as I moved to the component before checking subsequent Node Red updates.

Hi Beeftastic, I see what you are proposing and I guess this is a good approach BUT in my case I would like to keep using the Wyze hub connected to the camera itself as I use it (the sensor) to work together with the camera motion detection to trigger the camera to save videos + AI + People Detection.
So, in my case, I keep:

  • crossing fingers to have Wyze + HA partnership
  • IFTTT working fine …

Yes, there are many reasons to want to keep the bridge on a camera which is why you should definitely go to the Wyze forums and vote for an official integration, if you haven’t done so yet. That would be my preference as well.

Did you try editing the Wyze service in the IFTTT portal? You don’t have to change anything. Just log in with your Wyze credentials and save it. If that allows the sensors to communicate again then you are seeing the same issue many of us have seen.

If that doesn’t work then there are other troubleshooting steps you can take. I went through quite a few when trying to make the IFTTT setup work when I first set it up.

Thank you for this! works perfectly. :smiley: