Start a new topic

My data (DIY) - value mapping

I am already using this app for my solar array and love the simple way it works.


Next I have integrated my Automower. Challange is that the API only returns a status code, e.g. 2 for "running" or 1 for "parking", etc. I have assigned different Logos to make each status somehow clear. However, it would be great if I could map the values to expressions, e.g. 2="running" instead of just having the logo and "2" in the display.



Depending on what platform you're using (DIY app, home automation, etc.), you would integrate the mapping logic in the code that processes and displays the Automower data.

For example, in a script geometry dash scratch:

# Example of a Python mapping

status_map = {

    1: "Parking",

    2: "Running",

    3: "Charging",

    4: "Error"

}

# Function to return mapped status

def get_status_description(status_code):

    return status_map.get(status_code, "Unknown Status")

# Sample status code from API

status_code = 2

print(f"Status: {get_status_description(status_code)}")

 

 

I don't have any influence on the Mowers API. What I doing is I am pinging my Mower from the MyData App with this command:    http://xxx.xxx.x.xx/json?cmd=status


The Mower returns below string. I don't see any way to map the status name outside MyData(DIY)

{"name": "Mower", "id": "xxxxxx", "status": {"status": 17, "distance": 0, "stopped": false, "duration": 41443, "mode": 0, "battery": 100, "hours": 2400}, "timer": {"status": 2, "next": {"date": "2024-09-25", "time": "13:30:00", "unix": 1727271000}}, "blades": {"quality": 61, "hours": 79, "days": 46}, "wlan": {"signal": -65}, "health": {"temperature": 23, "humidity": 25}, "clock": {"date": "2024-09-25", "time": "06:25:31", "unix": 1727245531}, "successful": true
Login or Signup to post a comment