2020-06-09 16:56:50 +02:00
2020-06-07 12:41:34 +02:00
2020-06-09 13:35:30 +02:00
2020-06-09 16:56:50 +02:00
2020-06-09 13:35:30 +02:00
2020-06-08 20:48:19 +02:00
2020-06-09 16:56:50 +02:00

Bedside table

An esp8266 powered IKEA Tvärfot with a Neopixel ring and a proximity sensor.

Writing a configuration

Open a Serial Monitor at baudrate 9600 and paste the following json configuration adapted to your needs. Before sending press the on board button "flash" or connect a button to D0. You will now have 10s to send the configuration. The onboard LED will light up as long as the board reads Serial input. If successful the new configuration should be shown in the terminal.

It is also possible to send the same json configuration on mqtt using topic light/bedlamp/relay/0/config. This of course demands that the ESP is connected to your wifi, logged in and registered on the mqtt service so this cannot be used for initial configuration.

{
   "hostname": "your_hostname",
   "ssid": "your_ssid",
   "wifipass": "[48...",
   "mqttserver": "mqtt.mydomain.com",
   "mqttuser": "mymqtt_user",
   "mqttpass": "7j%!fs#",
   "mqttport": "1883",
}

OTA Updates

Configured in vscode, inside of platformio.ini change the board name to what you've set in the configuration. Then upload sketch updates via WiFi by clicking the Upload button in platformIO under the evn:esp8266 OTA configuration

MQTT

State and Command topics

An identical json package is both sent and received to set and get the status of the light. The command topic is light/bedlamp/relay/0/set and the state topic is light/bedlamp/relay/0.

{
  "brightness": 255,
  "color": {
    "r": 255,
    "g": 180,
    "b": 200
  },
  "state": "ON"
}

Configuration topic

See Writing a configuration. This can also be done using mqtt at topic light/bedlamp/relay/0/config

Home Assistant

Adjust the name and topics to suite your configuration

  - name: Bedside Lamp
    platform: mqtt
    schema: json
    state_topic: light/bedlamp/relay/0
    command_topic: light/bedlamp/relay/0/set
    brightness: true
    rgb: true
Description
No description provided
Readme 4.4 MiB
2020-07-15 18:02:12 +00:00
Languages
C++ 100%