a2e45b8fdde315b756691b4ae573ad55f55dc002,homeassistant/components/history.py,,last_5_states,#Any#,26

Before Change


    Return the last 5 states for entity_id.
    entity_id = entity_id.lower()

    query = 
        SELECT * FROM states WHERE entity_id=? AND
        last_changed=last_updated
        ORDER BY state_id DESC LIMIT 0, 5
    

    return recorder.query_states(query, (entity_id, ))


def get_significant_states(start_time, end_time=None, entity_id=None):
    

After Change


    Return the last 5 states for entity_id.
    entity_id = entity_id.lower()

    states = recorder.get_model("States")
    return recorder.execute(
        recorder.query("States").filter(
            (states.entity_id == entity_id) &
            (states.last_changed == states.last_updated)
        ).order_by(states.state_id.desc()).limit(5))


def get_significant_states(start_time, end_time=None, entity_id=None):
    
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: home-assistant/home-assistant
Commit Name: a2e45b8fdde315b756691b4ae573ad55f55dc002
Time: 2016-07-02
Author: rhooper@toybox.ca
File Name: homeassistant/components/history.py
Class Name:
Method Name: last_5_states


Project Name: home-assistant/home-assistant
Commit Name: a2e45b8fdde315b756691b4ae573ad55f55dc002
Time: 2016-07-02
Author: rhooper@toybox.ca
File Name: homeassistant/components/history.py
Class Name:
Method Name: get_significant_states


Project Name: home-assistant/home-assistant
Commit Name: a2e45b8fdde315b756691b4ae573ad55f55dc002
Time: 2016-07-02
Author: rhooper@toybox.ca
File Name: homeassistant/components/history.py
Class Name:
Method Name: state_changes_during_period