Get_state attribute not working

I see. So now I set my “current_state = new” all the rest is the same. It still fires when the state has not change. I wonder… Even if the state does not change but an attribute does, that will fire the listener?
Comparing the new to the old for a real change seems to work.
Current version:

import appdaemon.plugins.hass.hassapi as hass
import json
import urllib

class left_arived_home(hass.Hass):

  def initialize(self):
    self.device_tracker = 'device_tracker.' + self.args['devicetracker_home_status']
    self.device_tracker_full_name = self.get_state(self.device_tracker, attribute='full_name')
    self.listen_state(self.left_arived_home_callback,
                      self.device_tracker,
                      new='home')
    self.listen_state(self.left_arived_home_callback,
                      self.device_tracker,
                      new='not_home')
    self.log("Automaintion initialize.")

  def left_arived_home_callback(self, entity, attribute, old, new, kwargs):
    self.log('callback started')
    message = ""
    #current_state = self.get_state(self.device_tracker)
    current_state = new
    self.log("Current State '" 
             + self.device_tracker_full_name
             + " is "
             + current_state
             + " old state: "
             + old
             + " new state: "
             + new
             + "'")
    send_message = (old != new)
    if current_state == 'not_home':
      message = self.device_tracker_full_name + " has left "
    if current_state == 'home':
      message = self.device_tracker_full_name + " has arived "
    if send_message:
      self.call_service("notify/"+self.args['send_alert_to'],title="",message=message)
      self.log("\n****************************\n"
              + message + "\n"
              + "****************************\n"
              + "Message Sent")

@ReneTode I think attribute changing is what I am seeing. I am using the google map tracker. It seems to work pretty good. My wife is on the way back from our daughters house, so her attributes are changing. For example the latitude and longitude are changing, but the state is still “not_home” or at least not home yet. :slight_smile: I bet that is it.

The google map are:

source_type:
latitude: 
longitude: 
gps_accuracy:
address:
full_name:
id: 
last_seen: 
nickname: 
friendly_name:
entity_picture:

if you use

if new=="home" and old = "not-home":
  do stuff

in your callback you should only get state changes mentioned.