GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - upchr/mqtt-home

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
api
api
 
 
config
config
 
 
devices
devices
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
config.ini
config.ini
 
 
install.sh
install.sh
 
 
main.py
main.py
 
 
mqtt.service
mqtt.service
 
 
uninstall.sh
uninstall.sh
 
 

Repository files navigation

MQTT自定义处理接入

基于MQTT利用米家-巴法平台,实现远程操作:windows、极米投影仪开关机等;

参考

巴法云控制台
小爱接入巴法云
电脑入米家,让小爱同学随意操控电脑开关机
极米new Z6X接入米家教程 实现小爱控制蓝牙开机及Wifi关机

食用方法

0.环境配置

0.1 PIP依赖

pip install requests paho-mqtt configparser  asyncudp  bluez-peripheral

0.2 特定功能依赖

apt install -y etherwake  # WOL
apt install -y bluez bluez-tools libbluetooth-dev # 蓝牙

0.3 ssh-windows免密

ssh-keygen -t rsa -b 4096 -N "" -f ~/.ssh/id_rsa
#windows开启sshd服务
#公钥复制带windows:C:\Users\user\.ssh\authorized_keys
ssh-copy-id  hostname@broadcast   

0.4 极米投影仪配对

配对遥控器,模拟蓝牙遥控获取manufactorer data

1.修改config.ini配置文件

# 日志输出级别
[General]
log_level = INFO

# 巴法云配置
[MQTT_CONFIG]
bemfa_broker=bemfa.com
bemfa_port=9501
# 巴法平台控制台获取的私钥
bemfa_client_id=xxxx


# 开启接收处理的设备主题mqtt_topic
[Devices]
enabled = xxxx ,xgimi009, pc009, pc2topic

# 自定义设备信息
# 接入格式:
#[Device:mqtt_topic]
#type = XXHandler  #配置为devices.xx中xxHandler处理器
#xxx=xxx #参考下面示范,对应处理器内容

# 巴法云主题:xgimi009-极米
[Device:xgimi009]
type = XGiMiHandler  #配置为devices.xgimi中XGiMiHandler处理器
x_ip=xxxx  #极米ip
manufacturer_data=xxxx  #极米遥控码

# 巴法云主题:pc009-pc1
[Device:pc009]
type = PCHandler   #配置为devices.xgimi中PCHandler处理器
broadcast=xxxx #windows-ip
hostname=xxxx #windows-username
mac=xxxx #windows-mac

# 巴法云主题:pc2topic-pc2
[Device:pc2topic]
type = PCHandler
broadcast=xxxx #windows-ip
hostname=xxxx #windows-username
mac=xxxx #windows-mac


# 二开可追加配置:自动加载devices/消息处理器
[DeviceModules]
modules = devices.pc, devices.xgimi

2.脚本注册为服务自启动

修改mqtt.service文件中的WorkingDirectory和ExecStart为自己的路径

[Unit]
Description=MQTT Client Contral PC Daemon
After=network.target
Wants=network.target
[Service]
Environment=PYTHONUNBUFFERED=1

Type=simple
WorkingDirectory=/xxxxx/mqtt-home
ExecStart=/bin/sh -c "python3 main.py 2>&1 | tee -a log/mqtt.log | /usr/bin/logger -t mqtt"

Restart=always
RestartSec=20s
User=root
[Install]
WantedBy=multi-user.target

安装/卸载服务

cd mqtt-home
安装服务:chmod +x install.sh && ./install.sh
卸载服务:chmod +x uninstall.sh &&  ./uninstall.sh

About

No description, website, or topics provided.

Resources

Readme
Apache-2.0 license
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.