Zigbee

From Eric

Revision as of 17:35, 9 August 2021 by Ejenn (Talk | contribs)
Jump to: navigation, search

Contents

Install zigbee2mqtt

Configure the zigbee adapter

See https://www.zigbee2mqtt.io/information/flashing_the_cc2531.html

Install zigbee2mqtt

See https://www.zigbee2mqtt.io/


To mofidy the state of a device, refer to the zigbee2mqtt documentation for your device. For instance, for a 4-relay Tuya adapter:

 mosquitto_pub -t "zigbee2mqtt/relays/set" -m  '{"state_l1": "OFF"}'

start zigbee2mqtt automatically

See https://www.zigbee2mqtt.io/getting_started/running_zigbee2mqtt.html

 # Stopping Zigbee2MQTT
 sudo systemctl stop zigbee2mqtt
 # Starting Zigbee2MQTT
 sudo systemctl start zigbee2mqtt
 # View the log of Zigbee2MQTT
 sudo journalctl -u zigbee2mqtt.service -f


Zigbee sniffing

Install Texas Instruments SmartRF studio (I use smartrftm_studio-2.21.0) Texas instruments flash programmer (I use flash-programmer-1.12.8) Zboss (I use 2020_11_02_zboss_sniffer_windows_ubuntu_64bit) WireShark

The Zboss archive contains both the desktop application and the firmware to be programmed to the dongle.

Note that I have not managed to make ZBoss work on Linux.


On Linux, you’ll have to use cc-tools:

 git clone https://github.com/dashesy/cc-tool.git
 cd cc-tool
 ./bootstrap
 ./configure
 make

And to flash:

 sudo ./cc-tool -e -w <firmware>.hex

Instructions are given at https://www.zigbee2mqtt.io/how_tos/how_to_sniff_zigbee_traffic.html

(see also: https://www.hal9k.dk/sniffing-philips-hue-zigbee-traffic-with-wireshark/, https://www.youtube.com/watch?v=4vG4CVNAm_A,


Zigbee frames are encrypted.

To decrypt the frames, follow the following procedure:


Voir aussi : https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/218226/getting-started-with-the-cc2530

https://electronics.stackexchange.com/questions/158637/zigbee-firmware-for-cc2530-chips

Install an ESP32 CAM camera

To install an ePS32 CAM, the easiest way is to use the ESPhome firmware generator.

Installing ESPhome (e.g, on the Raspberry Pi server) is achieved as follows (see complete instructions here):

 pip3 install esphome

(The executable "esphome" is located at $HOME/.local/bin/)

Then, you have to connect physically your ESP32_CAM to the host using a serial adapter, according to the following diagram:

Esp32cam connection.jpg

Then you have to create a configuration file. This can be done using the esphome wizard, or you can get your inspiration from the following one:

 esphome:
   name: esp32_cam_2
   platform: ESP32
   board: nodemcu-32s
 
 # Enable logging
 logger:
 
 # Enable Home Assistant API
 api:
   password: "xxxxxx"
 
 ota:
   password: "xxxxxx"
 
 wifi:
   ssid: "yyyyyy"
   password: "zzzzzz"
 
 # Enable fallback hotspot (captive portal) in case wifi connection fails
 ap:
   ssid: "Esp32 Cam 2 Fallback Hotspot"
   password: "aaaaaaaa"
 
 esp32_camera:
   external_clock:
     pin: GPIO0
     frequency: 20MHz
   i2c_pins:
     sda: GPIO26
     scl: GPIO27
   data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
   vsync_pin: GPIO25
   href_pin: GPIO23
   pixel_clock_pin: GPIO22
   power_down_pin: GPIO32
 
   # Image settings
   name: "CAM 2"
 
 text_sensor:
   - platform: version
     name: "ESPHome Version"
 
 switch:
   - platform: restart
     name: "ESP32 CAM 2 restart"
   - platform: gpio
     pin: 4
     name: "CAM 2 Flash"
   - platform: gpio
     pin: 2
     name: "CAM 2 LED"
 
 binary_sensor:
   - platform: status
     name: "CAM 2 Status"
 

Then, to upload the firmware to the ESP32CAM, type

~/.local/bin/esphome run <config file>.yaml

This will generate the firmware, compile it and uploadit to the ESP32CAM. The first time, the software will be uploaded via the serial line. Then the following updates can be done OTA.

Personal tools