Controlling a Device with more than two states

Post Reply
Allendrome_
Posts: 3
Joined: Tue Jan 12, 2021 1:22 pm

I've been experimenting with SUPLA since yesterday on an ESP8266 board and have managed to use one of the demo sketches to control two relays, each showing as switches in the SUPLA app, and much to my delight have added both of these switches to my google home devices and can control them using my smart speaker. So far, so good!

However, my finished project will have five relays, and I only want one to be on at any one time. If possible, I'd like my project to show as one device in google home, with the ability to set 5 different states I.E. 'Set device to state 1' ( where relay one is on, and all others are off) as opposed to five separate devices with two states (on or off).

From what I've been able to tell so far, SUPLA currently does not support such a device. Can anyone tell me if that is correct? I've not been able to find a definitive device list with the relevant capabilities in the SUPLA app or when connected to google home.

Assuming that I'm right, my idea is to create something like a dummy 'dimmable' light device, where my sketch captures the dimming level sent from the SUPLA server and uses it to switch on the appropriate relays (perhaps at 100% brightness, the sketch turns on relay one, and the others off, and at 80% it turns on relay 2, and all others off etc.)

I would then set up routines in google home so that when I ask 'Set device to state 1' it sends a command to set the brightness of the light to 100%

I'd love it if someone could tell me if this is possible, and if so point me to any example sketches or other resources where I may be able to learn how to get info sent from SUPLA server to the device and use it in my sketch.

Thanks!
User avatar
pzygmunt
Posts: 18207
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Contact:

There is no such device in Supla. There is a dedicated "Dimmer" channel for dimming. You can prepare your own implementation that will enable the appropriate relays for the percentage ranges.
Allendrome_
Posts: 3
Joined: Tue Jan 12, 2021 1:22 pm

Thanks very much for your reply.

Can you point me towards any resources which may help me understand how to capture the data from the 'Dimmer' channel?
Allendrome_
Posts: 3
Joined: Tue Jan 12, 2021 1:22 pm

I no longer need help with the below, I took a punt and just used 'addDimmer' in place of 'addRGBControllerAndDimmer' and it worked great!

I now have a dimmer device in SUPLA, controllable via google assistant. I've got the dimming % value being returned by the serial console in the Arduino IDE, which updates as soon as I make a change via the SUPLA app or google assistant - so now have all I need to get my project working with just one device showing in the google home app.

Thanks for your help, SUPLA has solved my problem when many other avenues which I explored could not!

***Thanks! I've had a good stare at these and I think I can see a way forward.

Do you happen to have an example of 'SuplaDevice.addDimmer(); ' being used on it's own (without RGB)?

The Dimmer example you linked to is using a different nomenclature which I'm having a hard time trying to understand.

I've seen it commented out in some examples which use 'SuplaDevice.addRgbControllerAndDimmer(); '

I'd love to see how an 'add.Dimmer' example would work, that way I don't have to worry about the RGB stuff that I don't need!

Thanks again.***
rosh8097
Posts: 8
Joined: Sun May 30, 2021 3:56 pm

Hello
I want to control 4 relays with google assistant
I Have esp8266 and i want to program it with arduino ide
can you plzz help me??
Post Reply

Return to “General discussion”