DanielOgorchock / ST_Anything

ST_Anything is an Arduino library, sketch, and Device Type that works with your SmartThings ThingShield to create an all-in-one SmartThings device.
GNU General Public License v3.0
438 stars 448 forks source link

Multiple Everything::sendSmartString commands? #212

Closed vseven closed 3 years ago

vseven commented 3 years ago

I.e can I add a second "Everything::sendSmartString" command? In the NeoPixelBus library I'm working on for programmable LED's there is already this line which was a hold over from it being based on the EX_Switch_Dim device:

Everything::sendSmartString(getName() + " " + (m_bCurrentState == HIGH?F("on"):F("off")));

Can I add a second for color after it like:

Everything::sendSmartString(getName() + " " + (m_bCurrentState == HIGH?F("on"):F("off")));
Everything::sendSmartString(getName() + " " + (m_sCurrentHEX  == s));

I'm also assuming the formatting is based on what the DTH is expecting? So if I did this I would have to change it a bit so it's not just getName but the value I'm sending back so the parse would correctly pull out what I have? I.e. the DTH needs to be updated also? Probably should anyway since it was based on the EX_Switch_Dim and the DTH is only looking for a on/off response which does work fine in the new app but dimmer/color change does not which the more I think about it the more I think I need to feed those back up.

(Long story short I'm having a issue with the new app where it takes the commands, they execute properly, but it hangs for 15 seconds then throws a network error message. You click ok and you can send another command (change dimmer, change color, etc) and it again works but same hang and delay. Just want to make sure it's not waiting for feedback. Also it would be nice to have for BT troubleshooting as it will pop up in the call back. I think it's another device health check issue but wanted to go down this path first.)

vseven commented 3 years ago

Ok, answered part of my question looking at the PS_TemperatureHumidity device handler where you do send up two, one for temp and one for humidity. Problem is each sends to it's own device handler.

So then I found the EX_Servo device and DTH and how you are sending up multiple pieces of info. Think that's what needs to be done with the RGB devices, instead of send back just on/off send back a string and use the parse to figure it out like:

Everything::sendSmartString(getName() + " " + String(m_bCurrentState) + ":" + String(m_sCurrentHEX)

Gonna try the Health Check code first to see if that fixes the problem and if not add the above to feed back the color.