Trying to do a compare of the current state with my kwarg

Hey everyone so I finally got my zwave usb stick so the grand migration of all of my devices has begun including adding a zwave thermostat.

So I wrote this app for the thermostat. This is only my first rendition of it as I need to put in door checks so in case a kid leaves a door open for too long to shut off the AC/Heat.
https://github.com/TheFuzz4/HomeAssistant/blob/master/appdaemon/apps/thermostat_control.py

But its throwing this error when attempting to compare the current set point to where it should be

2018-06-11 10:30:17.403465 WARNING AppDaemon: ------------------------------------------------------------
2018-06-11 10:30:17.405487 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 581, in worker
    funcref(self.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/thermostat_control.py", line 20, in whole_house_thermost_control_cb
    if self.get_state(self.thermostat_ac, attribute="temperature") != self.kwargs["ACTempID"]:
AttributeError: 'thermostat_control' object has no attribute 'kwargs'

2018-06-11 10:30:17.406212 WARNING AppDaemon: ------------------------------------------------------------

I’ve tried putting the kwargs in () and without the () but I must be missing something super simple here. Thank you all for your assistance.

As the error says, kwargs is not a member of the class, it is a parameter to the function, so there is no need for self., it is just

            if self.get_state(self.thermostat_ac, attribute="temperature") != kwargs["ACTempID"]:
2 Likes

to expand on this, kwargs is for the specific function,self.args is used when referencing the arguments/variables for the app (within apps.yaml)

3 Likes

Gotcha, I knew it would be something simple. This is the first time I’ve done a comparison like this so I was just used to doing it the way I’ve called kwargs in the past. Thank you for the learning session :slight_smile:

So turns out there is actually a provided xml for this. Now I need to figure out where to shove this xml with hassio :slight_smile: