Code Monkey home page Code Monkey logo

esp32-r4sgate-for-redmond's Introduction

ESP32 Ready4Sky (R4S) gateway for Redmond+ devices

ENG | RUS

A script based on a PHP server on a local network with Internet access to display the weather on the gateway screen..
In versions starting from 2022.06.03, the device topics in gateway number 0 have been changed from “r4s/#” to “r4s0/#”. In new versions, topics in "r4s/#" are used to track tags by multiple gateways. When upgrading from older versions, you need to enable BLE Monitor in the settings (the gateway deletes the contents of "r4s/#" only when the monitor is turned on), selecting Passive, Active or Auto, check the Hass Discovery and Delete Mqtt Topics items and save the settings. After the reboot, the gateway will delete unnecessary topics and create them again. Then, if necessary, BLE Monitor can be disabled. Then fix the devices in automations, scripts, etc.

Current version is 2024.03.29 for ESP32 and ESP32C3 and ESP32S3.

  • 2024.03.29. The project was built using esp-idf version 5.2.1. Added LYWSD02MMC and HHCCJCY01 support to BLE monitor. All parameters names and id for known devices in BLE monitor are the same for all gateways and are filled in only by the master gateway. After the update, I recommend selecting Delete Mqtt topics in the settings and clicking Ok.
  • 2024.02.26. Some corrections in HA water heater entity and device class of sensors.
  • 2024.02.23. Currency symbols ₤, €, ₽, ₴ have been added. Home Assistant water heater entity for kettle has been added.
  • 2024.02.19. Wi-Fi modes in settings have been fixed.
  • 2024.02.18. The project was built using esp-idf version 5.2, esp32s3 support added. In the passive scanning mode of the ble monitor, information for known devices has been added. Minor fixes.
  • 2024.02.10. The project was built using esp-idf version 5.2-rc1. Minor fixes.
  • 2024.02.05. At startup, the gateway scans all WIFI APs with the required parameters and selects the AP with the best level. Relevant for mesh systems.
  • 2024.02.04. Added selection of WIFI 802.11b/g/n mode in settings.
  • 2024.02.02. Corrections by Delonghi. In Auto mode, the image buffer size is selected separately for each URL.
  • 2024.01.30. Added the ability to automatically increase the buffer size for loading images within 10-65 kilobytes (Adjust option). The gateway operates more stable at wifi levels below -73dBm.
  • 2024.01.25. Corrected Delonghi statistics and availability of BLE devices/tags in Home Assistant. Currently Delonghi in HA: PROJECT_PHOTO
  • 2024.01.22. Added mute option as an alternative to beep. The availability of devices in Home Assistant has been fixed. If the gateway is unavailable, all devices connected to it become unavailable. If devices disappear from the BLE monitor, the data from them becomes inaccessible. Added statistics to Delonghi coffee machines.
  • 2024.01.14. The project was built using esp-idf version 5.2-beta2. Added Russian program names to the multicooker menu. Added support for the Redmond SkyHeat RCH-4560S heater. Added support for LYWSDCGQ thermometers to BLE Gateway Monitor. You can display up to 4 images in turn on the gateway screen using 4 urls.

1. Opportunities

  The ESP32 r4sGate gateway in a minimal configuration (only ESP32 or ESP32C3 with a 3.3v power supply) allows you to connect BLE-compatible Redmond devices, Xiaomi MiKettle kettles and some other devices to the smart home system (Home Assistant, OpenHab, ioBroker, MajorDoMo, etc. ) via MQTT protocol. Initially, the project was only for Redmond, now other devices are being added. Hence the plus in the name of the project.

Why MQTT...
  • This is in fact a standard protocol for smart home systems. Another thing is how it is implemented. From the built-in MQTT server in the ioBroker system, where everything that happens in MQTT is immediately displayed in the admin interface, to the external broker in Home Assistant, where sometimes you have to use third-party utilities to configure it. In the latter, however, MQTT Discovery greatly simplifies the integration of devices into the system.
  • In MQTT, devices can exchange data with each other, and not just with the smart home server. The gateway can be configured to display the readings of the main sensors in the house on the screen. In response to the argument that some devices can uncontrollably rewrite the data of others, I note that normal brokers have a shared access system (ACL). Although I don’t have an answer to the question, why even introduce devices into the system that are not trusted.
  • In MQTT, devices can exchange information without knowing anything about each other except the topic where they should meet. This is used to determine the maximum signal strength from a tag/beacon among multiple gateways, and the gateway receiving the strongest signal.
  • MQTT support is included in the esp-idf development environment and does not require third-party libraries. After unsuccessful attempts to finalize a very good olehs project on arduino, I became a supporter of pure esp-idf.

List of supported devices:

Electric kettles:

  • Redmond SkyKettle RK-M170S
  • Redmond SkyKettle RK-M173S / RK-M171S / RTP-M810S
  • Redmond SkyKettle RK-G200S / RK-G204S / RK-G210S / RK-G211S / RK-G212S / RK-G214S / RK-M216S / RK-M139S
  • Redmond SkyKettle RK-G240S / RK-G204S / RK-G210S / RK-G211S / RK-G212S / RK-G214S / RK-M216S / RK-M139S
  • Xiaomi MiKettle YM-K1501(Int) - ProductId 275
  • Xiaomi MiKettle YM-K1501(HK) - ProductId 131
  • Xiaomi MiKettle V-SK152(Int) - ProductId 1116
Read more about Xiaomi MiKettle...  Xiaomi MiKettle can only be controlled from the **keep warm** mode. In this mode, the kettle maintains a minimum temperature of 40°C set by the gateway with a hysteresis of approximately 4°C, that is, at 36°C the heating is turned on, and at 44°C it is turned off. You can turn boiling on and off (state = ON/OFF), set the heating temperature (heat_temp = 40...95). You can switch the kettle to Idle mode (heat_temp = 0). The last command is executed with a delay. After executing the command, further control of the kettle is unavailable. In contrast to turning it off with the **warm** sensor on the kettle, when you turn it off and on again, the kettle returns to the **keep warm** mode. Perhaps this is a feature of a specific version of MCU 6.2.1.9. For now I left it like that and turned on the kettle through the Redmond outlet. If you turn it off and on again, the kettle goes into heating mode. The gateway installs all the necessary parameters of the kettle itself, and the native application is useful for updating the firmware. The heating time is set to 12 hours (720 minutes), after 256 minutes the gateway resets the counter by briefly turning the boiling on and off. And still control is limited. The main problem is that when you turn on boiling with the **boil** sensor on the kettle, the **keep warm** mode is turned off and you can return it only with the **warm** button on the kettle. For the same reason, I postponed work on Mikettle Pro for now.

Multicookers

  • Redmond SkyCooker RMC-M224S
  • Redmond SkyCooker RMC-M800S
  • Redmond SkyCooker RMC-M903S
  • Redmond SkyCooker RMC-M92S
  • Redmond SkyCooker RMC-M961S

Coffee makers

  • Redmond SkyCoffee RCM-M1519S

Coffee machines

  • Delonghi ECAM650.75 (Possibly other models 😉 Primadonna Elite series. When preparing beverages, information from the user’s profile is used. The gateway can also turn off the coffee machine.)

Sockets

  • Redmond SkyPort RSP-103S / RSP-100S

Electric convectors

  • Redmond SkyHeat RCH-7001S / RCH-7002S / RCH-7003S
  • Redmond SkyHeat RCH-4560S

Climate stations

  • Redmond SkyClimate RSC-51S

Humidifiers

  • Redmond SkyDew RHF-3310S

Sensors

  • Redmond SkySmoke RSS-61S - smoke sensor
  • Redmond SkyOpen RSO-31 - door open sensor
  • Hilink HLK-LD2410B - motion and presence sensor

Irrigation controllers

  • Galcon GL9001A / Green Apple GATB010-03

Curtain/blind drivers

  • AM43 blinds A-OK and similar)

 The gateway supports 5 simultaneous BLE connections. Device management is also possible from the gateway web interface. The web interface is simply protected with a password from Raerten. To do this, the string in the form login:password must be encrypted in Base 64 and then entered into the Basic Auth field in the settings. The password string is output to the log when the gateway starts.
 Home Assistant Mqtt Discovery is supported. To enable it, you need to check Hass Discovery in the settings. It is possible to delete all data created by the gateway in Mqtt and devices in Home Assistant. To do this, select the Delete Mqtt topics option in the Setting tab and then click Save setting . After rebooting the gateway, only devices connected to the gateway will be recreated. Recommended when connecting the gateway for the first time and reconfiguring by removing devices.

A simple option for integrating a kettle from Home Assistant into a Yandex smart home is to use the climate entity.

  And call it the word kettle. All commands of the thermostat device will be available. For example, the command turn on the kettle (auto mode, turning on boiling or boiling followed by heating, if heating was turned on before), turn off the kettle (turns everything off), set the kettle temperature to 40° (if not 0° and not 100° turns on heating, mode heat, if 0° - turns it off, if the temperature is 100°, boiling is turned on, auto mode) or turn on the heating (turns on heating at the last set temperature). And finally, the command turn on cooling - turns on the backlight, cool mode. Not very pretty, but that's how it is. You can ask what’s wrong with the kettle - the kettle’s thermostat is turned off and what the temperature of the kettle is - it will tell the current temperature.

It supports calculating the amount of water in the kettle when heating in the range of 65-85°C and more than 3°C from the moment the kettle is turned on.

 No modifications to the kettle are required. Calculated based on the energy expended and the temperature difference. The calculated value is reset when the kettle is removed from the stand. The option only works in dummies with statistics. The efficiency of the kettle was initially assumed to be 80%. The accuracy is so-so, I get about ~0.2 liters. To improve accuracy, a mode for adjusting the efficiency value is provided. To do this, you need to pour 1 liter of water into the kettle and select Boil 1l on in the web interface . When the mode works, you need to enter the settings mode. The new value will be displayed immediately after the device type. You can write a new value to nvram using the Save setting command. It seems to me that it is unrealistic to obtain greater accuracy, since the efficiency of the kettle changes over time, for example, with the appearance of scale, and, what’s worse, the energy expended is not measured, but is simply calculated by the kettle’s processor based on the rated power of the heater and its operating time. The deviation of the supply voltage during operation from the value during calibration introduces a noticeable error; the dependence there is quadratic. When I boil 1.7 liters of water with a RK-M216S kettle at a voltage at the entrance to the house of 200-204V, the result is 1.8 liters, at a voltage of 210-214V it comes out to 1.6 liters. During calibration there was obviously something in between.

 The BLE Gateway Monitor can be used to monitor up to 24 BLE beacon devices with a static MAC address. The presence/absence of a tag (beacon) and rssi is displayed. Supported are BLE beacons of the Home Assistant application on smartphones (binding by uuid), LYWSD02 watch with thermometer, LYWSD03MMC Xiaomi Mijia 2 thermometers with original firmware, firmware from atc1441in [custom mode}(https://github.com/atc1441/ATC_MiThermometer) and firmware from pvvx in custom mode, Xiaomi Mi Scale, Qingping Air Monitor Lite (CGDN1), Elehant counters, as well as Samsung Smart Tag.
 There are 10 I/O ports, 5 of them can be used to control external devices (Out mode) and read their status (In mode). Three ports can be configured as buttons for turning on/off connected BLE devices (Sw mode, in which case the state of the buttons in mqtt is not displayed), the fourth port can be configured as a button for updating the image from the camera. When configured in input mode, pullup is enabled if possible (pin number less than 34). Another 2 ports are used by the I2C bus, and each of the 3 remaining ports can be used as a pulse width modulated (PWM) output, or as an input for connecting either one DS18B20 sensor with direct power supply, or one DHT22/AM2302 sensor (7 and port 8). Reading procedures are simplified, the checksum is not read or verified, and data is rounded to one decimal place. If the gateway is equipped with an audio emitter, then by connecting the PWM output to it (in m5stack basic this is gpio 25), you can output an audio signal. By changing the duty cycle of the pulses, you can adjust the volume. The frequency is fixed and equal to 3.136 kHz. The I2C bus supports sensors SHT3x/SHT4X(addresses 0x44, 0x45), AHT20(0x38), HTU21(0x40), BMP280/BME280/680/688(0x76, 0x77, 688 not yet tested), SGP30(0x58), SGP4x(0x59 ), SCD4x(0x62), as well as RTC DS3231(0x68) and battery controller IP5306(0x75). It is possible to save the SGP30 calibration data in NVRAM and restore it when the gateway starts. To do this, check the AQ base item in the settings. The Sensirion library is used to calculate VOC in SGP4x. The clock is used to store the date and time from the NTP server, the temperature sensor is output to Mqtt. The IP5306 controller is installed in m5stack and ttgo-t4 (SCL 22, SDA 21), allows you to determine the battery level in 25% increments and its mode (Discarging / Charging / Charged). When on battery power, the screen brightness decreases by 16 times. The gateway also supports the AXP192 power controller and PCF8563 RTC, allowing it to run on the M5Stack Tough, and also supports the ADC of the HX711 load cells. The measurement result from the HX711 can be displayed either in kilograms or as a percentage, depending on the calibration. HX711 is polled at intervals of 4 seconds, other sensors at intervals of 12 seconds. The gateway allows hot plugging of all sensors. Sensors 18B20 and DHT22 appear in Mqtt and Home Assistant immediately after the gateway starts, even if they are not connected, and I2C sensors as they are detected on the bus within 2 polling cycles (24 seconds).

There is also support for IR transmitter (IR Tx, port 6).

 Supported protocols are NEC (8 and 16 bit address) RC5 (to work in RC5ext mode you need to invert 6 bits of the command), RC6 , Samsung , Sony SIRC (12, 15 and 20 bits), Panasonic. You can control it both from the Home Assistant interface and individual topics of address, command and protocol, or by directly writing to the r4sx/ir6code topic (where x is the gateway number) a string of 8 hex characters 0-9,af, for example, 090a1c3d , where 09 is protocol(01-nec, 02-necx16, 03-rc5, 04-rc6, 05-samsung, 06-sircx12, 07-sircx15, 08-sircx20, 09-panasonic), 0a1c - address , 3d command. What was tested (the power-on command was of interest):
NEC: pioneer vsx-830, power: addr 165, cmd 28, code 0100a51c
NECx16: lg dvd dks-2000h, power: addr 11565, cmd 48, code 022d2d30
RC6: philips 40pfs6609, power: addr 0, cmd 12, code 0400000c
SAMSUNG: ue32n5300, power: addr 7, cmd 2, code 05000702
SIRCx12: sony cmt-sx7, power: addr:16, cmd: 21, code 06001015
SIRCx20: sony ubp-x800 power: addr 7258, cmd 21, code 081c5a15
PANASONIC: sa-pm20 power: addr 2588, cmd 61, code 090a1c3d
PANASONIC: dmp-ub900 power: addr 2816, cmd 61, code 090b003d

I checked everything on the Atom lite, it has IR LED on 12 gpio. RC5 and SIRCx15 have not yet been tested.

 In order to expand the capabilities of the gateway, it is possible to connect a 320 * 240 TFT screen on ili9341, ili9342 and ST7789 chips. The screen displays the current time, date, as well as temperature, voltage and current in the house (not a problem when powered by a generator), status (blue - off, red - on) and temperature at the boiler outlet, temperature and humidity outside. Everything comes from Mqtt. Next to the date, the status of BLE devices is displayed in color, 1 ... 5 - from the first to the fifth. Gray - not connected or not defined, blue - off, red - on, yellow - heating, white - program installed. More detailed status and some parameters of connected BLE devices are displayed in turn in the bottom line. It is possible to periodically or on request display a picture on the screen in jpeg format, for example, from a camera. Pictures with a horizontal resolution higher than 320 are displayed at a scale of 1:2. The buffer size for loading images can be changed within 20-65 kilobytes. Screen brightness can be changed by Mqtt. You can also display the weather in text form from the site wttr.in or just text by writing it in the Mqtt topic r4sx/jpg_url. The result was something similar to a clock with a thermometer. It is enough to look at the screen to make sure that everything is in order in the house or on the street today.

2. Accessories

PROJECT_PHOTO Picture 1. Components for assembling the gateway.

  If the goal is to launch the gateway at minimal cost, you will have to buy spare parts and then assemble the gateway from them. I used an ESP32 WROOM ESP-32 4 MB with a built-in antenna (bottom left) or an ESP32 WROOM ESP-32U 4 MB with an external one (to the right of the first) . Issue price $2.5. Then I soldered the microcircuit onto an adapter board ($0.3) and then onto a breadboard. ESP32C3 is also suitable, I have ESP32C3-12F. Due to hardware limitations of this chip, the gateway uses port 8 only as a pulse width modulation (PWM) output. There is approximately 28 kilobytes more free RAM. And even with the screen connected, the ESP32C3-12F still has 6 free gpio. Power supply for 3.3 Hi-Link ($2-$4). I bought them for $1.65. You can avoid soldering if you use esp32-wroom-devkit (bottom center, $14). True, this board is very redundant for the project; you can get a simpler one for $3.54. In it, esp32 comes along with a board on which there are also converters from 5V to 3.3V, USB-RS232 and a standard mini-USB connector. Through it you can power the esp32 using a five-volt charger from a smartphone, and program it directly from the computer without any adapters. And on the right in the photo is a 3.2" 320 * 240 TFT screen ($18) , which I used in the gateway. You can also use compatible ready-made devices both with a screen ( TTGO T-Watcher BTC Ticker , M5Stack BASIC , M5Stack Tough ) and without ( m5atom lite).

3. Gateway setup

 To run the gateway you need to program the ESP32. You can use the flash_download_tools program. The file fr4sGate.bin in the build folder is an already assembled binary for esp32 @160MHz with 4 MB memory, DIO bootloader and is flashed with one file from address 0x0000 in DIO mode . If the DIO bootloader does not start, you can use the fqr4sGate.bin file with the QIO bootloader and program it in QIO mode. As I understand it, most esp32 can be programmed in any mode, but there were cases that the gate only worked when it was flashed with the fqr4sGate.bin file in QIO mode . The r4sGate.bin file is used to update the firmware via the web interface. ESP32C3 programming files in folder C3.
 Then you need to create an access point on your smartphone with ssid r4s and password 12345678 , wait until the esp32 connects to it, find the connected r4s0Gate device and its IP in the access point parameters, enter this address in the web browser and then set it in the web in the Setting tab other parameters. After which the access point is no longer needed. Esp32 will only attempt to connect to the r4s network if the main network is unavailable, for example if the password is incorrect. If it cannot connect to the guest network, the esp32 reboots. The option with a guest network, in contrast to the generally accepted practice of launching an access point on esp32, is, in my opinion, more convenient, since if for some reason the Wi-Fi router fails (and it can be dedicated only for iot devices), the rest of the Wi-Fi does not get clogged by floating esp32.
 Next, you need to enter the name or MAC address of the Redmond device and bind it to the gateway. The search for devices starts only when there is at least one identified but not connected device, or the BLE monitor is active. If the name of the device is not known exactly (and Redmonds do not always light up via BLE as a one-to-one model), then to start scanning you need to enter any name in the Name field in the settings, and then replace it with the one found during scanning and select the closest device type in the settings (field TYPE , for example, for teapots from RK-G(M)200S to RK-G(M)240S the protocol is the same, you can select both RK-G200S and RK-G240S). It should be taken into account that not all devices transmit the name during passive scanning (for example, Xiaomi Mikettle, AM43 Blinds). In any case, it is better to enter the MAC address in the name field, either with or without colons. You can find and copy the address BLE Last found name/address on the main page or on the BLE monitor page. Next, to bind, you need to press and hold the button + or *power on a kettle or a timer on a multicooker until the device enters the binding mode and after a while connects to the gateway. AM43 blinds also require entering a PIN code (Passkey) for connection.
 It is possible to connect several gateways to one MQTT server. To do this, you need to install your own r4sGate Number in each gateway. Gateway number 0 will write to topic r4s0/devaddr/..., gateway number 1 - r4s1/devaddr/..., etc. You just need to take into account that the authorization request when binding depends on the gateway number and the connection number in the gateway. This allows you to link 2 identical kettles or multicookers to 2 different gateways or to 2 different connections within the same gateway. If there are two gateways with the same parameters working nearby, connected to different smart home systems (for example, a neighbor behind the wall), to exclude the possibility of connecting a device to the neighbor’s gateway, you can use the option to authorize devices using the gateway’s MAC address by selecting Use MAC in BLE Authentication in the settings. Then reset all bindings on the devices and then bind them to the gateway again.
 To connect to the Mqtt broker, you need to enter its address and port, as well as login and password. If the gateway works with Home Assistant paired with a mosquitto broker, you should use the Hass Discovery option. Before using it, I recommend deleting all topics with r4s in the Mqtt broker, for which select Delete Mqtt topics in the settings.

Web interface

Devices can also be managed in the gateway web interface. Examples of the main page and settings page are below in pictures 6 and 7.

PROJECT_PHOTO Picture 6. Home page.

PROJECT_PHOTO Picture 7. Settings page.

4. BLE Monitor

 The monitor allows you to track tags (beacons) with static MAC addresses. The presence/absence of a tag and rssi is displayed.
Additionally supported:

  • BLE beacons of the Home Assistant application on smartphones (binding by uuid, timeout for me is 60 seconds)
  • Xiaomi LYWSD03MMC thermometers with original firmware, firmware from atc1441 in custom mode and firmware from pvvx in custom and Mija mode. Keys for LYWSD03MMC original version can be obtained from the Xiaomi cloud. (400 seconds)
  • Xiaomi Thermometers LYWSDCGQ (400 seconds)
  • Xiaomi LYWSD02 thermometer watch (400 seconds)
  • Xiaomi LYWSD02MMC thermometer watch (400 seconds). Keys for LYWSD02MMC can be obtained from the Xiaomi cloud.
  • Xiaomi Mi Scale (400 seconds)
  • HHCCJCY01 Mi flora sensor (400 seconds)
  • Qingping Air Monitor Lite(CGDN1) (400 seconds)
  • Elehant water and gas meters (400 seconds)
  • Samsung Smart Tag (120 seconds).

 To activate the monitor, in the Setting tab , set the BLE Monitoring option to Active or Passive for active or passive scanning and click Save setting. An active scanner provides more information, but uses more power on the devices being scanned. Passive mode is recommended for tag scanning. It should be taken into account that in Auto mode , when searching for devices before connecting, the scanner always works in active mode, and then switches to passive mode.
 After installing the option, the BLE Monitor tab will appear in the menu , by opening which you can see the found devices. The Gap field displays the time interval between the last two received packets, and the Last field displays the time since the last packet arrived. The default timeout (if the Timeout field is empty) is 300 seconds, after which the device is considered lost and its data is deleted from the table. This line can later be overwritten with data from another device. To output data to Mqtt, you need to enter a non-zero value in the Timeout field and confirm the entry by clicking Ok. All values ​​will be saved in non-volatile memory, and Mqtt Discovery will transfer everything to Home Assistant. Although scanning is ongoing, when setting the Timeout value , you need to take into account that maintaining connections also requires time, during which packets may be missed. Unnecessary data in Mqtt and Home Assistant can be deleted by selecting the Delete Mqtt topics option in the Setting tab when the BLE monitor is turned on and clicking Save setting.
 Samsung Smart Tags that are not linked to a SmartThings account are not suitable for tracking, as they turn off after a few minutes. The advertising message of Smart Tag associated with the SmartThings account contains a static UUID 0xFD5A, a dynamic MAC address and an encrypted identifier, due to the presence of the RND byte in it, it changes along with the MAC address. The remaining fields (status, advertising message counter, region, battery status) are not unique. The advertising message also contains a digital signature. Standard BLE trackers, as far as I know, are able to recognize the presence of these tags by UUID, but are not able to uniquely identify each tag if there is more than one. The gateway uses verification of the digital signature of the advertising message. This allows you to reliably identify Samsung Smart Tag, but requires entering a key. After entering, the key is checked and, if everything is normal, you need to enter the timeout value. Only after entering the timeout and pressing Ok, the key and timeout are stored in NVS (Non-volatile storage - non-volatile memory).

How to get the key...

 The Signing Key is an ASCII string of 64 characters (that's 32 bytes in hexadecimal, 16 bytes of the AES128CBC encryption key, and 16 bytes of the initial vector). Valid from the moment you link the Smart Tag to your SmartThings account until you unlink the account or return the device to factory settings. Generated by both the Smart Tag and the SmartThings server, it is not transmitted over the communication channel. The first 16 bytes are used by the gateway as a device identifier in the smart home system. To generate a key, you need to record the Bluetooth HCI log at the time you link the Smart Tag to your SmartThings account. If the tag is already linked, it must be removed from the account before recording the log. To link to your account, you need a Galaxy device with Android version no lower than 8.0. I used Galaxy S7. First of all, you need to enable developer mode. Open Settings > Phone information > Software information and press the build number 8 (I think) times. You may need to enter your phone PIN code. The Developer Options menu should appear in Settings . Go to the menu and turn on Bluetooth Tracking Log. Next, just in case, I turned Bluetooth off and on, then rebooted the phone. Go to the SmartThings application and add the Smart Tag device . Then again go to Settings > Developer Options and select Create error report > Interactive report. After some time, you will receive a notification about the created report. Next, you need to save it on your Windows computer. I chose to save it in the telegram application in the Favorites folder , and then saved the archive in telegram on my computer. Then you need to extract the files btsnoop_hci.log and btsnoop_hci.log.last from the archive (folder FS/data/log/bt/ ) . One of these files should contain a binding log. Next, load the archive with the stsk console utility into the folder with these files and extract the program from the archive. Just in case, I’ll note that there are no viruses in the archive, and the size of the program is 28160 bytes. Open the Windows command line, go to the folder with the files and type stsk btsnoop_hci.log and stsk btsnoop_hci.log.last. The program will display the found Smart Tags and generate keys for them. The last key will be copied to the windows clipboard:

PROJECT_PHOTO Pcture 8. Program stsk.

  The program does not process data packets broken into parts; accordingly, if it encounters such a packet, it does not find anything in the log or generates an error. I've encountered this only once so far on s21. Perhaps this is just a failure, because wireshark also did not quite correctly restore the failed packet. And I have not yet found an algorithm for identifying and assembling such data packets. In this case, you need to repeat the entire procedure again.

PROJECT_PHOTO Picture 9. BLE Monitor page.

 Added determination of the best signal from a tag (beacon) among several gateways. The algorithm works like this. Each gateway monitors the r4s/DevId/rssi topic. If he has a signal from a tag (beacon) with a high level, he writes his level to this topic, as well as his number to the r4s/DevId/gtnum topic. After which the gateway periodically, once every 6 seconds, maintains its signal level in the topic, that is, it becomes the master. The remaining gateways check the level and whether there is an update. If any gateway detects no level update for more than 30 seconds, or its level is greater, it becomes the master. The best level and gateway number can be seen in the second RSSI line on the BLE monitor page. The entities of each device also have the best level and gateway number:
PROJECT_PHOTO
Picture 10. Tag entities in Home Assistant.

5. Screen support

 IIn the first version of the gateway, there was a reserve of both operational (~100 kByte) and programmable (~400 kByte) free memory, which made it possible to expand the capabilities of the firmware, in particular, to add screen support. In addition, I already had an assembled esp32 with a 3.2" 320x240 screen on an ili9341 chip , working with firmware from the wifi-iot website . It is also possible to use ready-made devices on ili9341, ili9342 or ST7789 chips for the gateway. In the gateway I used only the necessary procedures from Bodmer, not very well adapted, but as it is for esp-iot. Pins for connecting the default screen: MOSI-23, MISO-25, CLK-19, CS-16, DC-17, RST-18, LED-21 . Pins can be reassigned in the settings. If PWR, RST, LED are set to 0, then the gateway will not use these pins. There is also an option to rotate the screen 180°, as well as the ability to adjust the display brightness using Mqtt, using the r4s/screen topic. The program checks presence of a screen on the SPI bus at startup. It is possible to display images on the screen in jpeg format. To do this, you need to specify the url of the image. My camera has the following url: http://192.168.1.7/auto.jpg?usr=admin&pwd=admin. The image is loaded into a 20-65 kilobyte buffer in RAM.The update time and buffer size can be set in the settings. It is possible to download images via https. Certificate verification is disabled. It is possible to control the parameters for loading up to 4 images via Mqtt, using the topics r4sx/jpg_url1...r4sx/jpg_url4 and r4sx/jpg_time. To clear the url of an image, you need to enter the # symbol in the corresponding topic. If these topics are not registered in Mqtt, and also after saving the settings, these parameters are copied from the settings in Mqtt. Setting the refresh interval to zero returns the cat to the screen. The length of the link buffer is currently 384 bytes. Added loading and display of weather in text form from the website wttr.in. In principle, this can be done by any site that provides text and allows formatting. If the link does not contain the lines http:// or https:// , then the gateway considers this message to be plain text and displays it on the screen. Available in 2 fonts and 10 color options. Control characters: \ \ or \n - line feed, \F - 26 pixel font and line feed, \f - 16 pixel font and line feed, \0 ... \9 - colors. The Cyrillic alphabet is supported, I checked it, however, only from mosquitto. It actually supports Unicode, like other brokers, I don’t know. An example of displaying an image on the screen in picture 11.

PROJECT_PHOTO Picture 11. Image.

 Picture 12 shows an example of displaying Mqtt weather from the website wttr.in:

https://wttr.in/Донецк?format=\F\6+%25l%20\\\4Темп:+\0%25t(%25f)\\\4Давл:\0+%25P\\\4Влажн:\0+%25h\\\6+%25c+%25w+UV:+%25u\f\4Восход:\0+%25D+\4Закат:\0+%25d

PROJECT_PHOTO Picture 12. Weather.

 Picture 13 shows an example of displaying a Mqtt string (the degree symbol can be displayed on the screen using a back apostrophe):

\F\0` English \1color \2text\3 example\n\4Русский \5цветной \6текст\n\7text1 \8text2 \9text3\f\0` English \1color \2text\3 example\n\4Русский \5цветной \6текст\n\7text1 \8text2 \9text3

PROJECT_PHOTO Picture 13. Text.

 It is worth noting that the TFT board itself affects the distribution of both WiFi and BLE. And even if the esp32 antenna peeks out from under the screen, the sensitivity of such a sandwich is noticeably less than the usual esp32. I recommend using the esp32 version with an external antenna with the screen. In my gateway with a screen, replacing the esp32 with a version with a connector and installing an external antenna gave an increase in WIFI and BLE levels by about 15-20dBm.
 If the screen is not needed, then after programming and setting up the esp32, you need to connect it to a power source and hide it somewhere in the kitchen.

6. Compatible devices

 If you want to launch a gateway as quickly as possible, without soldering, and even with a decent case, you should take a closer look at compatible devices. They just need to be reprogrammed. Only the devices I have tested are listed below. The flash_download_tools program was used for flashing the firmware .

TTGO T-Watcher (LILYGO® TTGO T4 in case).

PROJECT_PHOTO
Picture 14. TTGO T-Watcher.

 I checked the functionality of the gateway on TTGO T4 version 1.3. It is flashed via the built-in USB connector; before flashing the device, you need to connect pins 6 and 7 (gpio0 and gnd) in the bottom row of the connector (picture 15). It is possible to flash the firmware without installing jumpers, depending on the program. Screen settings for version 1.3: 12-MISO, 23-MOSI, 18-CLK, 27-CS, 32-DC, 5-RES, 4-LED, 0-PWR, and for version 1.2: 12-MISO, 23-MOSI , 18-CLK, 27-CS, 26-DC, 5-RES, 4-LED, 0-PWR. In version 1.2 there is no control to turn the screen on and off. Buttons from top to bottom 38-Port1, 37-Port2, 39-Port3. I2C bus: SCL-22, SDA-21.
PROJECT_PHOTO Picture 15. Connect pins 6 and 7 of the connector before flashing the TTGO T-Watcher firmware.

PROJECT_PHOTO
Picture 16. M5Stack BASIC Kit.

 As I understand it, old versions of M5Stack Basic came with a screen based on ili9341, and the old version of the gateway also worked on these versions. Screen settings for this version: 19-MISO, 23-MOSI, 18-CLK, 14-CS, 27-DC, 33-RES, 32-LED, 0-PWR. New versions already come with a screen based on ili9342. Starting with version 2021.10.29, screen support for ili9342 has been added. I tested the functionality of the gateway on the new version of the M5Stack BASIC Kit. It is flashed via the built-in USB connector; before flashing the device, you need to connect the last contact in the top row and 4 in the bottom row (gnd and gpio0) of the connector (picture 17). It is possible to flash the firmware without installing jumpers, depending on the program. Screen settings for the new version: 23-MISO, 23-MOSI, 18-CLK, 14-CS, 27-DC, 33-RES, 32-LED, 0-PWR. Buttons from left to right 39-Port1, 38-Port2, 37-Port3. I2C bus: SCL-22, SDA-21.
Settings for M5Stack Tough : 23-MISO, 23-MOSI, 18-CLK, 5-CS, 15-DC, 44-RES, 47-LED, 46-PWR. I2C bus: SCL-22, SDA-21. Without I2C the screen will not start.
PROJECT_PHOTO
Picture 17. Connect the last pin in the top row and 4 in the bottom row (gnd and gpio0) before flashing the M5Stack BASIC Kit.

PROJECT_PHOTO
Picture 18. ATOM-LITE-ESP32-DEVELOPMENT-KIT.

 The atom is flashed via USB without installing jumpers. I used the button to turn on/off one of the devices (39-Port1), the LED is not yet used in the firmware. IR LED at 12 gpio can be used for remote control. The device is compact (24 * 24 * 10 mm), devkit esp32 is larger in size.

7. Project assembly and license

  To build the binary files I used the Espressif IoT Development Framework. MIT license added. Added configuration for building in the PlatformIO environment, thanks to bvp , his post is here.

esp32-r4sgate-for-redmond's People

Contributors

a0s avatar alutov avatar andreypopov98 avatar bvp avatar egmen avatar raerten avatar solominsn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-r4sgate-for-redmond's Issues

версия 2022.04.26

Здравствуете Андрей.

Подскажите пожалуйста топик для управления временем кипячения.

и вопрос по топику
r4s/devices/rsp/hstate
для управления r4s/devices/cmd/hstate ? какого рода должна поступать статистика?

Спасибо!

Поддержка мультиварки RMC-M903-S

Подскажите. Добавил по вашей инструкции ранее успешно и полнофункционально чайник Redmond RK-G210S. Супер, работает как часы, а с последними добавлениями прошивки, теперь и отвалы раз в сутки исчезли!
Шикарно.
Обзавелся так же по случаю, мультиваркой Redmond RMC-M903S.
При добавлении выбрал, единственную модель M-800S и, добавилось и даже работает, именуется в шлюзе как RFS-KMC005. Есть сущности, которыми можно включать, выбирать время и задавать программы.
Screenshot_20210125-230104_Home Assistant
Screenshot_20210125-230128_Home Assistant
Screenshot_20210125-230143_Home Assistant
Единственная загвоздка, кроется в несоответствии программ, да и время задавать приходиться как температуру в отдельной сущности. Можно ли это как то скорректировать, в соответствии с реальностью ?
Если нужны логи или какая либо обратная связь, готов предоставить ) либо могу сам руками поправить, только подскажите где )

Поддержка устройства: увлажнитель воздуха RHF-3320S

Доброго времени суток!

прошу добавить устройство: https://store.redmond.company/ru/m/catalog/smart_tech/umnyy-uvlazhnitel-vozdukha-redmond-skydew-3320s/

мануал https://mcgrp.ru/files/viewer/685768/7#navigate_bar

Думал помочь и добавить, но после java код просто нечитаемый, так что сорри =с

Протокол:
55
1d
06
00 авто режим - 01 вкл / 00 выкл
00 интенсивность увлажнения: 00 - 1, 01 - 2, 02 - 3, 03 - 4
28 поддерживаемая влажность в десятеричной системе 40/45/50/55/60/65/70/75/80 (при включенном авто режиме)
00 --
00 --
00 --
00 таймер выключения часы в десятеричной системе
00 таймер выключения минуты в десятеричной системе
01 устройство - 01 вкл / 00 выкл
1a влажность в десятеричной системе
00 --
1a температура в десятеричной системе
00 --

00 ночной режим - 01 вкл/00 выкл
01 --
00 04 - нет воды/поднята крышка
aa --

значения с "--" не получилось как то изменить.
В рамках предпоследнего "00" -подозреваю там еще могут быть какие либо ошибки, попробую вызвать их.
Если будет что дополнить - отпишусь

node02.myqtthub.com и 213 чайник

Не сохранилось в настройках
node02.myqtthub.com
15 символов ограничение для адреса сервера оказалось маловато

какой ClientID используется не могу понять и найти?

И 213 проверено работает с ним :)

Стоит явно упомянуть ограничение на длину пароля MQTT

При попытке ввести пароль на 16 символов (у меня как раз такой использовался), он не сохраняется после перезагрузки и соединения с MQTT-брокером не происходит.

Если уменьшить длину пароля всё ок.

Выяснил, что причина именно в этом не сразу : )
Думаю, стоит задокументировать это.

Добавить поддержку чайника RK-M216S

Можно ли добавить поддержку чайника RK-M216S. У меня не вышло его подключить, выбирал разные пункты меню. Может я что-то не так делаю или всё же RK-M216S не поддерживается?

Если всё же не поддерживается, то стоит ли ожидать поддержку RK-M216S и в какой срок? Если чем-то необходимо помочь, то я обязательно помогу.

Сборка под mac os

День добрый. Пытаюсь собрать из сурсов, получается вот так:

> make
Toolchain path: /Users/a0s/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-97-gc752ad5
Expected to see version: esp-2021r2
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.4.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
Python requirements from /Users/a0s/esp/esp-idf/requirements.txt are satisfied.
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-97-gc752ad5
Expected to see version: esp-2021r2
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.4.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
CC build/bootloader/hal/adc_hal.o
In file included from /Users/a0s/esp/esp-idf/components/hal/esp32/include/hal/adc_ll.h:10:0,
                 from /Users/a0s/esp/esp-idf/components/hal/esp32/include/hal/adc_hal.h:17,
                 from /Users/a0s/esp/esp-idf/components/hal/adc_hal.c:9:
/Users/a0s/esp/esp-idf/components/hal/include/hal/adc_types.h:90:27: error: expected ',' or '}' before '__attribute__'
     ADC_DIGI_FORMAT_12BIT __attribute__((deprecated)),  /*!<ADC to DMA data format,                [15:12]-channel, [11: 0]-12 bits ADC data (`adc_digi_output_data_t`). Note: For single convert mode. */
                           ^
In file included from /Users/a0s/esp/esp-idf/components/hal/esp32/include/hal/i2s_ll.h:29:0,
                 from /Users/a0s/esp/esp-idf/components/hal/include/hal/adc_hal.h:28,
                 from /Users/a0s/esp/esp-idf/components/hal/esp32/include/hal/adc_hal.h:20,
                 from /Users/a0s/esp/esp-idf/components/hal/adc_hal.c:9:
/Users/a0s/esp/esp-idf/components/hal/include/hal/i2s_types.h:95:31: error: expected ',' or '}' before '__attribute__'
     I2S_COMM_FORMAT_I2S       __attribute__((deprecated)) = 0x01, /*!< I2S communication format I2S, correspond to `I2S_COMM_FORMAT_STAND_I2S`*/
                               ^
cc1: warning: unrecognized command line option '-Wno-frame-address'
make[2]: *** [adc_hal.o] Error 1
make[1]: *** [component-hal-build] Error 2
make: *** [/Users/a0s/my/ESP32-R4sGate-for-Redmond/build/bootloader/bootloader.bin] Error 2

crosstool взял этот https://dl.espressif.com/dl/xtensa-esp32-elf-macos-1.22.0-97-gc752ad5-5.2.0.tar.gz

Что можете посоветовать?

skycooker m800s

Предлагаю помощь в интеграции мультиварки в Ваш проект. Лучше всё обсудить в telegram @ring04

Edit/Apply settings

Не удается изменить настройки из web интерфейса. Удалось только отчистить топик в MQTT, все остальные настройки возвращаются после перезагрузки, пробовал тыкать все кроме настроек авторизации WIFI и MQTT.
Версия прошивки последняя 2022.07.17 / v4.4.
Плата: ESP32-WROOM-32U
Обновил по фоздуху - через web.

Rs170S

Hi I add Redmond SkyKettle RK-M170S-E

archival-redmond-skykettle-rk-m170s-e-czarny,24403058185_3

Kettle detected and work switch on/off

XYwHmNhfC9
Kattle have multiple temperature setup 40 ,55,70,80,95

msedge_z10CAH2nJg

when I try setup temperature I set 55 and the function goes off.

only work switch on go heat for 100. How to add to Ha's missing functionality?

Kettle very silimar for 173s multistep temperature. Coud You help me?

Поддержка мультиварки RMC-M92S ?

Есть возможность поддержки мультиварки RMC-M92S?
В чём может быть сложность ее добавления?

Различий в функционале у них не так много (https://www.e-katalog.ru/cmp/39551/skycooker-m92s-vs-skycooker-m800s/).
Возможно, сгодится вариант поддержки обнаружения имени RMC-M92S для поля BLE device found name с тем же кодом, что и для M800S.

ведения проекта

Большое пожелание - вести проект с правильной работой с гитом:

  • не удалять/создавать файл с кодом - теряется история, сильно затрудняет просмотр изменений, затрудняет ведение проекта несколькими людьми
  • заливать бинарники в релиз гитхаба, а не комитить в проет (сильно разрастается репозиторий)
  • завести отдельную ветку с разработкой (dev), не заливать обновления в мастер с одинаковым номером релиза

топики SkyKettle RK-GхххS

Андрей, здравствуйте!

Подскажите, для эл.чайников Вы случайно не расширяли функционал?
описание на лицевой страничке команд MQTT у Вас до последних обновлений.
интересуют, если есть, команды на:

  • время кипячения (Smart Boil)
  • режим кипячения с переходом в подогрев
  • режим подогрева на указанное время
  • настройка RGB на температуру
  • более тонкая настройка ночника, подсветки (яркость, интервал переключения оттенков)
  • блокировка ручного управления

Спасибо!

RK-G210S

Здравствуйте!
А возможно ли как-то добавить чайник RK-G210S?

Redmond SkyBaker

Интересно, есть ли шанс подключить redmond skybaker? может есть у кого инструкция на разбор протокола?

Возможно ли изменить температурный интервал измерения оставшегося количества воды

Произвожу нагрев исключительно до 90 градусов, завариваю кофе. Температура доходит до 90 градусов, но показания volume и volumelast не изменяются.

Хотелось бы спросить, возможно ли изменение интервала измерения например на 60-80 градусов.

Отключается Idle режим в Mi Kettle

Возможно я так и не понял как правильно пользоваться R4SGate c чайником Xiaomi MiKettle YM-K1501(HK) (прошивка последняя - 6.2.1.9)
Пробовал 3 варианта

  1. Оставлять чайник к режиме Idle (heat_temp = 0)
  2. Отправлять чайник в режим Idle и отключать питание
  3. Отправлять чайник в режим Heat и отключать питание

Во всех трех случаях чайник управляем (в случае 1 управляем после выключения/включения) только если включать чайник пока жидкость теплая (при остывании с 40 градусов до 20 это максимум 3 часа). Если оставить чайник на ночь, к утру во всех сценариях управляемость исчезает (при подаче питания, режим подогрева не включается)

Даже если включить подогрев сенсором "warm" на чайнике, отправить чайник в Idle и выключить питание до того как режим подогрева успел нагреть жидкость, при подаче питания режим подогрева не включается.

У кого-то вообще управление чайником Xiaomi при остывшей жидкости работает?

смена домена на water heater

Не знал куда написать, простите. Зачем выбран домен климат, когда есть прекрасный water_heater? И например water_heater.kettle прекрасно себя в нем чувствует, по крайне мере интеграция от https://github.com/mavrikkk/ha_kettler туда его и определяет, что довольно удобно. Но в той интеграции чайник постоянно отваливается, пропускает команды и прочее, поэтому решил попробовать вашу и через 20 мин у меня еще больше выбор управления параметрами, даже энергию считает) Но не помешала бы более подробная статья по настройкам или хотя бы пояснения, т.к. не все очевидно...

Статистика

Простите, что снова тревожу.. Просто перешел с кастомной интеграции для HA на вашу прошивку, настраиваюсь :)

В предыдущей версии кастомного компонента (которую я использовал) для RK-G210S была статистика включений и количество потребленной энергии. Тут можно глянуть как его получить. Возможно это реализовать?

Умная розетка Redmond RSP-103S

Скажите, как я знаю, что данная розетка Redmond RSP-103S поддерживается шлюзом.

  1. Скажите, как она работает со шлюзом. Нет задержек?
  2. Управление такое же быстрое, как и с управлением чайником?
  3. Если подключить к шлюзу несколько устройств, шлюз не будет зависать? Не скажется на быстродействие в управлении чайником?

ESP32-C3

Подскажите, пожалуйста, а возможно сделать билд под ESP32-C3?

Bluetooth шлюз для меток\телефонов

Можете сделать отдельную прошивку Bluetooth шлюз для меток\телефонов по аналогии шлюза ESP32-R4sGate-for-Redmond? Все тоже самое, только разница в том, что вместо устройств Redmond будут добавляться bluetooth метки или телефоны. В веб интерфейсе к примеру будет отображаться список мак адресов устройств и то устройство, которое нужно зафиксировать, добавляем в список обнаружения и оповещения о доступности\не доступности. Допустим я дома, шлюз увидел телефон и передал значение 1 в УД, если меня нет дома, то шлюз передает значение 0. Тоже самое это работает и с чайником в шлюзе Redmond. Есть конечно OpenMQTTGateway, но это совершенно не то и даже близкого такого функционала нет.

Update failed. Rebooting...

При попытке обновиться через wi-fi с 2020.12.09 на 2020.12.11 с помощью r4sGate.bin

Не подключается к WiFI

Доброго времени суток!

Ни в какую не подключается к основной сети. Пробовал и прошивку от 3-го месяца и текущую. ERASE ESP делал.
Сеть разумеется 2.4Ghz, 5Ghz висит на другом названии. Сеть у меня называется WiFi Draft, т.е. имеется пробел Может из-за этого? В интерфейсе после сохранения настроек название сети меняется на: WiFi+Draft. Пароль обычный, цифровой, без спец. символов.

Некорректный JSON

Вот тут #43 я выкладывал конфиг для Home Assistant, который приемлемо работает с RK-M171S, у которого нет подсветки.
Добавил RK-G211S с подсветкой, добавил switch для включения подсветки.
Также убрал галочку Common Command/Response Topics чтобы были разные топики для команд и состояния.

climate:
  - platform: mqtt
    name: Kettle2
    retain: false
    min_temp: 0
    max_temp: 100
    temp_step: 5
    precision: 1
    availability_topic: "r4s/xxx/status"
    current_temperature_topic: "r4s/xxx/rsp/temp"
    temperature_state_topic: "r4s/xxx/rsp/heat_temp"
    temperature_command_topic: "r4s/xxx/cmd/heat_temp"
    mode_command_topic: "r4s/xxx/cmd/heat_temp"
    mode_command_template: >
      {% if value == "off" %}
      0
      {% elif value == "heat" %}
      85
      {% else %}
      100
      {% endif %}
    mode_state_topic: "r4s/xxx/rsp/json"
    mode_state_template: >
      {% if value_json.state == 0 %}
      off
      {% elif value_json.target > 0 %}
      heat
      {% else %}
      auto
      {% endif %}
    modes:
      - "off"
      - "heat"
      - "auto"

sensor:
  - platform: mqtt
    name: "kettle2_temp"
    state_topic: "r4s/xxx/rsp/temp"
    unit_of_measurement: '°C'

  - platform: mqtt
    name: "kettle2_heat_temp"
    unit_of_measurement: '°C'
    state_topic: "r4s/xxx/rsp/json"
    value_template: > 
      {% if value_json.target > 0 %}
        {{ value_json.target }}
      {% elif value_json.state != 0 %}
        100
      {% else %}
        0      
      {% endif %}

  - platform: mqtt
    name: Kettle2 Подсветка
    icon: mdi:lock
    state_topic: "r4s/xxx/nightlight"
    command_topic: "r4s/xxx/cmd/nightlight"
    retain: true

В UI добавил подсветку:

          - type: custom:simple-thermostat
            entity: climate.kettle2
            header:
              name: Чайник
              icon: mdi:kettle
              toggle:
                entity: switch.kettle2_podsvetka
                name: Подсветка
            step_size: 5
            control:
              hvac:
                "off":
                  name: Выкл.
                  icon: mdi:kettle-off
                heat:
                  name: 85°C
                  icon: mdi:kettle-alert
                auto:
                  name: Кипячение
                  icon: mdi:kettle-steam
            label:
              temperature: Сейчас в чайнике

В интеграции climate пришлось колхозить микс из состояний и температур, потому что всё свалено в кучу.
В template нельзя указать разные топики, можно указать топик для json и использовать его содержимое.
Режим выкл/подогрев/кипячение определяется вот так:

    mode_state_template: >
      {% if value_json.state == 0 %}
      off
      {% elif value_json.target > 0 %}
      heat
      {% else %}
      auto
      {% endif %}

И это прекрасно работало пока я не захотел включить подсветку.
При nightlight=ON вдруг json/state=2 и climate показывает режим auto, то есть кипячение.
В template я не могу проверить /rsp/state=OFF
Проблема в том что и при кипячении json/state=2 тоже! То есть state в json неправильный! Не понятно почему он меняется при включении подсветки. И уж если меняется, то пусть при кипячении там будет что-то другое. Это нужно поправить!
А по хорошему это нужно переделать полностью, например как описано в #43.

Прошивка m5atom lite

Доброго времени.
Попробовал прошить m5atom вашей прошивкой, прошивается успешно, но потом устройство не подаёт признаков жизни. К wifi не подключается, светодиоды не горят. Может ли это быть связано с нестандартной распиновкой, и если да, то сможете ли вы доработать прошивку для этого девайса, уж больно он удобный? Готов проспонсировать покупку для тестов.

MQTT ssl

Привет. Подскажите будет поддержка ssl/tls mqtt?

Поддержка климатической станции RSC-51S

Здравствуйте, хотелось бы иметь возможность получать данные/ выводить на дисплей с климатической станции RSC-51S - измеряемые параметры :температура, влажность, давление, кач-во воздуха. Спасибо

Режимы работы и MQTT

Пытаюсь сконфигурировать нормальный объект climate в Home Assistant.
Можно использовать templates, но интеграция всё равно climate.mqtt как не крути.
Пытаюсь к режимам off / heat добавить режим auto или задействовать опцию aux heat.

Сразу скажу что оптимальный вариант - использовать aux heat в climate для кипячения вместо отдельного переключателя switch.r4s1.Kettle.boil, но рассмотрим и другие варианты.

Столкнулся с проблемами в дизайне шлюза:

Проблема 1: Попытался добавить режим auto.
mode_command_topic один на все режимы и не смотря на наличие mode_command_template не получается выставить что нужно через единственный топик. Допустим используем раздельные cmd/rsp.
cmd/state <-- 0/off/false - выключение, 1/on/true - кипячение, 2...100 - кипячение и подогрев; А где просто подогрев???
cmd/heat_temp <-- 0...39 - выключение, 40...90 подогрев, > 90 - кипячение;
Итого просто невозможно изменив значение одного топика выбрать режимы off / heat / boil / boil + heat.

Проблема 2: Попытался прикрутить aux heat к топику state аналогично как сейчас сделан switch.r4s1.Kettle.boil, но в случае если heat_temp = 85, это ни разу не boil, а просто нагрев. То есть aux heat как и switch boil переключается параллельно с режимом off/heat, в чем нет никакого смысла.

Проблема 3: всегда сбивается заданная температура. Просто невозможно держать объект climate в состоянии off и при этом хранить температуру 85.

Предлагаю рассмотреть следующий дизайн:
heat_temp - выставляется либо на чайнике кнопками, либо через MQTT и никогда не сбрасывается само вне зависимости ни от каких режимов и состояний. Изменение heat_temp через MQTT не должно менять режим (включать/выключать чайник) - это только target temperature, а не переключатель с хитрой логикой.
hstate - оставить как сейчас (off / heat) - управляет только подогревом, никакого кипячения.
state - on/off связать с aux_command_topic и aux_state_topic в Home Assistant - управляет именно кипячением и имеет приоритет над hstate.
state и hstate должны быть независимыми. То есть две boolean переменные state и hstate дают всё 4 возможных режима работы - выкл / нагрев / кипячение / кипячение + подогрев. К примеру в режиме кипячение + подогрев скипел чайник - state (aux) выключился, hstate=heat остался.
Такой дизайн решает все проблемы и позволит настроить нормальный объект climate, думаю и не только в Home Assistant. В конце концов если в какой-нибудь системе нет aux heat, останется переключатель boil (завязанный на топик state), который будет работать правильно, а не так как сейчас.

Пожелание: в Home Assistant discovery в device добавить MAC адрес шлюза (не чайника!!!) "connections": [["mac", "12:34:56:78:90:ab"]]. Это позволит правильно группировать устройства внутри Home Assistant. Можно конечно совсем вымудриться и добавить MAC чайника и ещё via_device с адресом шлюза, но ИМХО это уже лишнее.

MQTT Room support

Недавно узнал про интеграцию MQTT Room в ХоумАссистанс. Вот контракт который нужен для этой интеграции. На этой же странице есть варианты уже существующих интеграций. Наибольшая сложность как по мне состоит в вычеслении расстояния. В одном из репозиториев нашел вот такую вот формулу. Возможно ли реализовать такое?

не работает WI FI при смене сети

при вводе поключения к другой сети отличной от r4s не работает, возможно хотяб сделать пароль для стандартной сети r4s сделать по сложнее?

Redmond SkyCoffee M1519S

Здравствуйте Андрей, подскажите, кофеварка M1509S будет работать на Вашей прошивке?
Спасибо!)

Конвектор REDMOND SkyHeat 7001S

Можно ли добавить новое устройство конвектор REDMOND SkyHeat 7001S ?
Сейчас пробую управлять им как SkyPort 103S, но во первых нет возможности выбирать режим мощности 25/50/75/100
А во вторых, пока не нашел причину, но если выставить режим физической кнопкой на самом обогреватели, он отключается от ESP и висит там в оффлайн статусе, а потом становится Power RCH-7001S not connected.
Буду благодарен если поможете решить проблему.

Отключается nightlight при кипячении (RK-G200S)

Если включен режим nightlight то при кипячении он выключается и не включается обратно после того как чайник закипел
Вроде в прошлых версиях данный режим не выключался самостоятельно, по крайней мере в настроенной автоматизации по смене цвета все работало.
Андрей, есть ли возможность возвращать настройки nightlight после кипячения в исходное состояние?

PS: в выпадающем списке меню нет возможности выключить nightlight, а только включить его
image

Обновление прошивки

Здравствуйте.
Подскажите есть настроенных шлюз, при обновлении через web настройки сохраняются или нужно будет заново настроить шлюз?

Viomi Smart Kettle "V-SK152(Int)"

На прошивке 2022.07.25 перестал коннектиться Viomi Smart Kettle "V-SK152(Int)".
Откатился на 2022.06.03 - всё работает.

Термометр Xiaomi Mijia 2

Здравствуйте уважаемый Андрей.
Спасибо Вам за замечательную прошивку! Теперь Алиса может мне и чайник вскипятить ;-)

Не можете ли Вы сделать возможность подключения температурных датчиков Xiaomi (в частности Xiaomi Mijia 2) через Ваш шлюз? А то ставить ещё одну железку - ну просто розеток не хватит ;-) Да и два "порта" как бы свободны остаются, у меня только чайник...

Собственно на ESP32 и делается блютус шлюз - https://www.youtube.com/watch?v=J04PZJTwnnw&t=614s

Дополнительные состояния для GPIO

Возможно ли сделать дополнительные состояния для GPIO: задавать через web-интерфейс постоянные состояния high или low без проброса состояния в MQTT?

Поддержка чайника Xiaomi Viomi V-SK152A

Для поддержки данного чайника в прошивке нужно добавить новый тип оборудования, полностью аналогичным MiKettle 275, но ID должен быть 1116. Я внес правку в прошивку сам и чайник отлично работает

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.