Skip to content

Configuration ESP

Yurik72 edited this page Mar 11, 2019 · 32 revisions

ESP configuration

After sketch is running you can/add edit following files to/in the SPIFF root

  1. config.json keeps information host name and mqtt connection.

    `{

         "localhost":"HomeCtl",
    
          "mqtt_host":"mqtt",
    
          "mqtt_port":"1883",
    
          "mqtt_user":"usr",
    
          "mqtt_pass":"pwd"
    
      }`
    

seems names are clear and nothing to explain

  1. services.json keeps inforamtion about services runned on the ESP That is json array which contains list object, each service has general properties

service: name of the service( C++ class name). At this moment availbale:

RelayController :controlling Relay state

RGBStripController :controlling RGB strip (WS2811/2812 )

LDRController :controlling measuring of LDR or any

TimeController :controlling measuring of time, can be used for automation together with triggers

RelayDimController :controlling dimmamble led via PWM, the same as relay controller but additionally you can setup a brightness, as well dependency from LDR, if attached

RFController : controlling RF433 hardware to sent/receive RF 433 signal

name: Name of the service, will be used for home automation and Web methods. This is important to distinguish physical devices with the same type. For instance if you wired two Relays to ESP, both of them will have service=RelayController , but you can provide different names like Realy1 and Relay2 to control them separatelly. ! Name must be unique in all scope of the service

enabled: true or false, giving a false you can temporary disable a service

interval: number of millisec on the loop. For instance to measure LDR value is not required every ESP loop. 1 sec is more than enought and this brings better total perfomance

other element is depends on service type;

Ok, step by step service configuration.

  • using only relay controller:

    [{"service":"RelayController","name":"Relay","enabled":true,"interval":100,"pin":5}]

where _**pin **_is GPIO number wired to Relay

  • using only RGB strip controller:

    [{"service":"RGBStripController","name":"RGBStrip","enabled":true,"interval":1,"pin":23,"numleds":8}]

where
pin is GPIO number wired to RGB control pin numleds number of physical leds on RGB

  • using only Time controller:

        [{"service":"TimeController","name":"Time","enabled":true,
    
        "interval":1000,"timeoffs":7200,"dayloffs":3600,"server":"pool.ntp.org"}]
    

where timeoffs offset in sec for your time zone dayloffs day light offset for your time zone server ntp server used

  • using only LDR controller:

[{"service":"LDRController","name":"LDR","enabled":true,"interval":1000,"pin":0}]

where pin is GPIO number wired to LDR (must be supported for digital read) for instance A0

  • using only RelayDimController

    '[{"service":"RelayDimController","name":"RelayDim","enabled":true,"interval":50,"pin":22}]'

  • using only RFController

    '[{"service":"RFController","name":"RF","enabled":true,"interval":2,"pin":2,"pinsend":13}]'

    where
     _**pin**_          is GPIO number wired to RF receiver
     _**pinsend**_      is GPIO number wired to RF sender
    

And make that all together (not all services, but you can add any from example) :

[

     {"service":"RelayController","name":"Relay","enabled":true,"interval":100,"pin":5},

     {"service":"TimeController","name":"Time","enabled":true,

     "interval":1000,"timeoffs":7200,"dayloffs":3600,"server":"pool.ntp.org"},

     {"service":"RGBStripController","name":"RGBStrip","enabled":true,"interval":1,"pin":23,"numleds":8}, 

     {"service":"LDRController","name":"LDR","enabled":true,"interval":1000,"pin":0}

]

Clone this wiki locally