Hi,
One very basic question, under IDE (outside of HA) we can simply run a command “python hello_world.py” to see if it works or if there are any errors.
But I am unable to achieve the same under AppDemon, here is the python script I am trying to execute. The script is suppose to send SMS message via Twilio API depending upon state of a boolean input.
type or pastefrom twilio.rest import Client
import appdaemon.plugins.hass.hassapi as hass
class twilio(hass.Hass):
def initialize(self):
self.listen_state(self.sendSMS, 0, new="on")
def sendSMS(self, entity):
current_state = self.get_state(input_boolean.test_switch)
if current_state = 1:
self.executeSMS()
else:
logger.info("****************************************")
logger.info("there is nothing to send for SMS")
logger.info("****************************************")
def executeSMS(self):
# Your Account Sid and Auth Token from twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = <blanked>
auth_token = <blanked>
client = Client(account_sid, auth_token)
logger.info("***********************************************")
logger.info("Python script triggered from automation")
logger.info("***********************************************")
message = client.messages.create(body="Sending text through automation.....",from_='+blanked',to='+1blanked')
But after restarting the AppDemon, I do not see any error or output in the logs.
Is there a better way to debug python code for AppDemon that I am not using?
Thanks,
Pankaj