sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
228 stars 122 forks source link

FAN #191

Closed tripleaarnold closed 3 years ago

tripleaarnold commented 3 years ago

Pls the sketch says nothing about the interfacing pins on the esp8266. What pins are to be connected and how are they connected? Because I built a voltage divider fan regulator and wanted a platform that would see all four speed as one device(fan) and not 4 sperate relays. Can this sketch do that?

sivar2311 commented 3 years ago

The examples are generic... there are no specific pin definitions... You can use ANY pin you want to use....

Just edit the onRangeValue callback this way:

bool onRangeValue(const String &deviceId, int &value) {
  int analogValue = map(value, 0, 3, 0, 1023); // map the value from 0..3 to 0..1023
  analogWrite(<YOUR PIN HERE>, analogValue);     // write the anlog value to a pin
  return true;
}
tripleaarnold commented 3 years ago

sir what am basically asking is can one virtual device (Fan) created on sinricpro be used to switch 4 relays(speed 1 to 4)using if satement ?am not a pro

kakopappa commented 3 years ago

If you want to turn on/off 4 relays then you need to add a logic like this

If value > 0 and < 25 then Turn on relay 1 Else if value > 25 and < 50 Turn on relay 2 …

when you change the speed in Alexa, it will send a percentage value. based on the value you need to turn on/off the correct relay.

If you want to control 0,1,2,3,4 individually then create four switches

You can’t mix these two

On Sun, 6 Jun 2021 at 8:27 PM tripleaarnold @.***> wrote:

sir what am basically asking is can one virtual device (Fan) created on sinricpro be used to switch 4 relays(speed 1 to 4)using if satement ?am not a pro

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/191#issuecomment-855399559, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZXOMSYSTBAQBT6ZVCLTRNZT5ANCNFSM46FVV3OQ .

smartswitchsio commented 3 years ago

I am getting this error from fan sketch, nothing added just clicked verify. fan error

sivar2311 commented 3 years ago

Your onAdjustRangeValue seems to be wrong. Can you share your function please?

smartswitchsio commented 3 years ago

i took this sketch from example, no changes made , kindly check Fan sketch under this library example folder

sivar2311 commented 3 years ago

Oh, looks like there is a typo in the example (missing an "&"). Please change line 60 bool onAdjustRangeValue(const String &deviceId, int rangeValueDelta) { to bool onAdjustRangeValue(const String &deviceId, int &rangeValueDelta) {

stale[bot] commented 3 years ago

This issue has gone quiet. Spooky quiet. We currently close issues after 14 days of inactivity. It’s been at least 7 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder, the best way to fix this or any other problem is to provide a detailed error description including a serial log. Thanks for being a part of the SinricPro community!

stale[bot] commented 3 years ago

Hey again! It’s been 14 days since anything happened on this issue, so our friendly robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder, the best way to fix this or any other problem is to provide a detailed error description including a serial log. Thanks again for being a part of the SinricPro community!