Skip to content

Instantly share code, notes, and snippets.

@tk-4
Last active December 18, 2025 11:35
Show Gist options
  • Select an option

  • Save tk-4/a3b6657754e3cf529c9e570a4a979dab to your computer and use it in GitHub Desktop.

Select an option

Save tk-4/a3b6657754e3cf529c9e570a4a979dab to your computer and use it in GitHub Desktop.
zabbix_export:
version: '7.2'
template_groups:
- uuid: 61e1a1a50e914019afd6d2d8327348de
name: IoT
- uuid: 7df96b18c230490a9a0a9e2307226338
name: Templates
host_groups:
- uuid: dbcdb4feb9934d3b9f350cec39cf8bcb
name: 'IoT Devices'
templates:
- uuid: b478a9a228cd437a9da79d9cc509d160
template: 'SwitchBotAPI for devices'
name: 'SwitchBotAPI for devices'
groups:
- name: IoT
items:
- uuid: 297783747ab840bcac10542afefbeebd
name: 月間電力使用量
type: CALCULATED
key: calc.switchbot.electricity_monthly_sum
delay: 1h
units: Watt
params: 'sum("switchbot.device.electricityOfDay.increase", "30d")'
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
tags:
- tag: type
value: electricity
triggers:
- uuid: 7f76906a461c4728b7e2c949c2563f64
expression: 'nodata(/SwitchBotAPI for devices/calc.switchbot.electricity_monthly_sum,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/calc.switchbot.electricity_monthly_sum,45m)=1'
name: '月間電力使用量 - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: e093f905f50147f5b479cb9d19b50541
name: switchbot-device-raw
type: EXTERNAL
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
delay: 5m
value_type: CHAR
preprocessing:
- type: JSONPATH
parameters:
- $.body
tags:
- tag: type
value: BaseData
triggers:
- uuid: 7f33d7936a5a413d8d85f838618e47b8
expression: 'nodata(/SwitchBotAPI for devices/switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"],30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"],45m)=1'
name: 'switchbot-device-raw - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 28df65ed2a0c44969dd2a5581c865c4a
name: battery
type: DEPENDENT
key: switchbot.device.battery
units: '%'
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.battery
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: battery
triggers:
- uuid: 5b4306385f02492f80c57c48f889c176
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.battery,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.battery,45m)=1'
name: 'battery - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 569f737df7394a2a8179d91ec7c877c1
name: brightness
type: DEPENDENT
key: switchbot.device.brightness
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.brightness
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: brightness
triggers:
- uuid: a328c6e2101e4277b90b830d17042308
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.brightness,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.brightness,45m)=1'
name: 'brightness - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 787b031b5cde4b32a77873d9bfae2c96
name: calibrate
type: DEPENDENT
key: switchbot.device.calibrate
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.calibrate
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: security
triggers:
- uuid: 3e0b2361668748729cc556a3108c4e09
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.calibrate,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.calibrate,45m)=1'
name: 'calibrate - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 7f3b8e2a1d4c4b6e9a0f8c7d6e5a4b3c
name: cleanerStatus
type: DEPENDENT
key: switchbot.device.cleanerStatus
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.cleanerStatus
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: cleaner
triggers:
- uuid: 33744669f9a243e8a7605d8f285871f3
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.cleanerStatus,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.cleanerStatus,45m)=1'
name: 'cleanerStatus - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 7b95d33d19d94ef1b3219829bbbb8b82
name: CO2
type: DEPENDENT
key: switchbot.device.CO2
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.CO2
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: CO2
triggers:
- uuid: 5c8540b6154b413182873919b66236b2
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.CO2,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.CO2,45m)=1'
name: 'CO2 - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 3b4c5d6e7f8a4b0c8d2e3f4a5b6c7d8e
name: 'currentLoad (Plug Mini)'
type: DEPENDENT
key: switchbot.device.currentLoad
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.currentLoad
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: plug
triggers:
- uuid: a69752d59d1a4980996f920211d044c3
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.currentLoad,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.currentLoad,45m)=1'
name: 'currentLoad (Plug Mini) - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 7890a8c1e3554477a5520c8686acbe7c
name: deviceId
type: DEPENDENT
key: switchbot.device.deviceId
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.deviceId
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: hardware
triggers:
- uuid: 7fa32e1858594917b2046424e83c276f
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.deviceId,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.deviceId,45m)=1'
name: 'deviceId - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 9eeb091f63e74bf1b4df4e2554de3242
name: deviceType
type: DEPENDENT
key: switchbot.device.deviceType
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.deviceType
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: hardware
triggers:
- uuid: e20836ff704344498801d0e82c505419
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.deviceType,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.deviceType,45m)=1'
name: 'deviceType - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 5fd99d5b7a6c4b28b58870af58ac3a43
name: doorState
type: DEPENDENT
key: switchbot.device.doorState
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.doorState
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: security
triggers:
- uuid: e5a4f5f5c4044a86ac0e599b794713c7
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.doorState,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.doorState,45m)=1'
name: 'doorState - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 1f3dc71f60214358b27f7dc2ccceb359
name: electricCurrent
type: DEPENDENT
key: switchbot.device.electricCurrent
units: Watt
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.electricCurrent
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: electricity
triggers:
- uuid: b48e0261944747c38555e5ed26e0e643
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.electricCurrent,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.electricCurrent,45m)=1'
name: 'electricCurrent - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 98fd1ad1f65549c9bb4823947260554f
name: electricityOfDay
type: DEPENDENT
key: switchbot.device.electricityOfDay
units: Watt
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.electricityOfDay
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: electricity
triggers:
- uuid: 94c86fa127114660b6ce7a02293b6832
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.electricityOfDay,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.electricityOfDay,45m)=1'
name: 'electricityOfDay - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 279df00320434de19ed2733774097e5b
name: 電力使用増加量
type: CALCULATED
key: switchbot.device.electricityOfDay.increase
delay: 5m
units: Watt
params: 'max(0, (last(//switchbot.device.electricityOfDay) - last(//switchbot.device.electricityOfDay, #2)))'
tags:
- tag: type
value: electricity
triggers:
- uuid: f9c565d78a8740c08798150410719875
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.electricityOfDay.increase,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.electricityOfDay.increase,45m)=1'
name: '電力使用増加量 - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 3e8a5b9d2c1f4e6a907d8b5c4a110022
name: 'fanSpeed (Cleaner)'
type: DEPENDENT
key: switchbot.device.fanSpeed
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.fanSpeed
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: cleaner
triggers:
- uuid: 025e648a6b8f4c1d9e2a7f0b4d5e6c7a
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.fanSpeed,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.fanSpeed,45m)=1'
name: 'fanSpeed (Cleaner) - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: d912b3f1159b407a829f790c6828e14e
name: hubDeviceId
type: DEPENDENT
key: switchbot.device.hubDeviceId
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.hubDeviceId
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: hardware
triggers:
- uuid: 9c1f0e3a7d4b4f5c8a6e2b0d1e4c3f7b
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.hubDeviceId,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.hubDeviceId,45m)=1'
name: 'hubDeviceId - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 9cd65916a5114935a730edff2162fda1
name: humidity
type: DEPENDENT
key: switchbot.device.humidity
value_type: FLOAT
units: '%'
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.humidity
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: humidity
triggers:
- uuid: 5c78f1a293c64e58b882654d00109968
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.humidity,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.humidity,45m)=1'
name: 'humidity - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 5c78f1a293c64e58b882654d00109968
name: isHomeBase
type: DEPENDENT
key: switchbot.device.isHomeBase
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.isHomeBase
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: hardware
triggers:
- uuid: a04513689b6c478a883701a2f4d6c975
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.isHomeBase,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.isHomeBase,45m)=1'
name: 'isHomeBase - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 5a4f7c1d8e3b4a2c90e5f6a7b8c0d1e2
name: 'laborTime (Cleaner)'
type: DEPENDENT
key: switchbot.device.laborTime
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.laborTime
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: cleaner
triggers:
- uuid: b76f41424164478d8a7f053229b13997
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.laborTime,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.laborTime,45m)=1'
name: 'laborTime (Cleaner) - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 26fd2d9f879c4501ba2e5aeace876eb5
name: lockState
type: DEPENDENT
key: switchbot.device.lockState
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.lockState
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: security
triggers:
- uuid: 09d941d4c7984180a6713e8b0b925f46
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.lockState,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.lockState,45m)=1'
name: 'lockState - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 9b2d8c3e6f4a4d7b8e1f5c0a3d772211
name: 'mode (Cleaner)'
type: DEPENDENT
key: switchbot.device.mode
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.mode
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: cleaner
triggers:
- uuid: 51b88e0018d94892a0e44754700d2319
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.mode,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.mode,45m)=1'
name: 'mode (Cleaner) - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 8c6fd590e0a040a0900948632b5786b0
name: moveDetected
type: DEPENDENT
key: switchbot.device.moveDetected
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.moveDetected
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: security
triggers:
- uuid: 1a10688c3a9d45e7834226f3e5c9a419
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.moveDetected,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.moveDetected,45m)=1'
name: 'moveDetected - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 7c3d80737d4f4afabd6e888dc7fd63a7
name: onlineStatus
type: DEPENDENT
key: switchbot.device.onlineStatus
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.onlineStatus
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: cleaner
triggers:
- uuid: 60b29615a1374c43a3d537f14b638703
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.onlineStatus,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.onlineStatus,45m)=1'
name: 'onlineStatus - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 1080829d89ff44c68c02d62cf4435b33
name: openState
type: DEPENDENT
key: switchbot.device.openState
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.openState
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: security
triggers:
- uuid: 914092b76c0e44b8a25c1630132338c2
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.openState,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.openState,45m)=1'
name: 'openState - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 7a8b9c0d1e2f4a4b8c6d7e8f90123456
name: 'percentage (Curtain/Blind)'
type: DEPENDENT
key: switchbot.device.percentage
units: '%'
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.percentage
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: curtain
triggers:
- uuid: 9146199464e84b7a957d19488a1b2478
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.percentage,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.percentage,45m)=1'
name: 'percentage (Curtain/Blind) - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: c6f5a3e47d2b4f0c9a4e3b1c6d88f701
name: 'position (Curtain/Blind)'
type: DEPENDENT
key: switchbot.device.position
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.slidePosition
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: curtain
triggers:
- uuid: e2007802773449df9c4d29f864836f61
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.position,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.position,45m)=1'
name: 'position (Curtain/Blind) - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 8ed4825858864bf4addb3aaebebdd78c
name: power
type: DEPENDENT
key: switchbot.device.power
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.power
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: electricity
triggers:
- uuid: 2470732387e04f64836a0cc0f993d077
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.power,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.power,45m)=1'
name: 'power - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: f1e2d3c4b5a6407d8c6b5a4f3e2d1c0b
name: 'powerLost (Plug Mini)'
type: DEPENDENT
key: switchbot.device.powerLost
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.powerLost
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: plug
triggers:
- uuid: 63b925b302c44249a888c751296c051a
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.powerLost,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.powerLost,45m)=1'
name: 'powerLost (Plug Mini) - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 8d7c6a5b4f1e4d3c9b0a7e6f5d4c3b2a
name: 'shutterPosition (Blind Tilt)'
type: DEPENDENT
key: switchbot.device.shutterPosition
units: '%'
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.shutterPosition
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: blindTilt
triggers:
- uuid: a05b0f5924724a2e947d18721c5f359c
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.shutterPosition,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.shutterPosition,45m)=1'
name: 'shutterPosition (Blind Tilt) - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 1a2b3c4d5e6f4a8b8c0d1e2f3a4b5c6d
name: subType
type: DEPENDENT
key: switchbot.device.subType
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.subType
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: hardware
triggers:
- uuid: e38f6b7e0904469082a6311096a58145
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.subType,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.subType,45m)=1'
name: 'subType - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: b617189d66014576a7c68e2b4a820410
name: taskType
type: DEPENDENT
key: switchbot.device.taskType
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.taskType
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: cleaner
triggers:
- uuid: 2542459b158045d6a2f778736a3089d7
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.taskType,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.taskType,45m)=1'
name: 'taskType - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 821344a29b324b74af497d5f232c947c
name: temperature
type: DEPENDENT
key: switchbot.device.temperature
value_type: FLOAT
units: ℃
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.temperature
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: temperature
triggers:
- uuid: 8225547903914949a623788c2380f2d4
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.temperature,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.temperature,45m)=1'
name: 'temperature - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 6c5d4b3a2e1f4d9c8b7a6f5e4d3c2b1a
name: 'tilt (Contact Sensor)'
type: DEPENDENT
key: switchbot.device.tilt
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.tilt
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: contactSensor
triggers:
- uuid: 22d9b23b49524458872f23240e292043
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.tilt,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.tilt,45m)=1'
name: 'tilt (Contact Sensor) - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 19f5a649f43c4e5bb4d58b5ec8f10698
name: version
type: DEPENDENT
key: switchbot.device.version
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.version
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: software
triggers:
- uuid: 2d142b6a213945a0b58e747a8a1c93f0
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.version,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.version,45m)=1'
name: 'version - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: d61c4702572c454085fc7842b9fd1607
name: voltage
type: DEPENDENT
key: switchbot.device.voltage
value_type: FLOAT
units: Volt
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.voltage
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: electricity
triggers:
- uuid: 7f7813a07205494191d4e0e4708c903a
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.voltage,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.voltage,45m)=1'
name: 'voltage - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: dc49daf06c584033a3f6713350825798
name: waterBaseBattery
type: DEPENDENT
key: switchbot.device.waterBaseBattery
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.waterBaseBattery
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: cleaner
triggers:
- uuid: 4b10b784a32c4441a5405d41f928e0e3
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.waterBaseBattery,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.waterBaseBattery,45m)=1'
name: 'waterBaseBattery - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 2707f5def4e14f9fb3432e484525059f
name: workingStatus
type: DEPENDENT
key: switchbot.device.workingStatus
value_type: CHAR
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.workingStatus
master_item:
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"]'
tags:
- tag: type
value: cleaner
triggers:
- uuid: 63e264c78119460d9f4d71597a7a58a7
expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.workingStatus,30m)=1'
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: 'nodata(/SwitchBotAPI for devices/switchbot.device.workingStatus,45m)=1'
name: 'workingStatus - データなし'
priority: INFO
manual_close: 'YES'
tags:
- tag: type
value: 'Nodata Check'
- uuid: 5db2f761636a46838d0e4137773f5862
template: SwitchBotAPITemplate-v3
name: SwitchBotAPITemplate-v3
groups:
- name: IoT
- name: Templates
items:
- uuid: e2a301a602e4479bb73e7647dd2a348b
name: 'SwitchBot Api Request Count (Per Day)'
type: CALCULATED
key: switchbot.api.request.count
delay: 5m
params: 'count(//switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}"],1d)+ sum(count_foreach(/*/switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"],1d))'
triggers:
- uuid: b361d351da57455ab2b298be5de4617a
expression: last(/SwitchBotAPITemplate-v3/switchbot.api.request.count)>7000
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: last(/SwitchBotAPITemplate-v3/switchbot.api.request.count)<=7000
name: 'API Request Count Alert(70%)'
status: DISABLED
priority: AVERAGE
- uuid: e2b61fcc1e5a4dbab0336ebcdc76a580
expression: last(/SwitchBotAPITemplate-v3/switchbot.api.request.count)>10000
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: last(/SwitchBotAPITemplate-v3/switchbot.api.request.count)<=10000
name: 'API Request Count OverFlow(100%)'
priority: DISASTER
- uuid: eb512f2ccb144a0cbfccd00180d18d01
expression: last(/SwitchBotAPITemplate-v3/switchbot.api.request.count)>9000
recovery_mode: RECOVERY_EXPRESSION
recovery_expression: last(/SwitchBotAPITemplate-v3/switchbot.api.request.count)<=9000
name: 'API Request Count Warning(90%)'
status: DISABLED
priority: HIGH
- uuid: 73869a2f2c03470a9634dc46f34bb807
name: 'Switchbot API Request forecast (Per Day)'
type: CALCULATED
key: switchbot.api.request.forecast
delay: 10m
params: 'count(//switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}"],1h)+ sum(count_foreach(/*/switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}","{$DEVICE_ID}"],1h)) * 24'
discovery_rules:
- uuid: fe09105937494373848b614cfb8fe1ec
name: switchbotapi-11
type: EXTERNAL
key: 'switchbot-api11-get.py["{$API_TOKEN}","{$API_SECRET}"]'
delay: 1h
host_prototypes:
- uuid: 292997c15305468ebc0887b115360df7
host: 'switchbot-{#DEVICE_ID}'
name: '{#DEVICE_NAME}'
group_links:
- group:
name: 'IoT Devices'
templates:
- name: 'SwitchBotAPI for devices'
macros:
- macro: '{$DEVICE_ID}'
value: '{#DEVICE_ID}'
tags:
- tag: DEVICE_ID
value: '{#DEVICE_ID}'
- tag: DEVICE_TYPE
value: '{#DEVICE_TYPE}'
custom_interfaces: 'YES'
interfaces:
- { }
preprocessing:
- type: JSONPATH
parameters:
- $.body.deviceList
- type: JAVASCRIPT
parameters:
- |
// (ステップ1から deviceList の配列を受け取ります)
var result = { "data": [] };
var deviceList = JSON.parse(value);
// 配列ではない可能性(デバイスが1つもない場合など)も考慮
if (Array.isArray(deviceList)) {
deviceList.forEach(function(device) {
result.data.push({
// LLDマクロの定義
"{#DEVICE_ID}": device.deviceId,
"{#DEVICE_NAME}": device.deviceName,
"{#DEVICE_TYPE}": device.deviceType
});
});
}
return JSON.stringify(result);
tags:
- tag: service-name
value: home-health
graphs:
- uuid: 1f4fac10f7224d7496763aaa5d389243
name: API-Reuqst
graph_items:
- drawtype: FILLED_REGION
color: 199C0D
calc_fnc: ALL
item:
host: SwitchBotAPITemplate-v3
key: switchbot.api.request.count
- sortorder: '1'
drawtype: BOLD_LINE
color: 4000FF
calc_fnc: ALL
item:
host: SwitchBotAPITemplate-v3
key: switchbot.api.request.forecast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment