Error "Cannot read property 'latitude' of undefined

Hi all,

I’m using HA in a RPi3 with AIO installer since 9 months around and I almost found help to my problems with the config file in this forum, but this time I really can’t get what it’s going on, so I please ask for your help;

Around one week ago I update/upgrade my system (Raspbian) and since then every time that I type “upgrade it again” the console shows this;

(I know this is not a forum to ask for help regarding Raspbian, but I don’t know if it related with my HA Problem) (and I already tried the same upgrade stopping mosquitto but the response is the same)

Even with that message, mosquitto runs great and actually I’m using it as my broker for DHT22 and door sensors without any problem being able to use the readings in HA

The problem is that on the last days I’m getting too often the following error when I’m trying to log into my HA (and actually that password page should not appear as I’m in LAN and is marked as “trusted netwoked” and in the pasted works great

The lattitude on my config file is ok,

This HA message dissapear some seconds after is showed and if I attemp to log in with the corrrct passwd the image change to “loading data” indefinitely
About the log…the only messages that I’m getting are;

17-01-12 04:52:01 homeassistant.components.sensor.statistics: variance requires at least two data points

17-01-12 04:52:04 homeassistant.components.mqtt: Disconnected from MQTT (1). Trying to reconnect in 1 s
(Several of this last ones, almost every 30 seconds and that’s it)

And sometimes also I got random errors like “darksky” is taking too much, or sensor.xx is taking too much

Finally the only “pattern” that I’ve found is that some times if I desactivate the "zone"s the error do not appear and actually the random errors also dissapear (but sometimes even if I #comment all the zones and latitude info in the config file the error persist specially when the log doesn’t have more than …“around”… +30 entries

And the only way it seems to completly dissapear is deleting the “sensor.statistics”

17-01-12 06:08:03 homeassistant.components.device_tracker: Duplicate device MAC addresses detected E8:50:8B:18:90:0D
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:30 homeassistant.components.sensor.statistics: mean requires at least one data point
17-01-12 06:08:39 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:08:39 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:09:01 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:09:01 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:09:02 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:09:02 homeassistant.helpers.condition: Value cannot be processed as a number: unknown
17-01-12 06:09:02 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:09:02 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:09:02 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:09:31 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:09:32 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:09:32 homeassistant.components.sensor.statistics: variance requires at least two data points
17-01-12 06:10:25 homeassistant.components.mqtt: Disconnected from MQTT (1). Trying to reconnect in 1 s
17-01-12 06:10:26 homeassistant.components.mqtt: Disconnected from MQTT (1). Trying to reconnect in 2 s
17-01-12 06:11:58 homeassistant.components.mqtt: Disconnected from MQTT (1). Trying to reconnect in 1 s
17-01-12 06:11:59 homeassistant.components.mqtt: Disconnected from MQTT (1). Trying to reconnect in 2 s
17-01-12 06:13:30 homeassistant.components.mqtt: Disconnected from MQTT (1). Trying to reconnect in 1 s
17-01-12 06:13:32 homeassistant.components.mqtt: Disconnected from MQTT (1). Trying to reconnect in 2 s

So I really don’t understand what is happening and I will really appreciate your time

I think any questions regarding installing mosquitto are fair game.

So it looks like mosquitto was running already. Can you see if it was the packaged version using

systemctl status mosquitto.service

and then see what is actually running using

ps -ef | grep mosquitto

can you post the top portion of your configuration.yaml file. The message about not being able to read property latitude of undefined has me wondering if you don’t have home setup correctly, and can you post a copy of your zones file. Again, I’m looking for a zone, latitude or longitude that is hanging out there alone.

:slight_smile: Thanks for your reply!

Actually, I had a lot of problems being able to set up mosquitto, because every time I tried to use it it says that was already loaded but it didn’t work, so I uninstall it and reinstall it some times after I realize that the auto-start file was pointing to a grong path to execute the source code. After I changed that patheverything works fine with mosquitto, but probably at that point and as mosquitto was pre-installed with HA AIO, and I reintstalled with “sudo-apt install moquitto” something could go bad

Regarding the first command you posted, the response if I run 2 times the “status” line is

Which actually I don’t know if its ok :frowning:

Thanks again

Ey! sure!

Actally I’m posting my complete conf file (with the personal info removed)
But probably it will not be that because I actally #commented all the zones and latitude lines and eventhough the error still appears;

I hope you can find something :frowning: thanks

homeassistant:
  name: x(not the actual value)
  latitude: x.4053(not the actual value)
  longitude: x.1638(not the actual value)
  unit_system: metric
  time_zone: America/xxxxxx(not the actual value)
  
  elevation: x (not the actual value)
  
  customize:
    sensor.speedtest_upload:
      friendly_name: Vel subida
      icon: mdi:arrow-up-bold-circle

      
http:
  api_password: xxx (not the actual value)
  ssl_certificate: '/etc/letsencrypt/live/xxxx.duckdns.org/fullchain.pem' (not the actual value)
  ssl_key: '/etc/letsencrypt/live/xxxxx.duckdns.org/privkey.pem' (not the actual value)
  trusted_networks:
    - 192.168.15.0/24

frontend:

conversation:

# Show links to resources in log and frontend
#introduction:

updater:

history:

sun:
  elevation: xxx (not the actual value)

discovery:


logbook:





recorder:
  purge_days: 5


mqtt:
  broker: 192.168.15.240
  port: xxxxx (not the actual value)
  client_id: HomeAssistant
#  keepalive: 60
  username: xx (not the actual value)
  password: xxxx  (not the actual value)





device_tracker:
  - platform: owntracks
    max_gps_accuracy: 100
  
device_tracker 2:
  platform: bluetooth_tracker
  interval_seconds: 300

device_tracker 3:
  platform: nmap_tracker
  hosts: 192.168.15.1/24
  consider_home: 1200


#device_tracker 4:
#  - platform: bluetooth_le_tracker

#zone:
#  name: Home
#  latitude: x.405350
#  longitude: xx.163617
#  radius: 60
#  icon: mdi:football-helmet
#  passive: false

#zone 2:
#  name: faaar
#  latitude: x.4413
#  longitude: xx.1986
#  radius: 80
#  icon: mdi:square-inc-cash
#  passive: false

#zone 3:
#  name: uffff
#  latitude: xx.610976
#  longitude: xx.256231
#  radius: 60
#  icon: mdi:face
#  passive: false
  

  
notify pushbullet:
  - platform: pushbullet
    name: PushBullet_RP
    api_key: x.x  
  

sensor 2:
  platform: darksky
  api_key: xxxxx
  monitored_conditions:
    - summary
    - icon
    - precip_type
    - precip_intensity
    - precip_probability
    - apparent_temperature
    - wind_speed
    - cloud_cover
    - humidity
    - pressure
    - visibility
    - hourly_summary
    - daily_summary

group:
  Speed_test_tab: 
    name: Vel. Internet
    view: yes
    icon: mdi:swap-vertical
    entities: group.Internet_data




  Internet_data:
    name: Vel 30min
    entities:
    - sensor.speedtest_download
    - sensor.speedtest_ping
    - sensor.speedtest_upload
    - sensor.estadistica_de_descarga_mean
    - sensor.estadistica_de_subida_mean
    - sensor.estadistica_de_t_ping_mean


  Clima_tab: 
    name: Clima
    view: yes
    icon: mdi:weather-rainy
    entities: group.Clima, group.Clima_summary, sensor.dark_sky_icon, sun.sun

  
  Clima_summary:
    name: Resumen del Clima
    entities:
    - sensor.dark_sky_daily_summary
    - sensor.dark_sky_hourly_summary
    - sensor.dark_sky_summary
  
  Clima:
    - sensor.dark_sky_humidity
    - sensor.dark_sky_apparent_temperature
    - sensor.dark_sky_cloud_coverage
    - sensor.dark_sky_visibility
    - sensor.dark_sky_wind_speed
    - sensor.dark_sky_pressure
    - sensor.dark_sky_precip
    - sensor.dark_sky_precip_intensity
    - sensor.dark_sky_precip_probability

  DHT11_tab: 
    name: DHT11
    view: yes
    icon: mdi:oil-temperature
    entities: group.DHT11_summary, group.dht22_rpi3_summary, group.dht22esp8266_summary, group.dht22esp8266dos_summary

  DHT11_summary:
    name: Sensor DHT11
    entities:
    - sensor.dht111_temperature
    - sensor.dht111_humidity
    - sensor.promedio_de_temp_dht11_mean
    - sensor.promedio_de_humedad_dht11_mean
    
  DHT22_RPi3_summary:
    name: Sensor DHT22_RPi3
    entities:
    - sensor.dht22rpi3_temperature
    - sensor.dht22rpi3_humidity
    - sensor.promedio_de_temp_dht22_rpi3_mean
    - sensor.promedio_de_humedad_dht22_rpi3_mean

  DHT22ESP8266_summary:
    name: Sensor DHT22 ESP8266 Interior
    entities:
    - sensor.temperatura_interior_esp8266_dht22
    - sensor.humedad_interior_esp8266_dht22
    - sensor.promedio_de_temp_interior_dht22_esp8266_mean
    - sensor.promedio_de_humedad_interior_dht22_esp8266_mean
  
  DHT22ESP8266dos_summary:
    name: Sensor DHT22 ESP8266 2 Exterior
    entities:
    - sensor.temperatura_exterior_esp8266_dht22
    - sensor.humedad_exterior_esp8266_dht22
    - sensor.promedio_de_temp_exterior_dht22_esp8266_mean
    - sensor.promedio_de_humedad_exterior_dht22_esp8266_mean

    
  Estadisticas_sys_tab: 
    name: stats_del_sistema
    view: yes
    icon: mdi:pi-box
    entities: group.stats_del_sistema

  stats_del_sistema:
    name: Estadísticas del sistema
    entities:
    - sensor.time__date
    - sensor.cpu_use
    - sensor.ram_use
    - sensor.disk_use_home
    - sensor.last_boot
    - sensor.since_last_boot
    - sensor.ipv4_address_wlan0
    - sensor.ipv4_address_eth0



  devices_conectados_tab: 
    name: Conectados
    view: yes
    icon: mdi:android
    entities: group.devices_conectados

  devices_conectados:
    name: Dispositivos conectados
    entities:
    - device_tracker.router    
    - device_tracker.xbox
    - device_tracker.ipodtouch
    - device_tracker.ipad




  camara_tab: 
    name: Camara
    view: yes
    icon: mdi:camera
    entities: sensor.mov_cmara, group.camara_info

  camara_info:
    name: Camara en streaming
    entities:
    - switch.mueve_servo
    - switch.mueve_servo_corto
    - camera.prueba_en_vivo






sensor 3:
  platform: speedtest
  server_id: xxx
  minute:
    - 0
    - 30
  monitored_conditions:
    - ping
    - download
    - upload

sensor Hr_Fecha:
  platform: time_date
  display_options:
    - 'time_date'


sensor Recursos_RPi3:
  platform: systemmonitor
  resources:
    - type: disk_use_percent
      arg: /home
    - type: memory_use_percent
    - type: processor_use
    - type: ipv4_address
      arg: eth0
    - type: ipv4_address
      arg: wlan0
    - type: last_boot
    - type: since_last_boot


automation:
  alias: 'Update Available Notifications PushBullet msg'
  trigger:
    platform: state
    entity_id: updater.updater
  action:
    service: notify.PushBullet_RP
    data:
      title: "Home Assistant updater"
      message: "Actualización de HA disponible"


automation 2:
  alias: 'Update Available Notifications'
  trigger:
    platform: state
    entity_id: updater.updater
  action:
    service: notify.notify
    data:
      message: 'Actualización Disponible'



automation 7 foursquare:
  - alias: Test check into a venue.
    trigger:
      platform: event
      event_type: foursquare.push
    action:
      service: notify.PushBullet_RP
      data:
        title: "Check_in"
        message: "Prueba check in"

automation 8:
  - alias: Temperatura Exterior
    trigger:
      platform: numeric_state
      entity_id: sensor.temperatura_exterior_esp8266_dht22
#      value_template: '{{ states.value_json.batt.state }}'
      below: 11.70
    action:
      service: notify.PushBullet_RPi3
      data:
        title: "Temp low"
        message: "low"

automation 9:
  - alias: Puerta de entrada
    trigger:
      platform: mqtt
      topic: "xx/state"
      payload: 'Puerta abierta'
    action:
      service: notify.PushBullet_RP
      data:
        title: "home"
        message: "open"
        

binary_sensor puerta casa:
  platform: mqtt
  state_topic: "xx/state"
  name: "Puerta entrada"
  qos: 0
  payload_on: "Puerta abierta"
  payload_off: "Puerta cerrada"
  sensor_class: opening




 
sensor template del sol:
  platform: template
  sensors:
    sun_state:
      value_template: '{% if is_state("sun.sun", "above_horizon") %}De día!{% else %}De noche{% endif %}'
      friendly_name: 'Momento del día'

 
sensor tasa_cambio:
  platform: openexchangerates
  api_key: xxxxxxx
  base: USD
  quote: EUR
  name: Tasa de cambio

notify twilio_revilo:
  platform: twilio_sms
  name: twilio
  account_sid: XXX
  auth_token: XXX
  from_number: +XXXX

  
automation twilio:
  - alias: Prueba
    trigger:
      platform: mqtt
      topic: XX/XX
      payload: 'closed'
    action:
      service: notify.twilio
      data:
        message: '1er prueba cerré las persianas'
        target:
          - +XX
          - +XX

sensor xboxLIVE info:
  platform: xbox_live
  api_key: XXXX
  xuid:
    - XXXXX


foursquare:
  access_token: "XXX"
  push_secret: "XXX"


sensor DHT11:
  platform: dht
  sensor: DHT11
  pin: 14
  name: dht111
  monitored_conditions:
    - temperature
    - humidity
    
sensor DHT22 RPi3:
  platform: dht
  sensor: DHT22
  pin: 15
  name: dht22RPi3
  monitored_conditions:
    - temperature
    - humidity
    
sensor ESTADISTICAS internet:
  - platform: statistics
    entity_id: sensor.speedtest_download
    name: Estadistica de descarga
    sampling_size: 48
  - platform: statistics
    entity_id: sensor.speedtest_upload
    name: Estadistica de subida
    sampling_size: 48
  - platform: statistics
    entity_id: sensor.speedtest_ping
    name: Estadistica de T. Ping
    sampling_size: 48

sensor ESTADISTICAS DHT11:
  - platform: statistics
    entity_id: sensor.dht111_temperature
    name: Promedio de temp. DHT11
    sampling_size: 48
  - platform: statistics
    entity_id: sensor.dht111_humidity
    name: Promedio de humedad DHT11
    sampling_size: 48
    
sensor ESTADISTICAS DHT22_rpi3:
  - platform: statistics
    entity_id: sensor.dht22rpi3_temperature
    name: Promedio de temp. DHT22_RPi3
    sampling_size: 48
  - platform: statistics
    entity_id: sensor.dht22rpi3_humidity
    name: Promedio de humedad DHT22_RPi3
    sampling_size: 48

sensor tempDHT22_mqtt:
  platform: mqtt
  state_topic: "XX/XX"
  name: "Temperatura Interior ESP8266 DHT22"
  unit_of_measurement: "°C"

sensor humedadDHT22_mqtt:
  platform: mqtt

  state_topic: "XX/XX"
  name: "Humedad Interior ESP8266 DHT22"
  unit_of_measurement: "%"
  
sensor ESTADISTICAS DHT22_mqtt:
  - platform: statistics
    entity_id: sensor.temperatura_interior_esp8266_dht22
    name: Promedio de temp. Interior DHT22 ESP8266
    sampling_size: 48
  - platform: statistics
    entity_id: sensor.humedad_interior_esp8266_dht22
    name: Promedio de humedad Interior DHT22 ESP8266
    sampling_size: 48
    
sensor tempDHT22_mqtt2:
  platform: mqtt
  state_topic: "XX/XXX"
  name: "Temperatura Exterior ESP8266 DHT22"
  unit_of_measurement: "°C"

sensor humedadDHT22_mqtt2:
  platform: mqtt
  state_topic: "XX/XX"
  name: "Humedad Exterior ESP8266 DHT22"
  unit_of_measurement: "%"
  
sensor ESTADISTICAS DHT22_mqtt2:
  - platform: statistics
    entity_id: sensor.temperatura_Exterior_esp8266_dht22
    name: Promedio de temp. Exterior DHT22 ESP8266
    sampling_size: 48
  - platform: statistics
    entity_id: sensor.humedad_Exterior_esp8266_dht22
    name: Promedio de humedad Exterior DHT22 ESP8266
    sampling_size: 48

Just for grins, make sure the name you have under the homeassistant section and one of your zones have the same name. I think I read that there had to be a matching zone for the ha install location.

That’s probably not what’s causing the error on login, but it’s not much to try.

Not really, it shows that mosquitto is being restarted, probably continuously.

Can tail the end of the log file, to see if it is reporting an error.

tail -20 /var/log/mosquitto/mosquitto.log