How I wanted to convert the lighting in the entrance to two circuits and saved 200 rubles. through the use of a smart home

In many modern homes, entryway lighting often includes two circuits: dim lighting in the evening and bright lighting during the day. But my apartment building is not so modern and in the entrance hall we used ordinary lamps with e27 sockets for lighting. They always burn as brightly as the powerful lamp installed in them, and are turned on by a motion sensor installed in place of a regular switch.

When I started living at this address several years ago, I did some landscaping in the entrance: I hid the cables in a cable channel on my floor, installed a large mirror, and changed all the lamps on the first floor and on my floor from incandescent lamps to brighter LED ones. Due to the design of the motion sensor, the LED lamp did not turn off completely, but remained in dim mode even in the absence of movement.

Photos from the Internet before and after installing a cable channel

Photos from the Internet before and after installing a cable channel

The weak glow of the lamp in the absence of movement led to a huge scandal with another “vigilant” resident (fortunately from another floor) who attracted the manager and was determined to complain to all authorities, because he did not want to pay for the irrational use of communal electricity from his own pocket or a single penny. No amount of logical reasoning on my part worked and eventually the LED bulbs were replaced back to incandescent bulbs.

I wanted to have bright lighting in the entrance on the first floor instead of twilight, and in the end, after several purchases, I was able to find two sensors that completely de-energize any LED lamp:

I had to buy six of these sensors (two first and four second) and give them to a local electrician along with bright LED lamps so that he could replace them. After this, the conflict was settled – the lamps burned brightly and regularly turned off in inactive mode both on the first floor and on my floor.

It took about two months: from the first screwing in of the LED lamp to their return. But this did not solve the problem of two lighting circuits: dim in the evening and bright during the day.

Two lighting circuits: dim in the evening and bright during the day

In October 2024, I wanted to organize two lighting circuits only on my floor, without the first floor. But there were some problems here too: initially I wanted to install separate lamps for dim evening lighting, but we have only three apartments on the floor and the vestibule is completely tiled. If you install additional lamps, you need to:

  1. Develop a new lighting project, outline the places where the lamps will be installed.

  2. Dismantle the tiles and ceiling that the residents once installed.

  3. Ditch the walls for new wiring.

  4. Make new wiring.

  5. Lay new tiles.

  6. Making a ceiling.

According to my estimates, this turns out to be 200 thousand rubles. included in the title. In addition, it is dirty and quite noisy (especially dismantling), and you also have to choose colors and sizes of new tiles.

Photo from the Internet - vestibule for several apartments

Photo from the Internet – vestibule for several apartments

Besides, it’s not a fact that the remaining apartments also want to move the tiles and spend more than 50 thousand just to look at the new walls for 5 seconds while they walk from the elevator to the apartment door…

Technical solutions for two lighting circuits for the entrance – dim in the evening and bright during the day

Then I began to think about how to use different lamps for two lighting circuits for the entrance – dim in the evening and bright during the day, but I couldn’t come up with anything special. I thought about replacing the lamps with others, but then I would also have to redo at least the ceiling.

The fittings of the lamp in the entrance are very similar to this

The fittings of the lamp in the entrance are very similar to this

As a result, I began to look at how it was possible to use an ordinary lamp to shine dimly after sunset and brightly after sunrise.

The fittings of the lamp in the vestibule are very similar to this one

The fittings of the lamp in the vestibule are very similar to this one

ESP8266 with built-in Wi-Fi module

I thought that I could use this microcontroller to implement the logic directly on it: after sunset the light is dim, and after sunrise until sunset it is bright. No centralized controller is needed. All that remains is to choose the right lamp. And write firmware with these rules.

ESP8266 is a series of low-cost microcontrollers with built-in Wi-Fi module developed by Espressif Systems. These devices are widely used to create IoT (Internet of Things) applications, including smart home projects. The main feature of the ESP8266 is that it allows you to connect various sensors, actuators and other electronic components to the Internet via Wi-Fi, allowing remote control and monitoring of devices.

Previously, I came across lamps with ESP8266, for example Sonoff B1it was possible to access the contacts of this lamp, clear the memory and download Open source firmware for ESP devices Tasmota or use another firmware ESPHome for easy integration with Home Assistant.

serial pins (3V3, RX, TX, GND)

serial pins (3V3, RX, TX, GND)

The problem was that the B1 model was not for sale on the SONOFF website, but only the new model B02-BL/B05-BLbut this new model was not on the Tasmota compatible list. That's why I didn't buy it even for testing.

Many lamps that were on the templates.blakadder.com compatibility list were not on sale – the link led to nowhere.

The only working model on the ESP8266 was a lamp from Tuya, but to make it work with Tasmota or ESPHome serious re-soldering was required – which I didn’t want to waste time on.

Zigbee

I was initially skeptical about using Zigbee. Although I have deployed Zigbee2MQTT on Home Assistant, I did not want the entrance lamp to depend on my home automation. In addition, the logic of dim and bright light will have to be implemented on the server, and then sent to the lamp, which will also be either online or offline – after all, the motion sensor breaks the phase that powers the lamps.

Zigbee and Wi-Fi are two different wireless communication protocols, each with their own features, advantages, and disadvantages.

I have already I've been using Home Assistant for yearsand before that I used openHAB.

First I started looking for compatible lamps in the database zigbee.blakadder.comon November 5 it contained 2,669 devices, but all the links that I found on aliexpress cost more than a thousand rubles – about 1.2 thousand rubles. and higher, and I was thinking of paying up to a thousand for the lamp. Still, lamps for the entrance.

I started looking at ozone. The cheapest Zigbee lamps did not have very good reviews. I decided to buy one lamp for the test, a little more expensive – for about 700 rubles – it’s still three times cheaper than a lamp Aqara Light Bulb T1a couple of which I use in sconces, but they were not suitable for the entrance – firstly, they were expensive, and secondly, they had functionality that I did not need in the entrance.

Not the cheapest "KOJIMA" or Tuya TS0505B_1

Not the cheapest “KOJIMA” or Tuya TS0505B_1

When Умная светодиодная лампочка Е27 RGB Zigbee, Яндекс Алисой, Google Home, Марусей, Smart Bulb 10W KOJIMA arrived, I immediately connected it to Zigbee2MQTT and discovered that it was Tuya TS0505B_1. In addition, I realized the list of compatible devices is much wider in reality zigbee2mqtt.io – 3,900 devices are declared there. The KOJIMA lamp (Tuya TS0505B_1) has the following properties:

{
    "brightness": 254,
    "color": {
        "h": 200,
        "hue": 200,
        "s": 6,
        "saturation": 6,
        "x": 0,
        "y": 0
    },
    "color_mode": "color_temp",
    "color_power_on_behavior": "previous",
    "color_temp": 153,
    "do_not_disturb": false,
    "linkquality": 98,
    "state": "ON"
}

This JSON data contains key properties describing the current state and configuration of the Zigbee connected lamp in the Zigbee2MQTT and Home Assistant setup.
Here is a description of each property:

1.brightness

  • Meaning: 254

  • Description: This property represents the brightness level of the lamp, scalable from 0 (off) to 254 (maximum brightness). In this case, the lamp is at maximum brightness.

2.color

This object contains various attributes that define the color of the lamp in several formats. However, only certain formats will be applied based on color_mode.

  • hue (h): 200

  • Description: This value defines the hue of the color in the HS (Hue-Saturation) color model, where 0-360 represents degrees on the color wheel (for example, red at 0, green at 120, and blue at 240). Here 200 corresponds to a blue tint.

  • saturation (s): 6

  • Description: Saturation varies from 0 (no color, shades of gray) to 100 (full color intensity). If saturation installed on 6the color appears almost desaturated, close to white or gray.

  • x And y: 0

  • Description: values x And y define a color in the XY color model, commonly used by ZigBee lamps to represent colors in the CIE 1931 color space. Here both are set to 0which is unusual since typical white values ​​are around [0,3127, 0,329]. This could mean that xy_color either not used or set by default due to the active color mode.

3.color_mode

  • Meaning: "color_temp"

  • Description: This value determines which color model the lamp is currently using. In this case color_temp indicates that the lamp is controlled by its color temperature rather than its color model (for example, xy or hs). This means that the value color_temp has priority, and settings in other color formats (hs or xy) will not apply.

4. color_power_on_behavior

  • Meaning: "previous"

  • Description: This property determines how the lamp behaves after being turned on. "previous" means it will return to its last known state before shutting down. Other potential settings can determine whether it starts in a default state or is disabled, providing flexibility in behavior when power is restored.

5. color_temp

  • Meaning: 153

  • Description: Color temperature is measured in mireds (the inverse of color temperature in Kelvin) and typically ranges from 153 (cool white, about 6500K) to 500 (warm white, about 2000K). Here 153 represents a very cool, daytime-like white color.

6. do_not_disturb

  • Meaning: false

  • Description: This setting can be configured to prevent certain actions (such as blinking or turning off) based on the lamp's interaction with other devices. If set to trueit limits notifications or actions that could interfere with the user's experience. The value is set here falsewhich allows you to work as usual.

7. link quality

  • Meaning: 98

  • Description: Link quality is a metric that indicates the signal strength or quality of the connection between the lamp and the ZigBee coordinator or router. The value is usually in the range of 0 to 255with higher numbers indicating a better signal. Communication quality 98 indicates a moderately strong connection, but not at the high end of the range.

8. state

Home Assistant Settings

Home Assistant is a solution for a local smart home. Within this platform, it is easy to combine completely different protocols and manufacturers and manage the entire fleet of devices according to the same rules.

Initially, since the lamps would be completely de-energized and appear online, I wanted to use the accessibility parameter availability in Zigbee2MQTT and each time they appear on the network, set the lighting parameters I need. Set the parameters, acted according to the instructions and… nothing happened:

This saddened me a little, but then I decided to force the lighting parameters to be set every 59 seconds:

In text form, automation looks like this:

alias: Тамбур лампы
description: ""
triggers:
  - trigger: mqtt
    topic: zigbee2mqtt/Тамбур лампа (ближе к ХХХХ)/availability
    payload: true
    enabled: false
  - trigger: time_pattern
    seconds: "59"
conditions: []
actions:
  - if:
      - condition: sun
        before: sunset
        after: sunrise
    then:
      - action: light.turn_on
        metadata: {}
        data:
          brightness: 255
          color_temp: 153
        target:
          device_id:
            - 3593e2beeXXXXXX82ddda6e461a23105
            - c5c0efa006XXXXX75b73a28b16057f85
            - 46e690f49bXXXXXXXb77477270ab9587
            - 45235336bXXXXXXXX51a2d9207498c0e
    else:
      - action: light.turn_on
        metadata: {}
        data:
          brightness: 30
          color_temp: 500
        target:
          device_id:
            - 3593e2beeXXXXXX82ddda6e461a23105
            - c5c0efa006XXXXX75b73a28b16057f85
            - 46e690f49bXXXXXXXb77477270ab9587
            - 45235336bXXXXXXXX51a2d9207498c0e
mode: single

In order not to fill the history and event log with unnecessary information, I completely excluded these lamps and automation from the record:

In text form:

####################################################
#                                                  #
#           Не захламлять историю                  #
#                                                  #
####################################################

recorder:
  exclude:
    entity_globs:
      - light.tambur_lampa_*
      - switch.tambur_lampa_*

logbook:
  exclude:
    entity_globs:
      - light.tambur_lampa_*
      - switch.tambur_lampa_*
    entities:
      - automation.nspanel_configuration
      - automation.tambur_lampy
      - sensor.date_time_iso
      - sensor.date_and_time

Results

As a result, I achieved my goal – now the entrance lighting on the floor includes two circuits: dim lighting in the evening and bright lighting during the day. And for this there was no need to change the wiring.

It’s a pity that we couldn’t find lamps for ESP8266 – it seems to me that such a solution would be more autonomous than Zigbee lamps. But Zigbee lamps cost about 700 rubles apiece.

Author: Mikhail Shardin

November 7, 2024

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *