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

 找回密码
 立即注册

[技术探讨] 集思广益,大家都搞了什么自动化?

  [复制链接]

4

主题

227

帖子

1373

积分

金牌会员

Rank: 6Rank: 6

积分
1373
金钱
1146
HASS币
0
发表于 2024-9-2 15:22:48 | 显示全部楼层
lambilly 发表于 2024-7-29 18:45
网上买了蓝牙标签,45元1个,家里每人1个挂在钥匙或其他包里。一到家就会联上主机的ibeacon。非常好用。原 ...

电池供电吗?可以用多久?
回复

使用道具 举报

4

主题

227

帖子

1373

积分

金牌会员

Rank: 6Rank: 6

积分
1373
金钱
1146
HASS币
0
发表于 2024-9-2 15:31:30 | 显示全部楼层
BobbyCoon 发表于 2024-7-30 08:29
我家一直是用homeassistant的app和Wi-Fi同时判定是否有人在家,用了四五年了,没有出过问题,之前家里用ve ...

homeassistant是设置gps追踪吗
回复

使用道具 举报

8

主题

140

帖子

748

积分

高级会员

Rank: 4

积分
748
金钱
608
HASS币
0
发表于 2024-9-3 11:16:45 | 显示全部楼层
lhpsq 发表于 2024-8-29 09:36
思路:用LD2450的XY距离,划分出几个区域,楼梯下、楼梯中、楼梯上,以及远外。然后用Nodered做自动化控 ...

之前我也想过用2450,无奈技术不到位搞不定,我来学习学习老哥的思路和做法,感谢感谢
回复

使用道具 举报

8

主题

140

帖子

748

积分

高级会员

Rank: 4

积分
748
金钱
608
HASS币
0
发表于 2024-9-3 11:26:46 | 显示全部楼层
lhpsq 发表于 2024-8-29 09:36
思路:用LD2450的XY距离,划分出几个区域,楼梯下、楼梯中、楼梯上,以及远外。然后用Nodered做自动化控 ...

回调的触发条件

这个回调是针对 Target1 Y 传感器的值变化的。当 Target1 Y 传感器的值发生变化时,这段代码会被执行。
检查目标速度

cpp
复制代码
if (id(T1S).state == 0){
  id(text1).publish_state("none");
}
首先,检查 Target1 Speed (T1S) 的值。如果目标速度为 0,则将 text1 文本传感器的状态更新为 "none"。这意味着如果目标静止不动,就不显示任何区域信息。
目标位置判断

cpp
复制代码
if (id(T1Y).state < 330) {
如果目标的 Y 坐标小于 330,进行进一步的判断。
区域划分

cpp
复制代码
if (id(T1Y).state > 240 && id(T1X).state > 50) {
  id(text1).publish_state("3");
} else if (id(T1Y).state < 240 && id(T1Y).state != 0){
  id(text1).publish_state("2");
} else if (id(T1Y).state > 230 && id(T1X).state < -50) {
  id(text1).publish_state("1");
} else {
  id(text1).publish_state("none");
}
根据目标的 Y 坐标 (T1Y) 和 X 坐标 (T1X),将目标划分为不同的区域:
区域 3: 如果 Y 坐标大于 240 且 X 坐标大于 50,目标在区域 3。
区域 2: 如果 Y 坐标小于 240 且不等于 0,目标在区域 2。
区域 1: 如果 Y 坐标大于 230 且 X 坐标小于 -50,目标在区域 1。
无区域: 如果以上条件都不满足,则更新为 "none"。
默认状态

cpp
复制代码
else {
  id(text1).publish_state("0");
}
如果目标的 Y 坐标大于等于 330,则将 text1 文本传感器的状态更新为 "0"。这可能表示目标在区域外或超出了定义的范围。
总结
这段回调代码的目的是根据目标的位置和速度信息,将目标的状态划分到不同的区域,并通过 text1 文本传感器在 Home Assistant 中显示。这样可以实现对目标状态的实时监控和可视化展示。

面向GPT编程,总算读懂了,接下来能不能厚脸皮地求一份nodered代码,啊哈哈哈


回复

使用道具 举报

3

主题

27

帖子

235

积分

中级会员

Rank: 3Rank: 3

积分
235
金钱
208
HASS币
0
发表于 2024-9-5 11:12:49 | 显示全部楼层
隔壁的王叔叔 发表于 2024-8-7 12:30
自动关窗挺好,用的是哪款关窗神器?

淘宝买的,支持米家的关窗器,就是要自己动手安装
回复

使用道具 举报

17

主题

145

帖子

542

积分

高级会员

Rank: 4

积分
542
金钱
397
HASS币
0
发表于 2024-9-5 21:23:40 | 显示全部楼层
25989406 发表于 2024-8-7 17:34
iphonedetect
对iphong和标准android稳定性比较好,华为有时候休眠稍微差一点,小天才也是他自己低功耗也 ...

大佬,今天我搞了下你说的这个iPhonedetect。但是我发现似乎只能添加两个ip地址。家里两个iPhone,网络2.4G和5G。要4个host才能真是的反应出人员是否在家。
回复

使用道具 举报

10

主题

108

帖子

550

积分

高级会员

Rank: 4

积分
550
金钱
442
HASS币
0
发表于 2024-9-5 23:31:12 | 显示全部楼层
在本贴学到不少东西,感谢各位大佬
回复

使用道具 举报

17

主题

145

帖子

542

积分

高级会员

Rank: 4

积分
542
金钱
397
HASS币
0
发表于 2024-9-6 08:54:16 | 显示全部楼层
25989406 发表于 2024-8-7 17:34
iphonedetect
对iphong和标准android稳定性比较好,华为有时候休眠稍微差一点,小天才也是他自己低功耗也 ...

不止可以添加两个地址。估计我代码写错了。现在好了。
回复

使用道具 举报

1

主题

35

帖子

266

积分

中级会员

Rank: 3Rank: 3

积分
266
金钱
231
HASS币
0
发表于 2024-9-9 16:49:53 | 显示全部楼层
本帖最后由 wanyevyv 于 2024-9-9 16:52 编辑
隔壁的王叔叔 发表于 2024-8-19 11:33
不错,不错,温度在高于1度和2度的临界点是怎么处理的?

需要在nodered中实现,nodered的events:state,可以在温度每变化0.1度时触发,在switch里设置几个输出控制空调风速
微信图片_20240909165203.png
以下为导出
[
    {
        "id": "b47fd01d009e1125",
        "type": "api-call-service",
        "z": "724075cff78956a2",
        "name": "低速",
        "server": "65bef38af2beb021",
        "version": 5,
        "debugenabled": false,
        "domain": "climate",
        "service": "set_fan_mode",
        "areaId": [],
        "deviceId": [
            "e2ea0068e8559f95649b6716e11a9438"
        ],
        "entityId": [],
        "data": "{\"fan_mode\":\"low\"}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 930,
        "y": 400,
        "wires": [
            []
        ]
    },
    {
        "id": "71abcb5f71159d35",
        "type": "api-call-service",
        "z": "724075cff78956a2",
        "name": "高速",
        "server": "65bef38af2beb021",
        "version": 5,
        "debugenabled": false,
        "domain": "climate",
        "service": "set_fan_mode",
        "areaId": [],
        "deviceId": [
            "e2ea0068e8559f95649b6716e11a9438"
        ],
        "entityId": [],
        "data": "{\"fan_mode\":\"high\"}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 930,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "94039a86feef064f",
        "type": "server-state-changed",
        "z": "724075cff78956a2",
        "name": "1F老人",
        "server": "65bef38af2beb021",
        "version": 5,
        "outputs": 1,
        "exposeAsEntityConfig": "",
        "entityId": "sensor.cgllc_s1_c5f4_temperature",
        "entityIdType": "exact",
        "outputInitially": true,
        "stateType": "str",
        "ifState": "",
        "ifStateType": "num",
        "ifStateOperator": "is",
        "outputOnlyOnStateChange": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "qingpingtemp",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            }
        ],
        "x": 170,
        "y": 360,
        "wires": [
            [
                "26d2b89434c99860"
            ]
        ]
    },
    {
        "id": "26d2b89434c99860",
        "type": "api-current-state",
        "z": "724075cff78956a2",
        "name": "面板",
        "server": "65bef38af2beb021",
        "version": 3,
        "outputs": 2,
        "halt_if": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is_not",
        "entity_id": "climate.cubee_th125a_cd58_thermostat",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "mianban",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 290,
        "y": 360,
        "wires": [
            [
                "afedc40bb8bc69e7"
            ],
            []
        ]
    },
    {
        "id": "df3c7785381152b2",
        "type": "function",
        "z": "724075cff78956a2",
        "name": "function 4",
        "func": "msg.payload = (msg.qingpingtemp - msg.mianban.attributes.temperature)\nreturn msg",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 680,
        "y": 360,
        "wires": [
            [
                "8ad9f91f8d114fca"
            ]
        ]
    },
    {
        "id": "8ad9f91f8d114fca",
        "type": "switch",
        "z": "724075cff78956a2",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gt",
                "v": "2.6",
                "vt": "num"
            },
            {
                "t": "btwn",
                "v": "2.5",
                "vt": "num",
                "v2": "1.6",
                "v2t": "num"
            },
            {
                "t": "lte",
                "v": "1.5",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 810,
        "y": 360,
        "wires": [
            [
                "71abcb5f71159d35"
            ],
            [
                "a836bbffc4d9f2bb"
            ],
            [
                "b47fd01d009e1125"
            ]
        ]
    },
    {
        "id": "a836bbffc4d9f2bb",
        "type": "api-call-service",
        "z": "724075cff78956a2",
        "name": "中速",
        "server": "65bef38af2beb021",
        "version": 5,
        "debugenabled": false,
        "domain": "climate",
        "service": "set_fan_mode",
        "areaId": [],
        "deviceId": [
            "e2ea0068e8559f95649b6716e11a9438"
        ],
        "entityId": [],
        "data": "{\"fan_mode\":\"medium\"}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 930,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "2e02f5467b3d7a58",
        "type": "api-call-service",
        "z": "724075cff78956a2",
        "name": "制冷3",
        "server": "65bef38af2beb021",
        "version": 5,
        "debugenabled": false,
        "domain": "climate",
        "service": "set_hvac_mode",
        "areaId": [],
        "deviceId": [
            "e2ea0068e8559f95649b6716e11a9438"
        ],
        "entityId": [],
        "data": "{\"hvac_mode\":\"cool\"}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 550,
        "y": 340,
        "wires": [
            [
                "df3c7785381152b2"
            ]
        ]
    },
    {
        "id": "eda141157e401a87",
        "type": "api-call-service",
        "z": "724075cff78956a2",
        "name": "停止3",
        "server": "65bef38af2beb021",
        "version": 5,
        "debugenabled": false,
        "domain": "climate",
        "service": "set_hvac_mode",
        "areaId": [],
        "deviceId": [
            "e2ea0068e8559f95649b6716e11a9438"
        ],
        "entityId": [],
        "data": "{\"hvac_mode\":\"heat\"}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 550,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "afedc40bb8bc69e7",
        "type": "switch",
        "z": "724075cff78956a2",
        "name": "温度阈值",
        "property": "qingpingtemp",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gte",
                "v": "(msg.mianban.attributes.temperature)+1",
                "vt": "jsonata"
            },
            {
                "t": "lte",
                "v": "mianban.attributes.temperature",
                "vt": "msg"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 420,
        "y": 360,
        "wires": [
            [
                "2e02f5467b3d7a58"
            ],
            [
                "eda141157e401a87"
            ]
        ]
    },
    {
        "id": "65bef38af2beb021",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": false,
        "rejectUnauthorizedCerts": false,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": false
    }
]
回复

使用道具 举报

0

主题

17

帖子

42

积分

新手上路

Rank: 1

积分
42
金钱
25
HASS币
0
发表于 5 天前 | 显示全部楼层
不是基于ha的,直接走的米家,就是人存开卫生间的灯,然后里面区域放了个人感非人存,进入卫生间开灯,蹲坑就开浴霸灯+通风+自然风,冬天加个暖风。人走就关闭全部设备。里的卫生间都是比较暗的,每次伸手去开灯挺麻烦,不开吧,改装的智能灯就显得挺弱智的,自动化非常有必要
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-9-17 03:49 , Processed in 0.062400 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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