Skip to content

Not work Last Track Camera #59

Description

@pervolianinen

To operate the component with mopeds from China, the address app-api.niu.com is used.
To obtain a link to the images, use the address app-api.niucache.com
Tell. how to fix the link in the camera.py file to get the image correctly. For other sensors, I corrected the link in the const.py file. all sensors work correctly.
Previously, I used another component in which a picture with a route was displayed. It is no longer supported in the current version of home assistant.

cod of getting url for track image

def dataTrack(self, id_field): if id_field == "startTime" or id_field == "endTime": return datetime.fromtimestamp( (self._dataTrackInfo["data"][0][id_field]) / 1000 ).strftime("%Y-%m-%d %H:%M:%S") if id_field == "ridingtime": return strftime( "%H:%M:%S", gmtime(self._dataTrackInfo["data"][0][id_field]) ) if id_field == "track_thumb": thumburl = self._dataTrackInfo["data"][0][id_field].replace( "app-api.niucache.com", "app-api.niu.com" ) #return thumburl.replace("/track/thumb/", "/track/overseas/thumb/") return thumburl return self._dataTrackInfo["data"][0][id_field]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions