sinricpro / non-sdk-issues

Report non sdk related issues here (Alexa, Google Home, SmartThings, IFTTT, API)
2 stars 0 forks source link

Alexa Routines with temperature sensor #36

Closed L-indigo closed 2 years ago

L-indigo commented 2 years ago

Hi! I created a contact sensor and a temperature sensor in a ESP8266 using Sinric pro. They're working really well but i've noticed that I couldn't use the temperature sensor as a trigger for a routine in Alexa app as I can use contact sensor for that. Is there something I'm missing while coding or is this not possible yet? Thank you!!

sivar2311 commented 2 years ago

This is a restriction by alexa. A temperature sensor is not supported for triggering routines.

L-indigo commented 2 years ago

Oh I understand... so sad... but okay, thanks for your support!!!

sivar2311 commented 2 years ago

Valid routine triggers are Contactsensor, Doorbell and Motionsensor. A solution could be to create a custom device including a temperature sensor and one of the sensor types above (to trigger a routine). Then your sketch could send an contact/doorbell/motion-event on a given temperature. There are multiple solutions, depending to your project requirements

L-indigo commented 2 years ago

So could I create another contact sensor for example, without associate with any ESP8266 pins and create a condition that opens or closes this contact sensor if temperature is above certain value?

sivar2311 commented 2 years ago

Yes, that should be a working solution. I don't know your project goals, so there might be other solutions (eg. a custom device template).

L-indigo commented 2 years ago

I intended to create something that would react to the temperature sensor. For example: If the temperature was above a certain value, Alexa could turn on the air conditioner or fan. What would you recommend in this case?

kakopappa commented 2 years ago

I think easiest option is to use SmartThings app for now.

  1. Install SmartThings app, create an account and login.

2.Link Sinric Pro. Your devices will show up here

  1. Create a routine

Ideally these automations should come from the platform itself without delegating. simple automations will be supported in the future releases.

On Sun, 19 Dec 2021 at 5:23 PM L-indigo @.***> wrote:

I intended to create something that would react to the temperature sensor. For example: If the temperature was above a certain value, Alexa could turn on the air conditioner or fan. What would you recommend in this case?

— Reply to this email directly, view it on GitHub https://github.com/sinricpro/non-sdk-issues/issues/36#issuecomment-997366693, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZXZWN4K6GJM6H5CBGLURWXC7ANCNFSM5KKOFO3A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

L-indigo commented 2 years ago

Ok, I'll try that. Thank you!!

sivar2311 commented 2 years ago

Sorry for the long delay.

What would you recommend in this case?

I would use either the ready-made devices SinricProThermsotat and SinricProContactsensor (this requires 2 deviceIDs).

Alternatively I would create a custom device template with the capabilities Thermostat and Contact Sensor. For the Thermostat capability i would enable Target Setpoint and the modes Auto and Off.

The thermostat supports sending the temperature as well as controlling the target temperature. The target temperature can then be used as a threshold for triggering the Contact Sensor. The mode Auto and Off can be used to turn on/off the trigger functionality.

KevWal commented 2 years ago

I can confirm, that a custom device template works for me, all the way through to Alexa making announcements.

Notifications setup like this: https://www.hackster.io/Techno500/alexa-repeating-esp32-esp8266-alarm-b47d44

My template looks like this:

#ifndef _TEMPERATUREALERT_H_
#define _TEMPERATUREALERT_H_

#include <SinricProDevice.h>
#include <Capabilities/ContactSensor.h>
#include <Capabilities/TemperatureSensor.h>

class TemperatureAlert 
: public SinricProDevice
, public ContactSensor<TemperatureAlert>
, public TemperatureSensor<TemperatureAlert> {
  friend class ContactSensor<TemperatureAlert>;
  friend class TemperatureSensor<TemperatureAlert>;
public:
  TemperatureAlert(const String &deviceId) : SinricProDevice(deviceId, "TemperatureAlert") {};
};

#endif

My full code is here: https://github.com/KevWal/M5-Watering

Thanks very much Kevin