玩电表,正泰DDSU666型单相电子式电能表

正泰DDSU666型单相电子式电能表符合《DL/T645-2007多功能电能表通信协议》支持485通信
00000000-电能量-组合有功电能
02010100-变量-A电压
02020100-变量-A电流
02030000-变量-有功功率
02040100-变量-无功功率
02060000-变量-功率因数
02800002-变量-电网频率

正泰DDSU666表,接线方式,入线L接1、N线接3,485线A接7、B接8,通信速率2400

实例,发送
FE FE FE FE 68 02 49 03 24 08 19 68 11 04 33 34 34 35 48 16
4个字节FE,唤醒对方,两段起始符68,结束符16,表号(通讯地址)190824034902,11读数据命令
04数据长度,33 34 34 35对应电压各位+33H,校验码48为68开始到35各位和的末位
接收
FE FE FE FE 68 02 49 03 24 08 19 68 91 06 00 01 01 02 90 22 E2 16
4个字节FE,唤醒对方,两段起始符68,结束符16,表号(通讯地址)190824034902,91读数据应答
06数据长度,00 01 01 02对应电压,90 22对应电压229.0V,校验码E2为68开始到22各位和的末位

IFTTT

ifttt.com
This->Webhooks miku
That->Notifications 大迷窟
https://maker.ifttt.com/trigger/miku/with/key/d72puv3YULAeU1DVj0lDQ8

Linux下软件环境安装(9)-Redis安装与配置

wget http://download.redis.io/releases/redis-stable.tar.gz
tar xzf redis-stable.tar.gz
cd redis-stable

sudo apt-get install make gcc

make
src/redis-server --protected-mode no &
src/redis-cli
#./redis-cli -h x.17.0.10 -p 6379

sudo bash -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled'

echo "vm.overcommit_memory=1" > /etc/sysctl.conf
echo 2048 > /proc/sys/net/core/somaxconn

在/etc/sysctl.conf中添加如下
vm.overcommit_memory = 1
net.core.somaxconn = 2048
然后在终端中执行
sudo sysctl -p

sudo vi /etc/rc.local
#!/bin/sh -e

rc.local

This script is executed at the end of each multiuser runlevel.

Make sure that the script will "exit 0" on success or any other

value on error.

In order to enable or disable this script just change the execution

bits.

By default this script does nothing.

echo never > /sys/kernel/mm/transparent_hugepage/enabled

exit 0

sudo chown root:root /etc/rc.local
sudo chmod 755 /etc/rc.local
sudo systemctl enable rc-local.service

zabbix

首先:

docker run --name mysql-server -t \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix" \
      -e MYSQL_ROOT_PASSWORD="zabbix" \
      -d mysql:5.7  \
--character-set-server=utf8 --collation-server=utf8_bin

然后:

docker run --name zabbix-server-mysql -t \
      -e DB_SERVER_HOST="mysql-server" \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix" \
      -e MYSQL_ROOT_PASSWORD="zabbix" \
      --link mysql-server:mysql \
      -p 10051:10051 \
      -d zabbix/zabbix-server-mysql:latest

再来:

docker run --name zabbix-web-nginx-mysql -t \
      -e DB_SERVER_HOST="mysql-server" \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix" \
      -e MYSQL_ROOT_PASSWORD="zabbix" \
      --link mysql-server:mysql \
      --link zabbix-server-mysql:zabbix-server \
      -p 8080:80 \
      -d zabbix/zabbix-web-nginx-mysql:latest

网络访问:
Admin/zabbix

参考文献:
https://www.cnblogs.com/root0/p/9812789.html
https://www.zabbix.com/cn/download?zabbix=4.2&os_distribution=ubuntu&os_version=16.04_xenial&db=mysql

“气象站”项目(二)重新喝粥

一个小插曲,博客突然访问不到了,是不是M1的IP被切了,去M1里找nginx的配置,打算本地尝试
可是ps中明明有进程,whereis却查不读nginx,活见鬼了,后来才想起来,上次tf卡烧了后,东西都装docker里了

好吧,还是喝粥吧,再不喝卡都要过期了,尤其是不带卡槽的S9,充一年要五块四,犹豫中,2019-10-31过期
工具网上可下载的新版还是1.6.4,不过已经提示有1.7.9了,网站更新不及时了
开始没有信号,以为过期了才发现的真的要过期了,其实是因为屋子里边信号比较差,用usb延长线放到了窗口,csq可以稳定在15左右了,内置固件是Q-CBC 1.0.0 2.1.9 Luat_V0031_8955_SSL_FLOAT

[2019-09-13 15:06:45.272]: [I]-[ril.procatc.send] first 200 bytes POST /zhou/report HTTP/1.1
[2019-09-13 15:06:45.275]: Connection: short
[2019-09-13 15:06:45.278]: Content-Length: 41
[2019-09-13 15:06:45.281]: Host: api.yqmiot.com
[2019-09-13 15:06:45.284]: {"did":"cong","type":"wd","data":"40.65"}

[2019-09-13 15:16:41.602]: [I]-[ril.proatc] +RECEIVE,6,228:
[2019-09-13 15:16:41.607]: [I]-[ril.proatc] HTTP/1.1 200 OK
[2019-09-13 15:16:41.610]: [I]-[ril.proatc] Content-Type: text/html; charset=UTF-8
[2019-09-13 15:16:41.613]: [I]-[ril.proatc] Content-Length: 16
[2019-09-13 15:16:41.617]: [I]-[ril.proatc] Connection: keep-alive
[2019-09-13 15:16:41.619]: [I]-[ril.proatc] X-Api-ID: api-430yoxc6
[2019-09-13 15:16:41.620]: [I]-[ril.proatc] X-Service-RateLimit: 20/20
[2019-09-13 15:16:41.622]: [I]-[ril.proatc] X-Api-RateLimit: unlimited
[2019-09-13 15:16:41.623]: [I]-[ril.proatc] Server: TornadoServer/5.1.1
[2019-09-13 15:16:41.625]: [I]-[ril.proatc]
[2019-09-13 15:16:41.626]: [I]-[ril.proatc] {"message":"ok"}

球猫的站都被查封了,不过似乎还能提交过去
开始新的项目Q-MQ,不过一直报错,直到拷贝了Q-CBC,DEMO中有两个没用的订阅/event0,/中文event1