-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
After upgrading to the latest speculos I noticed the /automation endpoint doesn't seem to be working as expected:
- In the past, I could call
curl -s "http://127.0.0.1:5000/automation" -d @/tmp/automation.jsonon a running API and have the automation executed immediately. - Now, I only get a 200 HTTP status, but nothing else happens, I assume the automation was posted but not actually triggered, which seems wrong because my automation's only condition is
"conditions": [[ "seen", false ]] - Running the server with the --automation flag does work as expected, but a warning recommends to use the API and that the flag will be deprecated
- After posting the automation, executing some other action manually like pressing left/right, I get a crash:
█[phantom][dotfiles][1]$ speculos app.elf
root: Parsing binary 'app.elf'
speculos: Device model detected from metadata: nanosp
speculos: Api level detected from metadata: 25
root: Parsing binary 'app.elf'
speculos: Found C_nbgl_fonts in sharedlib nanosp-api-level-shared-25.elf at 0x812C6C (12 bytes)
root: Parsing binary 'app.elf'
root: Parsing binary 'app.elf'
apdu: Server started on 0.0.0.0:9999
[*] speculos launcher revision: v0.25.13
[*] using API_LEVEL version 25 on nanosp
[*] loading CXLIB from "/home/ealfonso/.venv/lib/python3.13/site-packages/speculos/sharedlib/nanosp-api-level-shared-25.elf"
[*] patching svc instruction at 0x8123e4
[*] patching svc instruction at 0x80f144
[*] Seed initialized from environment
[*] Env app name: 'Passwords'
[*] Env app version: '1.3.0'
QPixmap::scaled: Pixmap is a null pixmap
[*] exit called (255)
QObject::disconnect: wildcard call disconnects from destroyed signal of QSocketNotifier::unnamed
Shouldn't the REST API not only set the automation rules, but also check if they can be run immediately?
from flask import request
import json
import jsonschema
from ..mcu import automation as mcu_automation
from .restful import SephResource
class Automation(SephResource):
def post(self):
document = request.get_data()
try:
document = document.decode("ascii")
except UnicodeDecodeError:
return "invalid encoding", 400
if document.startswith("file:"):
return "invalid document", 400
try:
rules = mcu_automation.Automation(document)
except json.decoder.JSONDecodeError:
return "invalid document", 400
except jsonschema.exceptions.ValidationError:
return "invalid document", 400
self.seph.automation = rules
# TODO check to see if automation should be triggerd now
return {}, 200
Here's what my automation looks like:
{
"version": 1,
"rules": [
{
"conditions": [[ "seen", false ]],
"actions": [
[ "setbool", "seen", true ],
["button", 2, true],
["button", 2, false],
["button", 2, true],
["button", 2, false],
["button", 2, true],
["button", 2, false],
["button", 2, true],
["button", 2, false],
...
...
I tried removing condition field or adding a text condition, this doesn't appear to change anything.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels