kevinkk525 / pysmartnode

Micropython Smarthome framework
MIT License
113 stars 22 forks source link

i don´t understand the remoteconfig service #13

Closed dasTholo closed 4 years ago

dasTholo commented 4 years ago

Hej Kevin! Alot of thanks for your upy smart nodes projects at first! I think I am making a mistake because my English is not sufficient. Maybe you can help me. I don´t understand the remoteconfig options,

At first i´ve run the smartserver. Logs looking good.

[2020-02-16 11:02:58,790] [INFO] [MQTT] [_keep_connected] Keeping connected [2020-02-16 11:02:58,794] [INFO] [Main] [main] Starting main loop [2020-02-16 11:03:00,089] [INFO] [MQTT] [_connected] Connection returned result: Connection Accepted.

I have create an firmware image with froozen files (also with docker, you can see this at my PR) Frozen Files are:

Then i have copy boot.py config.py and main.py to the esp32 rootdir with ampy. MQTT_RECEIVE_CONFIG = True in config.py When i start the node the Micropython log will show this:

FTP-Server active Connected, local ip '192.168.178.42' Synchronize time from NTP server ... FTP Server started on 192.168.178.42 Set time to (2020, 2, 16, 13, 16, 42, 6, 47) [2020-02-16 13:16:42] [RAM] [info] 92432 [2020-02-16 13:16:42] [MQTT] [info] (sysname='esp32', nodename='esp32', release='1.12.0', version='v1.12 on 2020-02-12', machine='ESP32 module with ESP32') [2020-02-16 13:16:42] [MQTT] [info] Client version: 600 [2020-02-16 13:16:43] [config] [info] Added module WifiLED version 1.4 as component wifi_led [2020-02-16 13:16:44] [config] [info] Added module remoteConfig version 0.8 as component None received amount {'_order': []} [2020-02-16 13:16:45] [MQTT] [error] Error executing mqtt topic 'home/login/3c71bfaaafd8': can't convert dict to int

At SmartServer i can see this:

[2020-02-16 11:03:45,241] [INFO] [Clients] [init] Created device '3c71bfaaafd8' [2020-02-16 11:03:45,243] [INFO] [3c71bfaaafd8] [getLog] [MQTT] (sysname='esp32', nodename='esp32', release='1.12.0', version='v1.12 on 2020-02-12', machine='ESP32 module with ESP32') [2020-02-16 11:03:45,525] [INFO] [3c71bfaaafd8] [getLog] [MQTT] Client version: 600 [2020-02-16 11:03:45,703] [INFO] [3c71bfaaafd8] [getLog] [config] Added module WifiLED version 1.4 as component wifi_led [2020-02-16 11:03:46,466] [INFO] [3c71bfaaafd8] [getLog] [config] Added module remoteConfig version 0.8 as component None [2020-02-16 11:03:46,826] [INFO] [Main] [sendConfig] Config request from 3c71bfaaafd8 version [600, 'esp32', 0.5] platform None [2020-02-16 11:03:47,422] [ERROR] [3c71bfaaafd8] [getLog] [MQTT] Error executing mqtt topic 'home/login/3c71bfaaafd8': can't convert dict to int [2020-02-16 11:06:39,980] [INFO] [3c71bfaaafd8] [getLog] [MQTT] (sysname='esp32', nodename='esp32', release='1.12.0', version='v1.12 on 2020-02-12', machine='ESP32 module with ESP32') [2020-02-16 11:06:40,261] [INFO] [3c71bfaaafd8] [getLog] [MQTT] Client version: 600 [2020-02-16 11:06:41,017] [INFO] [3c71bfaaafd8] [getLog] [config] Added module WifiLED version 1.4 as component wifi_led [2020-02-16 11:06:41,479] [INFO] [3c71bfaaafd8] [getLog] [config] Added module remoteConfig version 0.8 as component None [2020-02-16 11:06:41,978] [INFO] [Main] [sendConfig] Config request from 3c71bfaaafd8 version [600, 'esp32', 0.5] platform None [2020-02-16 11:06:42,440] [ERROR] [3c71bfaaafd8] [getLog] [MQTT] Error executing mqtt topic 'home/login/3c71bfaaafd8': can't convert dict to int

In MQTT:

home/login/3c71bfaaafd8 {"_order": [] home/log/error/3c71bfaaafd8 [MQTT] Error executing mqtt topic 'home/login/3c71bfaaafd8': can't convert dict to int

I think (but doesn´t know!) i must set up the components dict. But don´t understand this. Do I have to send a mqtt message to /login//set? I ´ve test a lot Json payloads like this { "_order": ["ram"], "ram": { "package": ".machine.ram", "component": "ram", "constructor_args": { "interval": 60 } } }

Or must i setup an config.json or hjson at the smartserver?

I think this one is very relevant **Added module remoteConfig version 0.8 as component None**

Maybe you can help me...

kevinkk525 commented 4 years ago

I may have made a mistake when porting SmartServer:home-assistant back to SmartServer:master because I changed the way the remote configuration is being sent. I'll check later.

Can you monitor the mqtt messages that are being sent?

What is your native language? German?

dasTholo commented 4 years ago

Which topics do you need? Error and log? Or I will show you later /home/#

Yeah, my native language is german. You too?

kevinkk525 commented 4 years ago

Ok hier sind vermutlich 2 Probleme: 1) Ich habe beim SmartServer backport vom branch home-assistant ein "import json" vergessen: https://github.com/kevinkk525/SmartServer/commit/094b5ec30cf0b8e1e6e81c17b27eae29a64af1ae Danach sollte die Konfiguration korrekt gesendet werden und der Log-Eintrag so aussehen:

 [INFO] [Main] [sendConfig] Config request from 3c71bfaaafd8 version 600 platform esp32

2) Du musst für das Gerät eine Konfiguration im SmartServer anlegen, sonst wird (wie jetzt auch) nur {"_order": []} gesendet, was eine leere Konfiguration ist. Nach der ersten Nachricht des Gerätes sollte automatisch der Ordner Clients/3c71bfaaafd8 angelegt worden sein. Hier kannst du eine Datei "config.hsjon" anlegen. Wie ich sehe, habe ich nicht gut beschrieben, was diese Datei beinhalten sollte, daher hier ein Beispiel:

{
  _order:
  [
    i2c
    htu
    led
    buzzer
  ]
  i2c:
  {
    package: .machine.i2c
    component: I2C
    constructor_args:
    {
      SCL: D6
      SDA: D5
    }
  }
  htu:
  {
    package: .sensors.htu21d
    component: HTU21D
    constructor_args:
    {
      # mqtt_topic: sometopic
      # interval: 600
      i2c: i2c
      precision_temp: 2         #precision of the temperature value published
      precision_humid: 1        #precision of the humid value published
      temp_offset: -2.0            #offset for temperature to compensate bad sensor reading offsets
      humid_offset: 10.0           #...             
    }
  }
  led:
  {
    package: .switches.led
    component: LEDNotification
    constructor_args:
    {
      pin: D7
      on_time: 50    #optional, time led is on, defaults to 50ms
      off_time: 50  #optional, time led is off, defaults to 50ms
      iters: 50
    }
  }
  buzzer:
  {
    package: .switches.buzzer
    component: Buzzer
    constructor_args:
    {
      pin: D1
      pwm_values:
      [
        256
        64
        16
        64
      ]
      on_time: 500
      iters: 2
    }
  }
}

Die Liste "_order" beschreibt die Reihenfolge, in der die Komponenten geladen werden, damit mögliche Abhängigkeiten erfüllt sind. Die Konfiguration der Komponenten sind in jedem Modul vor dem Code aufgeführt und können von dort kopiert werden.

PS: Die von dir zitierte Konfiguration "ram" ist veraltet, sie ist automatisch vorhanden im Modul machine.stats, welches automatisch geladen wird.

PPS: Ich habe gerade einen Bugfix vom Branch "dev" gemerged, der für RemoteConfig relevant ist. Ohne diesen kann es sein, dass der ESP nach dem Erhalt der Konfiguration mit einem Fehler neustartet.

dasTholo commented 4 years ago

Es geht zumindest Vorwärts! Zum SmartServer: Wenn die config.hjson in Client/NodeName/config.hjson muss, wozu ist der config ordner unter Client/NodeName/config/ ?

Mein Serverlog sieht jetzt wie folgt aus:

[2020-02-16 19:28:09,468] [INFO] [Main] [main] Starting main loop [2020-02-16 19:28:10,734] [DEBUG] [MQTT] [_easy_log] Received CONNACK (0, 0) [2020-02-16 19:28:10,735] [INFO] [MQTT] [_connected] Connection returned result: Connection Accepted. [2020-02-16 19:28:10,736] [DEBUG] [MQTT] [_easy_log] Sending SUBSCRIBE (d0, m3) [(b'/home', 1)] [2020-02-16 19:28:10,738] [DEBUG] [MQTT] [_easy_log] Sending SUBSCRIBE (d0, m4) [(b'/home/login', 1)] [2020-02-16 19:28:10,739] [DEBUG] [MQTT] [_easy_log] Sending SUBSCRIBE (d0, m5) [(b'/home/login/#', 1)] [2020-02-16 19:28:10,741] [DEBUG] [MQTT] [_easy_log] Sending SUBSCRIBE (d0, m6) [(b'/home/log', 1)] [2020-02-16 19:28:10,742] [DEBUG] [MQTT] [_easy_log] Sending SUBSCRIBE (d0, m7) [(b'/home/log/#', 1)] [2020-02-16 19:28:10,795] [DEBUG] [MQTT] [_easy_log] Received SUBACK [2020-02-16 19:28:10,848] [DEBUG] [MQTT] [_easy_log] Received SUBACK [2020-02-16 19:28:10,900] [DEBUG] [MQTT] [_easy_log] Received SUBACK [2020-02-16 19:28:10,952] [DEBUG] [MQTT] [_easy_log] Received SUBACK [2020-02-16 19:28:11,004] [DEBUG] [MQTT] [_easy_log] Received SUBACK [2020-02-16 19:28:11,056] [DEBUG] [MQTT] [_easy_log] Received SUBACK [2020-02-16 19:28:11,107] [DEBUG] [MQTT] [_easy_log] Received SUBACK [2020-02-16 19:28:29,567] [DEBUG] [MQTT] [_easy_log] Received PUBLISH (d0, q0, r0, m0), 'home/log/info/3c71bfaaafd8', ... (127 bytes) [2020-02-16 19:28:29,568] [DEBUG] [MQTT] [_execute] mqtt execution: home/log/info/3c71bfaaafd8 b"[MQTT] (sysname='esp32', nodename='esp32', release='1.12.0', version='v1.12 on 2020-02-16', machine='ESP32 module with ESP32') " /usr/src/app/utils/clients.py:39: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. names = yaml.load(f) [2020-02-16 19:28:29,573] [INFO] [KitchenNode] [getLog] [MQTT] (sysname='esp32', nodename='esp32', release='1.12.0', version='v1.12 on 2020-02-16', machine='ESP32 module with ESP32') [2020-02-16 19:28:30,225] [DEBUG] [MQTT] [_easy_log] Received PUBLISH (d0, q0, r0, m0), 'home/log/info/3c71bfaaafd8', ... (27 bytes) [2020-02-16 19:28:30,227] [DEBUG] [MQTT] [_execute] mqtt execution: home/log/info/3c71bfaaafd8 b'[MQTT] Client version: 601 ' [2020-02-16 19:28:30,233] [INFO] [KitchenNode] [getLog] [MQTT] Client version: 601 [2020-02-16 19:28:30,383] [DEBUG] [MQTT] [_easy_log] Received PUBLISH (d0, q0, r0, m0), 'home/log/info/3c71bfaaafd8', ... (64 bytes) [2020-02-16 19:28:30,385] [DEBUG] [MQTT] [_execute] mqtt execution: home/log/info/3c71bfaaafd8 b'[config] Added module WifiLED version 1.4 as component wifi_led ' [2020-02-16 19:28:30,393] [INFO] [KitchenNode] [getLog] [config] Added module WifiLED version 1.4 as component wifi_led [2020-02-16 19:28:31,046] [DEBUG] [MQTT] [_easy_log] Received PUBLISH (d0, q0, r0, m0), 'home/log/info/3c71bfaaafd8', ... (65 bytes) [2020-02-16 19:28:31,047] [DEBUG] [MQTT] [_execute] mqtt execution: home/log/info/3c71bfaaafd8 b'[config] Added module remoteConfig version 0.8 as component None ' [2020-02-16 19:28:31,049] [INFO] [KitchenNode] [getLog] [config] Added module remoteConfig version 0.8 as component None [2020-02-16 19:28:31,401] [DEBUG] [MQTT] [_easy_log] Received PUBLISH (d0, q0, r0, m0), 'home/login/3c71bfaaafd8/set', ... (19 bytes) [2020-02-16 19:28:31,402] [DEBUG] [MQTT] [_execute] mqtt execution: home/login/3c71bfaaafd8/set b'[601, "esp32", 0.5]' [2020-02-16 19:28:31,403] [DEBUG] [Main] [sendConfig] sendConfig main: home/login/3c71bfaaafd8/set,[601, 'esp32', 0.5] [2020-02-16 19:28:31,403] [DEBUG] [Main] [sendConfig] config requested [2020-02-16 19:28:31,404] [INFO] [Main] [sendConfig] Config request from 3c71bfaaafd8 version [601, 'esp32', 0.5] platform None [2020-02-16 19:28:31,409] [DEBUG] [Clients] [getConfig] Get config [2020-02-16 19:28:31,413] [DEBUG] [Main] [sendConfig] Config for 3c71bfaaafd8: {'_order': ['led', 'buttom'], 'led': OrderedDict([('package', '.switches.led'), ('component', 'LEDNotification'), ('constructor_args', OrderedDict([('pin', 2), ('on_time', 50), ('off_time', 50), ('iters', 50)]))]), 'buttom': OrderedDict([('package', '.machine.button'), ('component', 'Button,'), ('constructor_args', OrderedDict([('pin', 23), ('pressed_component', 'testswitch'), ('pressed_method', 'on'), ('long_pressed_component', 'machine'), ('long_pressed_method', 'reset'), ('suppress', 'False # suppress calling release function after double click and long press. Will delay release function by 300ms if double click is used.')]))])} [2020-02-16 19:28:31,415] [DEBUG] [MQTT] [_easy_log] Sending PUBLISH (d0, q1, r0, m8), 'b'home/login/3c71bfaaafd8'', ... (557 bytes) [2020-02-16 19:28:31,453] [DEBUG] [MQTT] [_easy_log] Received PUBACK (Mid: 8) [2020-02-16 19:28:31,506] [DEBUG] [MQTT] [_easy_log] Received PUBLISH (d0, q0, r0, m0), 'home/login/3c71bfaaafd8', ... (557 bytes) [2020-02-16 19:28:31,508] [DEBUG] [MQTT] [_execute] mqtt execution: home/login/3c71bfaaafd8 b'{"_order": ["led", "buttom"], "led": {"package": ".switches.led", "component": "LEDNotification", "constructor_args": {"pin": 2, "on_time": 50, "off_time": 50, "iters": 50}}, "buttom": {"package": ".machine.button", "component": "Button,", "constructor_args": {"pin": 23, "pressed_component": "testswitch", "pressed_method": "on", "long_pressed_component": "machine", "long_pressed_method": "reset", "suppress": "False # suppress calling release function after double click and long press. Will delay release function by 300ms if double click is used."}}}' [2020-02-16 19:28:31,510] [DEBUG] [Main] [sendConfig] sendConfig main: home/login/3c71bfaaafd8,{'_order': ['led', 'buttom'], 'led': {'package': '.switches.led', 'component': 'LEDNotification', 'constructor_args': {'pin': 2, 'on_time': 50, 'off_time': 50, 'iters': 50}}, 'buttom': {'package': '.machine.button', 'component': 'Button,', 'constructor_args': {'pin': 23, 'pressed_component': 'testswitch', 'pressed_method': 'on', 'long_pressed_component': 'machine', 'long_pressed_method': 'reset', 'suppress': 'False # suppress calling release function after double click and long press. Will delay release function by 300ms if double click is used.'}}} [2020-02-16 19:28:32,065] [DEBUG] [MQTT] [_easy_log] Received PUBLISH (d0, q0, r0, m0), 'home/log/error/3c71bfaaafd8', ... (87 bytes) [2020-02-16 19:28:32,068] [DEBUG] [MQTT] [_execute] mqtt execution: home/log/error/3c71bfaaafd8 b"[MQTT] Error executing mqtt topic 'home/login/3c71bfaaafd8': can't convert dict to int " [2020-02-16 19:28:32,075] [ERROR] [KitchenNode] [getLog] [MQTT] Error executing mqtt topic 'home/login/3c71bfaaafd8': can't convert dict to int

Die Plattform ist immernoch None Aus dem upy repl: Das Update hat funktioniert

PySmartNode version 601 started Allerdings sehe ich noch folgendes [config] [info] Added module remoteConfig version 0.8 as component None

[2020-02-16 21:32:31] [MQTT] [error] Error executing mqtt topic 'home/login/3c71bfaaafd8': can't convert dict to int

Die LED Pin2 is onboard. Pin ist sicher die 2, da WifiLed auch darauf liegt. Oder ist das ganz und gar das problem? Ich hab einen Buttom auf Pin 23 zum Test. Ohne Erfolg Meine config.hjson sieht wie folgt aus ` { _order: [ led button ] led: { package: .switches.led component: LEDNotification constructor_args: { pin: 2 on_time: 50 #optional, time led is on, defaults to 50ms off_time: 50 #optional, time led is off, defaults to 50ms iters: 50 } } button: { package: .machine.button component: Button, constructor_args: { pin: 23

pull: null,

  # mqtt_topic: null     # optional, defaults to <mqtt_home>/<device_id>/Button<_unit_index>/set
  # friendly_name: null  # optional, friendly name shown in homeassistant gui with mqtt discovery
  # discover: true       # optional, if false no discovery message for homeassistant will be sent.
  pressed_component: testswitch
  pressed_method: "on"
  # released_component: testswitch
  # released_method: "off"
  # double_pressed_component: testswitch
  # double_pressed_method: "on"
  long_pressed_component: machine
  long_pressed_method: reset
  suppress: False   # suppress calling release function after double click and long press. Will delay release function by 300ms if double click is used.
}

} } ` Kommt auch so an:

received amount {'_order': ['Led', 'Button'], 'Led': {'constructor_args': {'iters': 50, 'pin': 2, 'on_time': 50, 'off_time': 50, 'mqtt_topic': 'home/KitchenNode/led/set'}, 'component': 'LEDNotification', 'package': '.switches.led'}, 'Button': {'constructor_args': {'pin': 23, 'suppress': 'False # suppress calling release function after double click and long press. Will delay release function by 300ms if double click is used.', 'long_pressed_component': 'machine', 'pressed_method': 'on', 'long_pressed_method': 'reset', 'pressed_component': 'testswitch'}, 'component': 'Button,', 'package': '.machine.button'}} [2020-02-16 22:08:43] [MQTT] [error] Error executing mqtt topic 'home/login/3c71bfaaafd8': can't convert dict to int [2020-02-16 22:08:51] [RAM] [info] 93056

Meine Attributs aus Hassio; RAM free (bytes): 92832 Micropython version: v1.12 on 2020-02-16 RSSI: -56 MQTT Reconnects: 0 MQTT Subscriptions: 1 Last boot: 2020-02-16 21:28:18 MQTT Downtime: 0T00:00:00 MQTT Dropped messages: 0 Asyncio waitq: 8/32 Uptime: 0T00:40:33 IPAddress: 192.168.178.42 Pysmartnode version: 601 unit_of_measurement: dBm friendly_name: Status KitchenNode icon: mdi:information-outline

Ich hab mal deine config.hjson 1:1 kopiert:

received amount {'led': {'constructor_args': {'off_time': 50, 'iters': 50, 'pin': 'D2', 'on_time': 50}, 'component': 'LEDNotification', 'package': '.switches.led'}, 'buzzer': {'constructor_args': {'pwm_values': [256, 64, 16, 64], 'iters': 2, 'pin': 'D23', 'on_time': 500}, 'component': 'Buzzer', 'package': '.switches.buzzer'}, 'htu': {'constructor_args': {'temp_offset': -2, 'humid_offset': 10, 'precision_humid': 1, 'precision_temp': 2, 'i2c': 'i2c'}, 'component': 'HTU21D', 'package': '.sensors.htu21d'}, '_order': ['i2c', 'htu', 'led', 'buzzer'], 'i2c': {'constructor_args': {'SDA': 'D5', 'SCL': 'D6'}, 'component': 'I2C', 'package': '.machine.i2c'}} [2020-02-16 22:10:43] [MQTT] [error] Error executing mqtt topic 'home/login/3c71bfaaafd8': can't convert dict to int

Das bringt meine Python und Script Kenntnisse an seine Grenzen! Danke dir trotzdem nochmal für die Hilfe!

kevinkk525 commented 4 years ago

Oh ich habe den Fehler jetzt gefunden, sorry.. Bugfix ist online, jetzt sollte es gehen. Tut es jedenfalls bei mir lokal.

[2020-02-16 19:28:31,508] [DEBUG] [MQTT] [_execute] mqtt execution: home/login/3c71bfaaafd8 b'{"_order": ["led", "buttom"], "led": {"package": ".switches.led", "component": "LEDNotification", "constructor_args": {"pin": 2, "on_time": 50, "off_time": 50, "iters": 50}}, "buttom": {"package": ".machine.button", "component": "Button,", "constructor_args": {"pin": 23, "pressed_component": "testswitch", "pressed_method": "on", "long_pressed_component": "machine", "long_pressed_method": "reset", "suppress": "False # suppress calling release function after double click and long press. Will delay release function by 300ms if double click is used."}}}

Deine Konfiguration ist allerdings fehlerhaft, die Kommentare dürfen im Log nicht mehr erscheinen. Du hast bei "suppress": "false" das letzte " vergessen und boolean sind kleingeschrieben. Das ist bei mindestens einer anderen Komponente auch der Fall.

Die LED Pin2 is onboard. Pin ist sicher die 2, da WifiLed auch darauf liegt. Oder ist das ganz und gar das problem?

Das ist kein Problem, funktioniert beides, könnte halt nur unerwartete Blinkmuster geben.

Wenn die config.hjson in Client/NodeName/config.hjson muss, wozu ist der config ordner unter Client/NodeName/config/ ?

Es gibt die Möglichkeit, die Konfiguration in einzelne Dateien aufzuteilen, also eine Datei pro Modul anzulegen + _order.hsjon. Dies kann dann im Ordner "config" gemacht werden.

dasTholo commented 4 years ago

Wuhuu es geht Vorwärts! Nachdem ich den Smartserver auf den letzten Stand gebracht hab. Hat er sofort die Node (inkl dem DEVICE_NAME) richtig erkannt und die Ordner erstellt. Es Funktioniert!

Jetzt muss ich nur noch diese config Geschichte richtig durchdringen. LedNotification aus Hassio raus funktioniert ebenfalls!

kevinkk525 commented 4 years ago

Das hört sich gut an!

Einfach das Modul öffnen, das du hinzufügen möchstest, z.B. machine.easyGPIO. In den Modulen findet sich immer eine Beispielkonfiguration:

    package: .machine.easyGPIO
    component: GPIO
    constructor_args: {
        # mqtt_topic: null   #optional, topic needs to have /easyGPIO/# at the end; to change a value publish to /easyGPIO/<pin>/set
        discover_pins: [1,2,3] # optional, discover all pins of the list. Otherwise no pins are discovered.
    }
}

Hier einfach die Parameter anpassen, optionale Parameter können auskommentiert sein. Diese Konfiguration dann in die config.hjson kopieren, so wie die Konfiguration von mir, als ein Dictionary mit :. In der config.hjson in der Liste _order den Namen hinzufügen und fertig ist die Konfiguration. Könnte dann so aussehen in der config.hsjon:

{
  _order:
  [
    easy
  ]
  easy:
  {
    package: .machine.easyGPIO
    component: GPIO
    constructor_args: {
        # mqtt_topic: null   #optional, topic needs to have /easyGPIO/# at the end; to change a value publish to /easyGPIO/<pin>/set
        discover_pins: [1,2,3] # optional, discover all pins of the list. Otherwise no pins are discovered.
    }
  }
}
dasTholo commented 4 years ago

Ja das hab ich auch soweit verstanden. Nur noch nicht ganz wann ich ein String mit oder ohne " angegeben sein muss.

Zb bei button released_component: testswitch # ist ohne" released_method: "off" # ist aber mit Das kapier ich nicht ganz. Besonders interessant wird das ja bei suppress.

Dann ist das ebenfalls für mich unklar bei pull mit oder ohne Anführungszeichen?

Und wieso heißt es pullup aber dann pull_down? Laut upy sollte es pull_up sein. Das will ich erstmal noch ausprobieren. Das ist meine ich auch mit "config" verstehen.

kevinkk525 commented 4 years ago

Am besten jeden String mit " " umschließen, dann kann nichts schief gehen. hjson ist ein Format, das viele Möglichkeiten akzeptiert und sogar Kommentare erlaubt, aber gelegentlich klappt es dann doch nicht so, wie man sich es vorstellt und der Kommentar rutscht in den String.. Also am besten immer mit " " angeben und alles ist gut.

Bei Button ist suppress wohl etwas unglücklich in den Kommentaren erklärt. Du kannst hier nur "null" für None (beziehungsweise diese Option gar nicht auskommentieren) angeben, was kein pull down und kein pull up bedeutet, also einfach der standard des microcontrollers. Oder eine Zahl angeben. Diese Zahl musst du selbst rausfinden, z.B. machine.Pin.PULL_UP wird dir eine Zahl ausgeben. Diese wird dann hier angegeben.

Wenn das hjson format mit Kommentaren etc zu kompliziert ist, kannst du die Konfiguration auch als json angeben. Dafür kannst du dann ganz einfach verschiedene Tools verwenden oder die in Python ein dictionary mit der Konfiguration schreiben und dann als json ausgeben lassen.

kevinkk525 commented 4 years ago

Hast du noch Probleme damit?

dasTholo commented 4 years ago

Danke Kevin für die Rückfrage! Ganz ehrlich muss ich sagen Ja. Zwischendurch lief ein Node und ich konnte es über Mqtt sehen (In Home Assistent auch). Dann habe ich Änderungen durchgeführt und dann kamen wieder Fehler und die Node war nicht erreichbar. Ich musste aber feststellen das ich generell Probleme im LAN mit mDNS und Mqtt habe. Zur Zeit laufen meine Nodes mit ESPHome.

Ich konnte das aber auch nicht weiter verfolgen. Da einige Baustellen aufgegangen sind.

Ich hab dein Update gesehen und werde bei Gelegenheit mich wieder dran setzen. Da ich schon an Micropython interessiert bin. Allerdings alles im Hobbybereich!

Ich würde dich gerne einmal via Mail kontaktieren. Vielleicht können wir einmal ein gemeinsames Gespräch aufnehmen?Mich würde deine Beweggründe für den SmartServer und die HomeAssistent Codes interessieren. Da ich "glaube" das könnte man ggf Verbinden. Als Docker Addon für HomeAssistent.

Das sind aber nur meine persönlichen Gedanken zu deinem Projekt. Aber ich bin an einem Austausch interessiert!

Danke für deine Arbeit nochmal Kevin!

kevinkk525 commented 4 years ago

Dann habe ich Änderungen durchgeführt und dann kamen wieder Fehler und die Node war nicht erreichbar. Ich musste aber feststellen das ich generell Probleme im LAN mit mDNS und Mqtt habe. Zur Zeit laufen meine Nodes mit ESPHome

Welche Fehlermeldungen siehst du denn? Was habe ich mir darunter vorzustellen, dass du generell Probleme in deinem LAN mit mqtt hast? Wenn deine esphome nodes laufen, dann sollte es doch kein Problem mit matt geben oder?

Ich würde dich gerne einmal via Mail kontaktieren. Vielleicht können wir einmal ein gemeinsames Gespräch aufnehmen?

Du kannst mich gerne über das micropython forum kontaktieren, habe dort den gleichen Namen. Oder du nutzt die Email Adresse die auf github hinterlegt ist. Ein docker addon klingt etwas "massiv" für eine kleine Erweiterung in ein paar python files. Ist aber sicherlich eine Möglichkeit.. Habe mir bisher nicht angesehen, wie esphome es macht, war aber daran interessiert, es ähnlich zu machen.