『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: 三木

[流程系列] 7.7抓取监控图像进行人数统计及小姐姐邮件通知(动态版)

  [复制链接]

8

主题

139

帖子

1042

积分

论坛技术达人

积分
1042
金钱
898
HASS币
40
发表于 2023-2-26 16:23:50 | 显示全部楼层

感谢分享。。。
回复

使用道具 举报

0

主题

12

帖子

38

积分

新手上路

Rank: 1

积分
38
金钱
26
HASS币
0
发表于 2023-3-17 16:02:52 | 显示全部楼层
[{"id":"4e8c1568.4e73ac","type":"tab","label":"彩云天气","disabled":false,"info":""},{"id":"63e32a4e.5c34f4","type":"inject","z":"4e8c1568.4e73ac","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":183,"y":169,"wires":[["439745d6.04788c"]]},{"id":"32b4a819.cd3878","type":"http request","z":"4e8c1568.4e73ac","name":"实时天气","method":"GET","ret":"obj","url":"https://api.caiyunapp.com/v2/{{{api_key}}}/{{{jingdu}}},{{{weidu}}}/realtime.json","tls":"","x":385,"y":178,"wires":[["ea59396a.d14398"]]},{"id":"776cbc8d.a533b4","type":"debug","z":"4e8c1568.4e73ac","name":"调试信息","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":590,"y":26,"wires":[]},{"id":"439745d6.04788c","type":"function","z":"4e8c1568.4e73ac","name":"基础数据","func":"//api key\nmsg.api_key = ''\n//精度\nmsg.jingdu = '121.6544'\n//纬度\nmsg.weidu = '25.1552'\n\n\nreturn msg;","outputs":1,"noerr":0,"x":173,"y":250,"wires":[["2978ffd5.2422d","32b4a819.cd3878"]]},{"id":"2978ffd5.2422d","type":"http request","z":"4e8c1568.4e73ac","name":"天气预报","method":"GET","ret":"obj","url":"https://api.caiyunapp.com/v2/{{{api_key}}}/{{{jingdu}}},{{{weidu}}}/forecast.json?unit=metric:v2&alert=true","tls":"","x":366,"y":254,"wires":[["a3e6701e.821d3"]]},{"id":"ea59396a.d14398","type":"function","z":"4e8c1568.4e73ac","name":"数据处理","func":"var REALTIME_TYPES = {\n 'temperature': ['temperature', '°C','mdi:thermometer'],\n 'skycon': ['skycon', '',''],\n 'cloudrate': ['cloudrate', '%','mdi:weather-partlycloudy'],\n 'aqi': ['AQI', ' ','mdi:cloud-outline'],\n 'humidity': ['humidity', '%','mdi:water-percent'],\n 'pm25': ['pm25', 'μg/m3','mdi:blur'],\n 'o3': ['o3', 'μg/m3','mdi:blur'],\n 'co': ['co', 'μg/m3','mdi:blur'],\n 'pm10': ['pm10', 'μg/m3','mdi:blur'],\n 'no2': ['no2', 'μg/m3','mdi:blur'],\n 'pres': ['pres', 'Pa','mdi:arrow-collapse-down'],\n 'so2': ['so2', 'μg/m3','mdi:blur'],\n\n}\n\nvar SKYCON_TYPE = {\n 'CLEAR_DAY':'晴天',\n 'CLEAR_NIGHT':'晴夜',\n 'PARTLY_CLOUDY_DAY':'多云',\n 'PARTLY_CLOUDY_NIGHT':'多云',\n 'CLOUDY':'阴',\n 'RAIN':'雨',\n 'SNOW':'雪',\n 'WIND':'风',\n 'FOG':'雾',\n 'HAZE':'雾霾',\n}\n\n\nfunction direction_chinese(direction){\n if (direction > 337.4 || direction < 22.5)\n final_direction = '北风'\n else if (direction > 22.4 && direction < 67.5)\n final_direction = '东北风'\n else if ( direction > 67.4 && direction < 112.5)\n final_direction = '东风'\n else if ( direction > 112.4 && direction < 157.5)\n final_direction = '东南风'\n else if ( direction > 157.4 && direction < 202.5)\n final_direction = '南风'\n else if ( direction > 202.4 && direction < 247.5)\n final_direction = '西南风'\n else if ( direction > 247.4 && direction < 292.5)\n final_direction = '西风'\n else if ( direction > 292.4 && direction < 337.5)\n final_direction = '西北风'\n else\n final_direction = '无数据'\n return final_direction\n}\n\nvar payload = msg.payload\n\nvar w = {}\n\nfor(var key in REALTIME_TYPES) {\n var value = payload['result'][key]\n if (value > 0) {\n \n }else {\n \n }\n w[key] = payload['result'][key] + REALTIME_TYPES[key][1]\n}\n\n////天气概况\nw['skycon'] = SKYCON_TYPE[w['skycon']]\n////风\nw['wind_direction'] = direction_chinese(payload['result']['wind']['direction'])\nw['wind_speed'] = payload['result']['wind']['speed'] + 'Km/h'\n//降水\nw['nearest_precipitation_distance'] = payload['result']['precipitation']['nearest']['distance'] + 'Km/h'\nw['nearest_precipitation_intensity'] = payload['result']['precipitation']['nearest']['intensity'] + 'mm'\nw['local_precipitation_intensity'] = payload['result']['precipitation']['local']['intensity'] + 'Km/h'\nw['local_datasource'] = payload['result']['precipitation']['local']['datasource']\n\nmsg.payload = w\nmsg.all = payload\n\n\n\n\nreturn msg;","outputs":1,"noerr":0,"x":588,"y":168,"wires":[["776cbc8d.a533b4","cffc96b8.fa4a28"]]},{"id":"a3e6701e.821d3","type":"function","z":"4e8c1568.4e73ac","name":"数据处理","func":"var data_forecast = msg.payload\n\nvar REALTIME_TYPES = {\n 'probability_30': ['%'],\n 'probability_60': ['%'],\n 'probability_90': ['%'],\n 'probability_120': ['%'],\n 'probability_3h': ['%'],\n 'probability_4h': ['%'],\n 'wind_min': ['Km/h'],\n 'wind_max': ['Km/h'],\n 'temperature_min': ['°C'],\n 'temperature_max': ['°C'],\n\n}\n\nvar w = {}\nvar c = {} //不带单位,用来做自动化\n\n//描述\nc['description'] = data_forecast['result']['minutely']['description']\n//降雨率\nvar probability = data_forecast['result']['minutely']['probability']\nc['probability_30'] = (probability[0] * 100).toFixed(2) \nc['probability_60'] = (probability[1] * 100).toFixed(2) \nc['probability_90'] = (probability[2] * 100).toFixed(2) \nc['probability_120'] = (probability[3] * 100).toFixed(2)\n//\nvar probability_4h = data_forecast['result']['minutely']['probability_4h']\nif (probability_4h) {\n c['probability_3h'] = (probability_4h[2] * 100).toFixed(2)\n c['probability_4h'] = (probability_4h[3] * 100).toFixed(2)\n}else {\n c['probability_3h'] = '您的API_KEY不支持该参数[probability_3h]'\n c['probability_4h'] = '您的API_KEY不支持该参数[probability_4h]'\n REALTIME_TYPES['probability_3h'][0] = ''\n REALTIME_TYPES['probability_4h'][0] = ''\n}\n//风\nvar wind = data_forecast['result']['daily']['wind']\n//温度\nvar temperature = data_forecast['result']['daily']['temperature']\n\nc['wind_min'] = wind[0]['min']['speed']\nc['wind_max'] = wind[0]['max']['speed']\n\nc['temperature_min'] = temperature[0]['min']\nc['temperature_max'] = temperature[0]['max']\n\nfor(var key in REALTIME_TYPES) {\n w[key] = c[key] + REALTIME_TYPES[key][0]\n}\n\nvar alert_content = data_forecast['result']['alert']['content']\nif (alert_content && alert_content.lenght > 0) {\n w['alert'] = alert_content[0]['description']\n w['alert_source'] = alert_content[0]['source']\n w['alert_county'] = alert_content[0]['county']\n}else {\n w['alert'] = '暂无预警'\n w['alert_source'] = '暂无预警'\n w['alert_county'] = '暂无预警'\n}\n\nmsg.payload = w\nmsg.c = c\nmsg.all = data_forecast\nreturn msg;","outputs":1,"noerr":0,"x":586,"y":258,"wires":[["776cbc8d.a533b4","b3463717.449608"]]},{"id":"cffc96b8.fa4a28","type":"mqtt out","z":"4e8c1568.4e73ac","name":"mqtt发送","topic":"/node-red/caiyun/realtime","qos":"0","retain":"false","broker":"1550bab3.2a8365","x":847,"y":174,"wires":[]},{"id":"b3463717.449608","type":"mqtt out","z":"4e8c1568.4e73ac","name":"mqtt发送","topic":"/node-red/caiyun/forecast","qos":"0","retain":"","broker":"1550bab3.2a8365","x":836,"y":264,"wires":[]},{"id":"1550bab3.2a8365","type":"mqtt-broker","z":"","name":"home","broker":"shenfan.f3322.net","port":"2883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
回复

使用道具 举报

6

主题

114

帖子

966

积分

高级会员

Rank: 4

积分
966
金钱
852
HASS币
0
发表于 2023-7-18 17:02:02 | 显示全部楼层
像进行人数统计及小
回复

使用道具 举报

0

主题

16

帖子

74

积分

注册会员

Rank: 2

积分
74
金钱
58
HASS币
0
发表于 2023-8-11 14:04:36 | 显示全部楼层
学习一下
回复

使用道具 举报

0

主题

12

帖子

31

积分

新手上路

Rank: 1

积分
31
金钱
19
HASS币
0
发表于 2023-9-10 08:41:41 | 显示全部楼层
感谢大神的照片
回复

使用道具 举报

1

主题

5

帖子

62

积分

注册会员

Rank: 2

积分
62
金钱
57
HASS币
0
发表于 2023-10-8 04:50:46 | 显示全部楼层
是我目前最需要的
回复

使用道具 举报

0

主题

26

帖子

668

积分

高级会员

Rank: 4

积分
668
金钱
642
HASS币
0
发表于 2023-12-1 21:05:02 | 显示全部楼层
好好学习一下
回复

使用道具 举报

0

主题

23

帖子

166

积分

注册会员

Rank: 2

积分
166
金钱
143
HASS币
0
发表于 2023-12-12 10:53:22 | 显示全部楼层
好东西,学习下
回复

使用道具 举报

0

主题

14

帖子

144

积分

注册会员

Rank: 2

积分
144
金钱
130
HASS币
0
发表于 2023-12-12 14:56:44 | 显示全部楼层
谢谢大佬分享
回复

使用道具 举报

0

主题

31

帖子

249

积分

中级会员

Rank: 3Rank: 3

积分
249
金钱
218
HASS币
0
发表于 2024-1-2 09:46:44 | 显示全部楼层
学习一下下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-21 18:59 , Processed in 1.761982 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表