Notifications
Clear all

Do real smart switches exist?

15 Posts
3 Users
2 Likes
509 Views
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3926
Topic starter  

Not sure if this is the right sub-forum but I have just learned these so -called smart switches aren't.

What I mean is there is no concept of On and Off, the switches simply toggle.

I have an Alexa Dot, and an Arduino Cloud app with Alexa support. In Alexa I have a voice command that turns the power OFF (or so it thinks) but in the Cloud app all I have available to me in my code is an auto generated empty onChange call back procedure. I tried to see if the Api has anymore meat to it but I can't find the Api. Even if I find the Api and I can distinguish On from Off, there is still no way of knowing the current hardware state without a feedback mechanism. In my situation I added an electro-mechanical relay across the coil of the electric valve I am controlling which grounds an inout pin on my ESP32 and I turn on a LED. What I am still missing is a way to know if Alexa requested ON or OFF. So far since I can't find the Api all I have is notice the state changed. Am I missing something or have I just discovered what every other designer/developer already knew, the smart devices ain't so smart after all. 

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
Quote
b
 b
(@b)
Noble Member
Joined: 4 years ago
Posts: 912
 

@zander

I've only used Alexa some years back when I had a brief play with it by putting it on a rpi to get it to send a voice command to Alexa, and receiving a verbal back, and did not get round to making it do anything useful.  

As for smart switches those I've used would be sent Alexa on / off commands via their own cloud link that interprets the Alexa command and sends the appropriate http or mqtt command to the switch.  Thus I would not expect the smart switch itself would have the abilty to know if Alexa, through a cloud link, failed to send a command.  However,  at least for the smart switch I use (shelly) there is the ability to check its current status through a local http or mqtt status request.  

Therefore I think it depends on how you are connecting to Alexa.  If its through a home brewed gateway on the likes of a rpi, then I expect you could program in a status check shortly after it receives your voice command to send on to Alexa  So not so much a smart switch, but maybe a smart rpi together with a not so very smart switch combination ?? 


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3926
Topic starter  

@byron I figured there would be some real smart switches out there but I see no way for alexa to read it. That's ok though, as long as the switch is able to 'know' the difference between on and off then all is ok. My problem is the switches are just typical small snap switches, I have no room for a shelly or similar. The vast majority of alexa uses is to simply toggle the state of a switch, what it's connected to is irrelevant. I have a store bought switch and if/when I connect it to alexa I am sure if I ask her to turn that switch off twice the switch will turn from the second command. My post was mainly to share my experience with others since Bill brought up the subject originally.

I didn't know but suspected the shelly would be smarter, I am still not convinced the alexa is very smart or even able to be programmed to be.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
b
 b
(@b)
Noble Member
Joined: 4 years ago
Posts: 912
 

@zander,

I expect your own home brewed voice controller that is esp32 based would be much more your cup of tea.  Here is a link to an interesting youtube on this I bookmarked a while back as its something I will have a go at when I get chance.

Forget Alexa, do a Ron.


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3926
Topic starter  

@byron Seems more than I want to tackle at the moment and I have no idea how it would interface to the Arduino cloud.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
b
 b
(@b)
Noble Member
Joined: 4 years ago
Posts: 912
 
Posted by: @zander

I have no idea how it would interface to the Arduino cloud.

If the demo shown can be made to trigger a pin then it can be made to trigger a variable linked to the Arduino cloud I would think.  

Whilst I have not used the Arduino cloud apart from registering and creating something to receive a temperature variable, I was not overly impressed with the display facilities and prefer to stick to using my own cockpit displays.  But I can see the Arduino is a quick and useful way to get something up and running.  A home brewed 'Alexa' and display GUI programs are for sure not trivial especially when starting from scratch and it probably took me over a years worth of an hour here or there to get a GUI I liked up and running.  And even now I'm just starting to create my very own widgets rather than use predefined ones.  

Maybe its something to tackle later when your RV days are done.  A very smart home you may yet program too. 😎     


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3926
Topic starter  

@byron I am afraid I have more projects than time so I need to be selective. My interests will shift more to nature related like game cams, maybe a submersible camera, things like that.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@zander

Posted by: @zander

What I am still missing is a way to know if Alexa requested ON or OFF.

Hi Ron,

I did see in one or more videos, that if active or "loop" true, then basically, it must have been invoked by the linked process(Alexa, switch, etc...), thus you can keep track of it.

I also read that one event from a thing can be linked to another thing... perhaps that is something worth looking into?


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3926
Topic starter  

@frogandtoad I don't understand what you are saying, can you try again?

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@zander

Posted by: @zander

@frogandtoad I don't understand what you are saying, can you try again?

Hi Ron,

Basically, what I am saying is that: if you check for a status in your onSomeThingChanged() callback function (say for example, your switch dashboard object changed from true to false (via Alexa), and changed the actual linked variable), then it's fair to assume with great confidence, that if this callback did fire, then Alexa must have been the source to change it, thus you can track its ON/OFF status in the callback (true = ON, false = OFF)... otherwise, the whole IOT concept is absolutely flawed and incompetent, and not worth a pinch of shizen!

I think sometimes you just got to trust the tools you're using, unless you have evidence to support otherwise 🙂


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3926
Topic starter  

@frogandtoad Yes, that's how it works. But here is the problem. I have alexa configured to respond to 'turn water on' and 'turn water off'. However all I get is a single alexa event, no concept of on or off only change. I think I have figured out how to do it by looking at another variable. Sorry if this is newbie or obvious but this entire automation thing is new to me and so far not that impressed versus what I have been led to believe. In my words not smart devices, but not smart, however I will persevere.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@zander

Posted by: @zander

@frogandtoad Yes, that's how it works. But here is the problem. I have alexa configured to respond to 'turn water on' and 'turn water off'. However all I get is a single alexa event, no concept of on or off only change. I think I have figured out how to do it by looking at another variable. Sorry if this is newbie or obvious but this entire automation thing is new to me and so far not that impressed versus what I have been led to believe. In my words not smart devices, but not smart, however I will persevere.

From what I understand, Alexa will link to the cloud variable you created, which is also linked to your sketch variable, thus if you check that variable for true or false in your "onChangeCallback()" function, you will know if it is on or off, no?


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3926
Topic starter  

@frogandtoad NOPE, tou only know it's chsaged. The cakkback is even called onRvrntChaged. As soon as I am concious agin I wil tack down yho aelexa variable to see if she can generate a differenr message IIdsn'r she mqqt under the civers( and contain a paulod as in water On 5  or water in 10. 5 and 10m are payloads,is the opayulod

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@zander

Posted by: @zander

@frogandtoad NOPE, tou only know it's chsaged. The cakkback is even called onRvrntChaged. As soon as I am concious agin I wil tack down yho aelexa variable to see if she can generate a differenr message IIdsn'r she mqqt under the civers( and contain a paulod as in water On 5  or water in 10. 5 and 10m are payloads,is the opayulod

Hi Ron, sounds like you're still under the influence 🙂

If I understand you correctly, yes... if it changed, then it was Alexa who did it (if you told her to)!  If it wasn't (then think about it, and the consequences of that occurring), how could Alexa and her API ever be trusted again?  google would be out of business the next day, no?

It must work, or it must fail!


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3926
Topic starter  
Posted by: @frogandtoad

@zander

Posted by: @zander

@frogandtoad NOPE, tou only know it's chsaged. The cakkback is even called onRvrntChaged. As soon as I am concious agin I wil tack down yho aelexa variable to see if she can generate a differenr message IIdsn'r she mqqt under the civers( and contain a paulod as in water On 5  or water in 10. 5 and 10m are payloads,is the opayulod

Hi Ron, sounds like you're still under the influence 🙂

If I understand you correctly, yes... if it changed, then it was Alexa who did it (if you told her to)!  If it wasn't (then think about it, and the consequences of that occurring), how could Alexa and her API ever be trusted again?  google would be out of business the next day, no?

It must work, or it must fail!

@frogandtoad Agreed, except it's Amazon not Google. Different dumb talking thing.

Today I will see if it's possible to create 2 alexa switches with different names, let call the 'water on' and 'water off' If I can, and when I say 'alexa water on' ONLY the one switch callback is activated then problem solved. Now that I just typed that here it seems so easy even if a little tedious. TBH, my concern is that 'she' isn't all that discerning between 'water on', and 'water off', I think aql she really hears and reacts to is 'alexa water .....' But I will test that this morning.

I do have a plan B and am a little surprised nobody else caught me out on it. If the water is on and I get an alexa event, turn it off. If the water is off and I get an alexa event, turn it on.

The bottom line is I can make it work, I just want the most 'elegant' solution I can come up with.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
frogandtoad reacted
ReplyQuote