├── utils ├── bufstring.cpp ├── CMakeLists.txt ├── ArduinoJson.h └── scratchmem.h ├── .github ├── ISSUE_TEMPLATE │ └── config.yml ├── workflows │ ├── release-drafter.yml │ └── staleAction.yml ├── release-drafter-config.yml └── stale.yml ├── tests ├── 000-catch2-main.cpp └── 201-device-js.cpp ├── img ├── ddf_device_0.png ├── ddf_file_0.png ├── ddf_bindings_0.png ├── ddf_subdevice_0.png ├── dev_integration_0.png ├── dev_integration_1.png ├── source_routing_0.png ├── source_routing_1.png ├── ddf_resource_item_0.png └── ddf_resource_item_1.png ├── devices ├── nedis │ └── tuya_swversion.js ├── tuya │ ├── tuya_swversion.js │ ├── tuya_trv_preset_set.js │ ├── lux_to_lightlevel_50.js │ ├── tuya_trv_preset.js │ ├── _TZ3000_TS004F_smart_knob_group_view.js │ └── _TZ3000_TS004F_smart_knob_group_add.js ├── xiaomi │ ├── xiaomi_swversion.js │ ├── xiaomi_cube_rotation.js │ ├── xiaomi_battery.js │ ├── 0001_battery.js │ ├── xiaomi_known_issues_difficult_pairing.md │ ├── 0101_orientation.js │ ├── xiaomi_rtcgq14lm_lux_to_lightlevel.js │ ├── xiaomi_known_issues_firmware_update.md │ ├── xiaomi_known_issues_sticky_parents.md │ └── xiaomi_rtczcgq11lm_presenceevent.js ├── terncy │ ├── terncy_dc01_contact_sensor_pairing.md │ └── terncy_sd01_known_issues.md ├── generic │ ├── color_control_cluster │ │ └── parse_color_mode.js │ ├── items │ │ ├── config_mode_item.json │ │ ├── config_hostflags_item.json │ │ ├── state_lockstate_item.json │ │ ├── attr_productname_item.json │ │ ├── config_schedule_item.json │ │ ├── state_errorcode_item.json │ │ ├── config_preset_item.json │ │ ├── config_swingmode_item.json │ │ ├── attr_powerup_item.json │ │ ├── cap_measured_value_quantity_item.json │ │ ├── config_fanmode_item.json │ │ ├── config_group_item.json │ │ ├── config_melody_item.json │ │ ├── state_gesture_item.json │ │ ├── state_lux_item.json │ │ ├── attr_ddf_hash_item.json │ │ ├── cap_measured_value_substance_item.json │ │ ├── config_lock_item.json │ │ ├── state_angle_item.json │ │ ├── state_music_sync_item.json │ │ ├── state_open_bis_item.json │ │ ├── state_pm2_5_item.json │ │ ├── attr_poweronct_item.json │ │ ├── config_usertest_item.json │ │ ├── state_speed_item.json │ │ ├── state_water_bis_item.json │ │ ├── attr_name_item.json │ │ ├── attr_poweronlevel_item.json │ │ ├── attr_type_item.json │ │ ├── config_pending_item.json │ │ ├── config_selftest_item.json │ │ ├── config_sensitivity_bis_item.json │ │ ├── config_speed_item.json │ │ ├── state_airqualityppb_item.json │ │ ├── state_buttonevent_item.json │ │ ├── state_deviceruntime_item.json │ │ ├── state_filterruntime_item.json │ │ ├── state_orientation_x_item.json │ │ ├── state_orientation_y_item.json │ │ ├── state_orientation_z_item.json │ │ ├── state_pressure_bis_item.json │ │ ├── state_rotaryevent_item.json │ │ ├── state_targetdistance_item.json │ │ ├── attr_swversion_bis_item.json │ │ ├── config_delay_item.json │ │ ├── config_ledindication_item.json │ │ ├── config_offset_item.json │ │ ├── config_setvalve_item.json │ │ ├── state_airquality_bis_item.json │ │ ├── state_charging_item.json │ │ ├── state_distance_item.json │ │ ├── config_configured_item.json │ │ ├── config_fadingtime_item.json │ │ ├── config_interlock_item.json │ │ ├── state_airqualityppb_bis_item.json │ │ ├── state_eventduration_item.json │ │ ├── state_humidity_bis_item.json │ │ ├── cap_groups_not_supported_item.json │ │ ├── cap_measured_value_max_item.json │ │ ├── cap_measured_value_min_item.json │ │ ├── config_reversed_item.json │ │ ├── state_heating_item.json │ │ ├── state_mountingmodeactive_item.json │ │ ├── attr_uniqueid_item.json │ │ ├── config_displayflipped_item.json │ │ ├── config_enrolled_item.json │ │ ├── state_measured_value_item.json │ │ ├── state_presenceevent_item.json │ │ ├── state_replacefilter_item.json │ │ ├── state_temperature_bis_item.json │ │ ├── cap_alert_trigger_effect_item.json │ │ ├── cap_on_off_with_effect_item.json │ │ ├── config_allowtouchlink_item.json │ │ ├── config_windowopen_set_item.json │ │ ├── attr_id_item.json │ │ ├── cap_transition_block_item.json │ │ ├── config_mountingmode_item.json │ │ ├── config_reportgrid_item.json │ │ ├── state_lastcheckin_item.json │ │ ├── attr_lastseen_item.json │ │ ├── config_externalwindowopen_item.json │ │ ├── state_expectedrotation_item.json │ │ ├── state_seconds_remaining_item.json │ │ ├── cap_bri_move_with_onoff_item.json │ │ ├── cap_color_ct_computes_xy_item.json │ │ ├── config_color_gradient_pixel_count_item.json │ │ ├── state_tiltangle_item.json │ │ ├── config_on_item.json │ │ ├── config_resetpresence_item.json │ │ ├── config_sensitivity_item.json │ │ ├── state_expectedeventduration_item.json │ │ ├── state_gradient_item.json │ │ ├── state_lastupdated_item.json │ │ ├── state_test_item.json │ │ ├── config_windowopendetectionenabled_item.json │ │ ├── attr_lastannounced_item.json │ │ ├── cap_sleeper_item.json │ │ ├── config_interfacemode_item.json │ │ ├── config_sensitivitymax_item.json │ │ ├── config_temperature_item.json │ │ ├── config_triggerdistance_item.json │ │ ├── config_detectionrange_item.json │ │ ├── config_loadbalancing_item.json │ │ ├── config_reachable_item.json │ │ ├── config_triggerdistance_bis_item.json │ │ ├── state_reachable_item.json │ │ ├── config_battery_item.json │ │ ├── config_coolsetpoint_item.json │ │ ├── state_lightlevel_item.json │ │ ├── state_dark_item.json │ │ ├── state_fire_item.json │ │ ├── state_open_item.json │ │ ├── state_tampered_item.json │ │ ├── state_vibrationstrength_item.json │ │ ├── config_battery_bis_item.json │ │ ├── config_externalsensortemp_item.json │ │ ├── state_water_item.json │ │ ├── config_duration_item.json │ │ ├── config_filterlifetime_item.json │ │ ├── state_alarm_item.json │ │ ├── state_lowbattery_item.json │ │ ├── state_presence_item.json │ │ ├── state_vibration_item.json │ │ ├── config_pulseconfiguration_item.json │ │ ├── config_radiatorcovered_item.json │ │ ├── state_carbonmonoxide_item.json │ │ ├── config_clickmode_item.json │ │ ├── state_y_item.json │ │ ├── attr_modelid_item.json │ │ ├── config_controlsequence_item.json │ │ ├── config_tholddark_item.json │ │ ├── state_daylight_item.json │ │ ├── attr_manufacturername_item.json │ │ ├── cap_color_xy_blue_x_item.json │ │ ├── cap_color_xy_blue_y_item.json │ │ ├── cap_color_xy_red_y_item.json │ │ ├── cap_color_xy_green_x_item.json │ │ ├── cap_color_xy_green_y_item.json │ │ ├── state_flow_item.json │ │ ├── state_pressure_item.json │ │ ├── config_devicemode_item.json │ │ ├── state_utc_item.json │ │ ├── config_devicemode_bis_item.json │ │ ├── state_humidity_item.json │ │ ├── state_localtime_item.json │ │ ├── state_temperature_item.json │ │ ├── state_moisture_item.json │ │ ├── config_ctmax_item.json │ │ ├── state_lastset_item.json │ │ ├── cap_color_gamut_type_item.json │ │ ├── config_tholdoffset_item.json │ │ ├── cap_color_gradient_max_segments_item.json │ │ ├── cap_color_gradient_pixel_length_item.json │ │ ├── cap_otau_image_type_item.json │ │ ├── state_production_item.json │ │ ├── state_valve_item.json │ │ ├── cap_otau_file_version_item.json │ │ ├── config_alert_item.json │ │ ├── state_consumption_item.json │ │ ├── state_current_p1_item.json │ │ ├── state_current_p2_item.json │ │ ├── state_current_p3_item.json │ │ ├── state_hue_item.json │ │ ├── attr_mode_item.json │ │ ├── config_bri_options_item.json │ │ ├── state_consumption_2_item.json │ │ ├── state_sat_item.json │ │ ├── cap_measured_value_unit_item.json │ │ ├── state_current_item.json │ │ ├── state_on_item.json │ │ ├── state_voltage_item.json │ │ ├── attr_swversion_item.json │ │ ├── cap_color_ct_min_item.json │ │ ├── state_power_item.json │ │ ├── attr_zonetype_item.json │ │ ├── cap_color_ct_max_item.json │ │ ├── state_alert_item.json │ │ ├── cap_color_capabilities_item.json │ │ ├── attr_otaversion_item.json │ │ ├── config_lastchange_time_item.json │ │ ├── state_bri_item.json │ │ ├── state_x_item.json │ │ ├── attr_appversion_item.json │ │ ├── attr_productid_item.json │ │ ├── state_airquality_item.json │ │ ├── state_power_divisor_item.json │ │ ├── config_lastchange_amount_item.json │ │ ├── state_lift_item.json │ │ ├── state_tilt_item.json │ │ ├── state_battery_item.json │ │ ├── state_ct_item.json │ │ ├── cap_color_effects_item.json │ │ ├── cap_group_item.json │ │ ├── config_schedule_on_item.json │ │ ├── cap_bri_min_dim_level_item.json │ │ ├── config_lastchange_source_item.json │ │ ├── config_colorcapabilities_item.json │ │ ├── cap_color_gradient_styles_item.json │ │ ├── config_ctmin_item.json │ │ ├── attr_swconfigid_item.json │ │ ├── config_bri_couple_ct_item.json │ │ ├── config_tuya_unlock_item.json │ │ ├── cap_color_xy_red_x_item.json │ │ ├── cap_otau_manufacturer_code_item.json │ │ ├── config_bri_execute_if_off_item.json │ │ ├── cap_color_gradient_pixel_count_item.json │ │ ├── config_bri_min_item.json │ │ ├── config_bri_max_item.json │ │ ├── config_locked_item.json │ │ ├── config_bri_on_level_item.json │ │ ├── config_bri_startup_item.json │ │ ├── config_on_startup_item.json │ │ ├── attr_ddf_policy_item.json │ │ ├── config_color_ct_startup_item.json │ │ ├── config_heatsetpoint_item.json │ │ ├── state_windowopen_item.json │ │ ├── config_bri_onoff_transitiontime_item.json │ │ ├── config_color_execute_if_off_item.json │ │ ├── state_effect_item.json │ │ ├── config_volume_item.json │ │ ├── config_checkin_item.json │ │ ├── state_colormode_item.json │ │ ├── config_unoccupiedheatsetpoint_item.json │ │ ├── config_color_gradient_reversed_item.json │ │ ├── config_color_xy_startup_x_item.json │ │ ├── config_color_xy_startup_y_item.json │ │ ├── state_action_item.json │ │ └── config_windowcoveringtype_item.json │ ├── subdevices │ │ ├── range_extender.json │ │ ├── smart_plug.json │ │ ├── on_off_output.json │ │ ├── on_off_switch.json │ │ ├── warning_device.json │ │ ├── on_off_plugin_unit.json │ │ ├── door_lock_controller.json │ │ ├── level_control_switch.json │ │ ├── dimmable_plugin_unit.json │ │ ├── switch.json │ │ ├── fire_sensor.json │ │ ├── window_covering_device.json │ │ ├── zgp_switch.json │ │ ├── time.json │ │ ├── battery_sensor.json │ │ ├── water_leak_sensor.json │ │ ├── on_off_light.json │ │ ├── open_close_sensor.json │ │ ├── vibration_sensor.json │ │ ├── door_lock.json │ │ ├── consumption_sensor.json │ │ ├── humidity_sensor.json │ │ ├── moisture_sensor.json │ │ ├── pressure_sensor.json │ │ ├── carbonmonoxide_sensor.json │ │ ├── temperature_sensor.json │ │ ├── door_lock_sensor.json │ │ ├── presence_sensor.json │ │ ├── power_sensor.json │ │ ├── air_purifier.json │ │ ├── air_quality_sensor.json │ │ ├── relative_rotary.json │ │ ├── alarm_sensor.json │ │ ├── light_level_sensor.json │ │ ├── thermostat.json │ │ ├── formaldehyde_sensor.json │ │ ├── carbondioxide_sensor.json │ │ ├── particulatematter_sensor.json │ │ ├── dimmer_switch.json │ │ ├── ancillary_control.json │ │ ├── dimmable_light.json │ │ └── color_temperature_light.json │ ├── illuminance_cluster │ │ ├── lux_to_lightlevel.js │ │ └── sml_light_level.js │ └── touchlink_commissioning_cluster │ │ └── 1000_get_group_identifiers.js ├── develco │ ├── develco_firmware.js │ └── develco_battery.js ├── frient │ ├── develco_firmware.js │ └── develco_battery.js ├── dresden_elektronik │ ├── scene_switch_on.js │ ├── scene_switch_scenes.js │ ├── lighting_switch_on.js │ ├── scene_switch_bri.js │ ├── lighting_switch_bri.js │ ├── lighting_switch_scenes.js │ └── lighting_switch_ct.js ├── fireangel │ ├── 0001_battery_voltage.js │ └── 0019_swversion.js ├── ikea │ ├── 0006_presence.js │ ├── starkvind_parse_speed.js │ ├── starkvind_parse_target_mode.js │ ├── 0400_lightlevel.js │ ├── starkvind_write_target_mode.js │ ├── ikea_known_issues_radio_silence.md │ ├── 0008_rotaryevent.js │ └── fc7e_tvoc_level.js ├── philips │ ├── fc00_buttonevent.js │ ├── fc00_rotaryevent.js │ └── 0400_lightlevel.js ├── bosch │ └── bosch_battery.js ├── computime-salus │ └── computime_battery.js ├── danfoss │ ├── danfoss_errorcode.js │ └── danfoss_windowopen_state.js ├── b-parasite │ └── 0400_lightlevel.js └── lutron │ └── lutron_known_issues.md ├── air_quality.h ├── zcl └── CMakeLists.txt ├── zdp ├── CMakeLists.txt └── zdp_handlers.h ├── thermostat_ui_configuration.h ├── .gitignore ├── cloc_device.sh ├── fan_control.h ├── linux └── deCONZ │ ├── usr │ └── bin │ │ ├── deCONZ-ikea-ota-download.sh │ │ └── deCONZ-wait-for-X.sh │ └── lib │ └── systemd │ └── system │ ├── deconz-homebridge.service │ └── deconz-homebridge-install.service ├── cj └── cj_all.c ├── resource └── CMakeLists.txt ├── device_js └── CMakeLists.txt ├── resourcelinks.cpp ├── xiaomi.h ├── ui ├── ddf_itemlist.h └── text_lineedit.h ├── crypto ├── random.h ├── password.h ├── mmohash.h └── scrypt.h ├── sqlite3 └── CMakeLists.txt ├── device_compat.h ├── backup.h ├── device_ddf_init.h ├── rest_ddf.h ├── device └── CMakeLists.txt ├── alarm_system_event_handler.h ├── group_info.cpp ├── rest_scenes.cpp ├── simple_metering.h ├── resourcelinks.h ├── gateway_scanner.h ├── rest_alarmsystems.h ├── read_files.h ├── device_ddf_bundle.h ├── ikea-ota-download.py └── product_match.h /utils/bufstring.cpp: -------------------------------------------------------------------------------- 1 | #include "bufstring.h" 2 | 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /tests/000-catch2-main.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | #include "catch2/catch.hpp" 3 | -------------------------------------------------------------------------------- /img/ddf_device_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/ddf_device_0.png -------------------------------------------------------------------------------- /img/ddf_file_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/ddf_file_0.png -------------------------------------------------------------------------------- /img/ddf_bindings_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/ddf_bindings_0.png -------------------------------------------------------------------------------- /img/ddf_subdevice_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/ddf_subdevice_0.png -------------------------------------------------------------------------------- /img/dev_integration_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/dev_integration_0.png -------------------------------------------------------------------------------- /img/dev_integration_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/dev_integration_1.png -------------------------------------------------------------------------------- /img/source_routing_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/source_routing_0.png -------------------------------------------------------------------------------- /img/source_routing_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/source_routing_1.png -------------------------------------------------------------------------------- /img/ddf_resource_item_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/ddf_resource_item_0.png -------------------------------------------------------------------------------- /img/ddf_resource_item_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dresden-elektronik/deconz-rest-plugin/HEAD/img/ddf_resource_item_1.png -------------------------------------------------------------------------------- /devices/nedis/tuya_swversion.js: -------------------------------------------------------------------------------- 1 | var v = Attr.val; 2 | Item.val = String((v & 192) >> 6) + '.' + String((v & 48) >> 4) + '.' + String(v & 15); 3 | -------------------------------------------------------------------------------- /devices/tuya/tuya_swversion.js: -------------------------------------------------------------------------------- 1 | var v = Attr.val; 2 | Item.val = String((v & 192) >> 6) + '.' + String((v & 48) >> 4) + '.' + String(v & 15); 3 | -------------------------------------------------------------------------------- /devices/xiaomi/xiaomi_swversion.js: -------------------------------------------------------------------------------- 1 | var s = "0.0.0_"; 2 | var v = (Attr.val & 0xFF).toString(); 3 | v = v.padStart(4, "0"); 4 | Item.val = s + v; 5 | -------------------------------------------------------------------------------- /utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_library (utils 3 | utils.h 4 | utils.cpp 5 | ) 6 | 7 | target_link_libraries(utils PUBLIC deconz_common) 8 | -------------------------------------------------------------------------------- /utils/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | 2 | // Wrapper to include specific version of ArduinoJSON 3 | #define ARDUINOJSON_ENABLE_STD_STRING 1 4 | #include "ArduinoJson-v6.19.4.h" 5 | -------------------------------------------------------------------------------- /devices/tuya/tuya_trv_preset_set.js: -------------------------------------------------------------------------------- 1 | const modes = ['holiday','auto','manual','comfort','eco','boost','complex']; 2 | v = modes.indexOf(Item.val); 3 | if (v >= 0) { v } -------------------------------------------------------------------------------- /devices/terncy/terncy_dc01_contact_sensor_pairing.md: -------------------------------------------------------------------------------- 1 | ### Pairing 2 | 3 | Press and hold the button for about 6 seconds till the green LED starts flashing. Wait until paired. -------------------------------------------------------------------------------- /devices/generic/color_control_cluster/parse_color_mode.js: -------------------------------------------------------------------------------- 1 | 2 | const modes = ["hs","xy","ct","hs"]; 3 | if (Attr.val >= 0 && Attr.val < 4) 4 | Item.val = modes[Attr.val]; 5 | -------------------------------------------------------------------------------- /devices/develco/develco_firmware.js: -------------------------------------------------------------------------------- 1 | let s = ""; 2 | for (var i = 0; i < 3; i++) { 3 | s += Number(ZclFrame.at(5 + i)).toString(16); 4 | s += (i < 2) ? '.' : ''; 5 | } 6 | Item.val = s; -------------------------------------------------------------------------------- /devices/frient/develco_firmware.js: -------------------------------------------------------------------------------- 1 | let s = ""; 2 | for (var i = 0; i < 3; i++) { 3 | s += Number(ZclFrame.at(5 + i)).toString(16); 4 | s += (i < 2) ? '.' : ''; 5 | } 6 | Item.val = s; -------------------------------------------------------------------------------- /devices/dresden_elektronik/scene_switch_on.js: -------------------------------------------------------------------------------- 1 | var i = R.item("state/buttonevent"); 2 | if (ZclFrame.cmd == 1) { 3 | i.val = 1002; 4 | } else if (ZclFrame.cmd == 0) { 5 | i.val = 2002; 6 | } 7 | -------------------------------------------------------------------------------- /air_quality.h: -------------------------------------------------------------------------------- 1 | #ifndef AIR_QUALITY_H 2 | #define AIR_QUALITY_H 3 | 4 | #include "utils/utils.h" 5 | 6 | extern const std::array RStateAirQualityVocLevelGer; 7 | 8 | #endif // AIR_QUALITY_H 9 | -------------------------------------------------------------------------------- /devices/fireangel/0001_battery_voltage.js: -------------------------------------------------------------------------------- 1 | /* global Attr, Item */ 2 | // Map battery voltage from 1.9V ... 3.0V to 0% ... 100% 3 | Item.val = Math.max(0, Math.min(Math.round(9.09090909 * (Attr.val - 19)), 100)) 4 | -------------------------------------------------------------------------------- /zcl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_library (zcl 3 | zcl.h 4 | zcl.cpp 5 | ) 6 | 7 | target_link_libraries(zcl PUBLIC deconz_common) 8 | 9 | target_include_directories (zcl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 10 | -------------------------------------------------------------------------------- /zdp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_library (zdp 3 | zdp.h 4 | zdp.cpp 5 | ) 6 | 7 | target_link_libraries(zdp PUBLIC deconz_common) 8 | 9 | target_include_directories (zdp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_mode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/mode", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Mode of the device." 8 | } 9 | -------------------------------------------------------------------------------- /thermostat_ui_configuration.h: -------------------------------------------------------------------------------- 1 | #ifndef THERMOSTAT_UI_CONFIGURATION_H 2 | #define THERMOSTAT_UI_CONFIGURATION_H 3 | 4 | #define THERM_UI_ATTRID_KEYPAD_LOCKOUT 0x0001 5 | 6 | #endif // THERMOSTAT_UI_CONFIGURATION_H 7 | -------------------------------------------------------------------------------- /devices/generic/items/config_hostflags_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/hostflags", 4 | "datatype": "Int32", 5 | "access": "RW", 6 | "public": false, 7 | "description": "Device options." 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/state_lockstate_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/lockstate", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Door lock state." 8 | } 9 | -------------------------------------------------------------------------------- /devices/ikea/0006_presence.js: -------------------------------------------------------------------------------- 1 | /* global Item, R, ZclFrame */ 2 | 3 | Item.val = true 4 | R.item('state/dark').val = (ZclFrame.at(0) & 0x01) === 0x00 5 | R.item('config/duration').val = Math.round((ZclFrame.at(1) | ZclFrame.at(2) << 8) / 10) 6 | -------------------------------------------------------------------------------- /devices/xiaomi/xiaomi_cube_rotation.js: -------------------------------------------------------------------------------- 1 | var v = Math.round(Attr.val * 100); 2 | 3 | if (v > 0) { R.item('state/gesture').val = 7 } // Rotate clockwise 4 | else { R.item('state/gesture').val = 8 }; // Rotate counter-clockwise 5 | Item.val = v; -------------------------------------------------------------------------------- /devices/philips/fc00_buttonevent.js: -------------------------------------------------------------------------------- 1 | /* global Item, R, ZclFrame */ 2 | 3 | if (ZclFrame.at(2) === 0x00) { 4 | Item.val = ZclFrame.at(0) * 1000 + ZclFrame.at(4) 5 | R.item('state/eventduration').val = ZclFrame.at(7) << 8 | ZclFrame.at(6) 6 | } 7 | -------------------------------------------------------------------------------- /devices/generic/items/attr_productname_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/productname", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Product name of the device." 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/config_schedule_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/schedule", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "On-device heating schedules." 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.Debug 3 | Makefile.Release 4 | release 5 | ui_de_web_widget.h 6 | .qmake.stash 7 | tests/build 8 | *.txt.user 9 | ui_ddf_editor.h 10 | ui_device_widget.h 11 | .vscode 12 | .devcontainer 13 | build* 14 | 15 | .DS_Store 16 | -------------------------------------------------------------------------------- /devices/generic/items/state_errorcode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/errorcode", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "The error code given by the device." 8 | } 9 | -------------------------------------------------------------------------------- /cloc_device.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cloc \ 4 | device.* \ 5 | device_access_fn.* \ 6 | device_compat.* \ 7 | device_ddf_init.* \ 8 | device_descriptions.* \ 9 | device_js/* \ 10 | zcl/* \ 11 | device_tick.* \ 12 | state_change.* \ 13 | ui/* 14 | 15 | -------------------------------------------------------------------------------- /devices/dresden_elektronik/scene_switch_scenes.js: -------------------------------------------------------------------------------- 1 | var i = R.item("state/buttonevent"); 2 | var scene = ZclFrame.at(2); 3 | if (ZclFrame.cmd == 5) { 4 | i.val = ((scene + 2) * 1000) + 2; 5 | } else if (ZclFrame.cmd == 4) { 6 | i.val = ((scene + 2) * 1000) + 3; 7 | } 8 | -------------------------------------------------------------------------------- /devices/generic/items/config_preset_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/preset", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Sets the operating mode for Tuya thermostats." 8 | } 9 | -------------------------------------------------------------------------------- /fan_control.h: -------------------------------------------------------------------------------- 1 | #ifndef FAN_CONTROL_H 2 | #define FAN_CONTROL_H 3 | 4 | #include "utils/utils.h" 5 | 6 | #define FAN_CTRL_ATTRID_FAN_MODE 0x0000 7 | 8 | extern const std::array RConfigFanModeValues; 9 | 10 | #endif // FAN_CONTROL_H 11 | -------------------------------------------------------------------------------- /devices/generic/items/config_swingmode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/swingmode", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Indicates the position of Louver on the AC." 8 | } 9 | -------------------------------------------------------------------------------- /devices/ikea/starkvind_parse_speed.js: -------------------------------------------------------------------------------- 1 | /* global Attr, Item */ 2 | 3 | const max = 50.0 4 | let speed = Attr.val 5 | 6 | speed = (speed <= max) ? speed : 0 7 | speed = speed / max * 100.0 8 | 9 | /* eslint-disable no-unused-expressions */ 10 | Item.val = speed 11 | -------------------------------------------------------------------------------- /devices/xiaomi/xiaomi_battery.js: -------------------------------------------------------------------------------- 1 | /* global Attr, Item */ 2 | 3 | const vmin = 2700 4 | const vmax = 3000 5 | const v = Math.max(vmin, Math.min(Attr.val, vmax)) 6 | const bat = Math.round(((v - vmin) / (vmax - vmin)) * 100) 7 | Item.val = Math.max(0, Math.min(bat, 100)) 8 | -------------------------------------------------------------------------------- /devices/generic/items/attr_powerup_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/powerup", 4 | "datatype": "UInt32", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "Powerup mode of a device." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/cap_measured_value_quantity_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/measured_value/quantity", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Quantity of measured_value." 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/config_fanmode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/fanmode", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Specifies the current speed of the fan for sensors." 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/config_group_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/group", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "comma seperated list of groups which a device controls." 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/config_melody_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/melody", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "Melody or ringtone number" 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_gesture_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/gesture", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The last received gesture." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_lux_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/lux", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": true, 7 | "description": "The current Light level in lux.", 8 | "default": 0 9 | } 10 | -------------------------------------------------------------------------------- /linux/deCONZ/usr/bin/deCONZ-ikea-ota-download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl 'http://fw.ota.homesmart.ikea.net/feed/version_info.json' | jq -r '[.[] | .fw_binary_url] | .[]' > $HOME/files.txt 4 | 5 | cd $HOME/otau && xargs -n 1 curl -O < $HOME/files.txt 6 | 7 | rm $HOME/files.txt -------------------------------------------------------------------------------- /devices/generic/items/attr_ddf_hash_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/ddf_hash", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "implicit": true, 8 | "description": "Hash of active DDF bundle." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/cap_measured_value_substance_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/measured_value/substance", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Substance of measured_value." 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/config_lock_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/lock", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": false, 8 | "description": "Locks or unlocks the door lock." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_angle_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/angle", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The angle of an action in degrees." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_music_sync_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/music_sync", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": false, 8 | "description": "Music sync on or off." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_open_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/open_bis", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": false, 7 | "default": false, 8 | "description": "True when open is detected." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_pm2_5_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/pm2_5", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Measured PM2.5 density in µg/m³.", 8 | "default": 0 9 | } 10 | -------------------------------------------------------------------------------- /devices/xiaomi/0001_battery.js: -------------------------------------------------------------------------------- 1 | /* global Attr, R */ 2 | 3 | const vmin = 27 4 | const vmax = 30 5 | const v = Math.max(vmin, Math.min(Attr.val, vmax)) 6 | const bat = Math.round(((v - vmin) / (vmax - vmin)) * 100) 7 | R.item('config/battery').val = Math.max(0, Math.min(bat, 100)) 8 | -------------------------------------------------------------------------------- /devices/generic/items/attr_poweronct_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/poweronct", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 370, 8 | "description": "Ct value set when powered on." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_usertest_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/usertest", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": false, 8 | "description": "Activates the user test mode." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_speed_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/speed", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The fan speed for mains powered devices." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_water_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/water_bis", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": false, 7 | "default": false, 8 | "description": "True when water is detected." 9 | } 10 | -------------------------------------------------------------------------------- /cj/cj_all.c: -------------------------------------------------------------------------------- 1 | /* 2 | * CJ combined with extra modules 3 | */ 4 | 5 | #include "cj.c" 6 | #include "extra/cj_copy_ref_utf8.c" 7 | #include "extra/cj_ref_to_boolean.c" 8 | #include "extra/cj_ref_to_double.c" 9 | #include "extra/cj_ref_to_long.c" 10 | #include "extra/cj_ref_to_null.c" 11 | -------------------------------------------------------------------------------- /devices/generic/items/attr_name_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/name", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "implicit": true, 8 | "managed": true, 9 | "description": "Name of the resource." 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/attr_poweronlevel_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/poweronlevel", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "default": 254, 8 | "description": "Brightness set when powered on." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/attr_type_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/type", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "managed": true, 9 | "description": "Type of the resource." 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/config_pending_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/pending", 4 | "datatype": "Array", 5 | "access": "R", 6 | "public": true, 7 | "managed": true, 8 | "description": "Pending tasks to configure the device." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_selftest_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/selftest", 4 | "datatype": "Bool", 5 | "access": "W", 6 | "public": true, 7 | "description": "Activates the device self-test mode.", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_sensitivity_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/sensitivity_bis", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": false, 7 | "default": 0, 8 | "description": "The sensor sensitivity." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_speed_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/speed", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "Motor speed for window covering devices." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_airqualityppb_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/airqualityppb", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Measured tVOC level in ppb." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_buttonevent_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/buttonevent", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The last received button event." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_deviceruntime_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/deviceruntime", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Device run time in minutes." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_filterruntime_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/filterruntime", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Filter run time in minutes." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_orientation_x_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/orientation_x", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The X orientation of a gyro." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_orientation_y_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/orientation_y", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The Y orientation of a gyro." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_orientation_z_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/orientation_z", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The Z orientation of a gyro." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_pressure_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/pressure_bis", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": false, 7 | "default": 0, 8 | "description": "The current air pressure (hPa)." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_rotaryevent_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/rotaryevent", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The last received rotary event." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_targetdistance_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/targetdistance", 4 | "description": "Distance from detected target", 5 | "datatype": "Int16", 6 | "access": "R", 7 | "public": true, 8 | "default": 0 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/attr_swversion_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/swversion_bis", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "description": "Firmware version of the device." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_delay_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/delay", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The occupied to unoccupied delay in seconds." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_ledindication_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/ledindication", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Activates the LED indicator.", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_offset_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/offset", 4 | "datatype": "Int16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "Relative offset to the main measured value." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_setvalve_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/setvalve", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Enable or disable the valve control.", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_airquality_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/airquality_bis", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": false, 7 | "description": "Text representation of the air quality based on tVOC level." 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/state_charging_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/charging", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": false, 8 | "description": "True when device is charging the battery." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_distance_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/distance", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Distance at which occupancy was detected." 9 | } 10 | -------------------------------------------------------------------------------- /linux/deCONZ/lib/systemd/system/deconz-homebridge.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=deCONZ: ZigBee gateway -- homebridge Service 3 | 4 | [Service] 5 | ExecStart=/usr/bin/deCONZ-homebridge.sh 6 | Restart=on-failure 7 | StartLimitInterval=600 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | -------------------------------------------------------------------------------- /devices/fireangel/0019_swversion.js: -------------------------------------------------------------------------------- 1 | /* global Attr, Item */ 2 | const v = Attr.val 3 | Item.val = (v & 0x000000ff).toString() + '.' + 4 | ((v & 0x0000ff00) >> 8).toString() + '.' + 5 | ((v & 0x00ff0000) >> 16).toString() + '.' + 6 | ((v & 0xff000000) >> 24).toString() 7 | -------------------------------------------------------------------------------- /devices/generic/items/config_configured_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/configured", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "default": false, 8 | "description": "Determines that a resource is configured." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_fadingtime_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/fadingtime", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Target disapperance delay time in seconds", 8 | "default": 0 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_interlock_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/interlock", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": false, 8 | "description": "Prevent the use of 2 relays in same time." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_airqualityppb_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/airqualityppb_bis", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": false, 7 | "default": 0, 8 | "description": "Measured tVOC level in ppb." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_eventduration_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/eventduration", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Determines how long an event lasted." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_humidity_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/humidity_bis", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": false, 7 | "default": 0, 8 | "description": "The current relative humidity in percent." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/cap_groups_not_supported_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/groups/not_supported", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "_Groups_ cluster does not work.", 8 | "static": true 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/cap_measured_value_max_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/measured_value/max", 4 | "datatype": "Double", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Maximum value of state/measured_value." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/cap_measured_value_min_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/measured_value/min", 4 | "datatype": "Double", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Minimum value of state/measured_value." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_reversed_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/reversed", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Direction is reversed for window covering devices.", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_heating_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/heating", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "default": false, 8 | "description": "Determines heating state for ELKO Super TR thermostat." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_mountingmodeactive_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/mountingmodeactive", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "default": false, 8 | "description": "The current mounting mode state." 9 | } 10 | -------------------------------------------------------------------------------- /devices/dresden_elektronik/lighting_switch_on.js: -------------------------------------------------------------------------------- 1 | var i = R.item("state/buttonevent"); 2 | if (ZclFrame.cmd == 1) { 3 | i.val = (SrcEp == 1) ? 1002 : 3002; 4 | } else if (ZclFrame.cmd == 0) { 5 | i.val = (SrcEp == 1) ? 2002 : 4002; 6 | } 7 | if (SrcEp == 2) { 8 | R.item("attr/mode").val = 2; 9 | } 10 | -------------------------------------------------------------------------------- /devices/dresden_elektronik/scene_switch_bri.js: -------------------------------------------------------------------------------- 1 | var i = R.item("state/buttonevent"); 2 | if (ZclFrame.cmd == 1) { 3 | if (ZclFrame.at(0) == 0) 4 | i.val = 1001; 5 | else 6 | i.val = 2001; 7 | } else if (ZclFrame.cmd == 3) { 8 | var v = i.val >> 2; 9 | i.val = ((v << 2) / 1000) * 1000 + 3; 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/attr_uniqueid_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/uniqueid", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "managed": true, 9 | "description": "Unique identifier of the resource." 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/config_displayflipped_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/displayflipped", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": false, 8 | "description": "Displayed content is normal or upside down." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_enrolled_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/enrolled", 4 | "datatype": "UInt32", 5 | "access": "RW", 6 | "public": false, 7 | "managed": true, 8 | "default": 0, 9 | "description": "State of IAS enrollment process." 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/state_measured_value_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/measured_value", 4 | "datatype": "Double", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Represents the concentration as a fraction of 1." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_presenceevent_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/presenceevent", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Describes what current activity is associated with the current presence state" 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/state_replacefilter_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/replacefilter", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "default": false, 8 | "description": "True when device filter needs to be replaced." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_temperature_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/temperature_bis", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": false, 7 | "default": 0, 8 | "description": "The current temperature in °C × 100." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/cap_alert_trigger_effect_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/alert/trigger_effect", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "Device supports the _Trigger Effect_ command.", 8 | "static": true 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/cap_on_off_with_effect_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/on/off_with_effect", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": false, 7 | "description": "Device supports the _Off with Effect_ command.", 8 | "static": true 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_allowtouchlink_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/allowtouchlink", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": false, 7 | "default": false, 8 | "description": "When true the device can initiate touchlink." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_windowopen_set_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/windowopen_set", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Enable or disable the window open detection.", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /resource/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_library (resource 3 | ../resource.h 4 | ../resource.cpp 5 | ../state_change.h 6 | ../state_change.cpp 7 | ) 8 | 9 | target_link_libraries(resource PUBLIC deconz_common) 10 | 11 | target_include_directories (resource PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) 12 | -------------------------------------------------------------------------------- /devices/generic/items/attr_id_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/id", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": false, 7 | "implicit": true, 8 | "managed": true, 9 | "description": "Identifier of the resource, unique within an endpoint." 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/cap_transition_block_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/transition_block", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "Device ignores new commands while transition is active.", 8 | "static": true 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_mountingmode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/mountingmode", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": false, 8 | "description": "Determines if the device has entered the mounting state." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_reportgrid_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/reportgrid", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Report detailed presence detection grid data (e.g. Aqara FP1).", 8 | "default": true 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_lastcheckin_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/lastcheckin", 4 | "datatype": "ISO 8601 timestamp", 5 | "access": "R", 6 | "public": false, 7 | "managed": true, 8 | "description": "Timestamp of last Poll Control cluster checkin." 9 | } 10 | -------------------------------------------------------------------------------- /linux/deCONZ/lib/systemd/system/deconz-homebridge-install.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=deCONZ: ZigBee gateway -- homebridge install Service 3 | 4 | [Service] 5 | ExecStart=/usr/bin/deCONZ-homebridge-install.sh 6 | Restart=on-failure 7 | StartLimitInterval=600 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | -------------------------------------------------------------------------------- /devices/generic/items/attr_lastseen_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/lastseen", 4 | "datatype": "ISO 8601 timestamp", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "managed": true, 9 | "description": "Timestamp of the last communication." 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/config_externalwindowopen_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/externalwindowopen", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": false, 8 | "description": "The window state detected by an external sensor." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_expectedrotation_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/expectedrotation", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The expected rotation of the last received rotary event." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_seconds_remaining_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/seconds_remaining", 4 | "datatype": "UInt32", 5 | "access": "RW", 6 | "public": true, 7 | "managed": true, 8 | "description": "The IAS panel seconds remaining.", 9 | "default": 0 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/cap_bri_move_with_onoff_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/bri/move_with_onoff", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": false, 7 | "description": "Device supports the _Move to Level (with On/Off)_ command.", 8 | "static": true 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_ct_computes_xy_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/ct/computes_xy", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "Light computes and updates `xy` value when setting `ct`.", 8 | "static": true 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_color_gradient_pixel_count_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/color/gradient/pixel_count", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "Number of pixels on Aqara LED Strip T1." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_tiltangle_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/tiltangle", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 360 10 | ], 11 | "default": 0, 12 | "description": "The current tilt angle." 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_on_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/on", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": true, 8 | "implicit": true, 9 | "managed": true, 10 | "description": "When true the sensor is enabled in rules." 11 | } 12 | -------------------------------------------------------------------------------- /devices/generic/items/config_resetpresence_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/resetpresence", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Reset the presence state for devices supporting it (e.g. Aqara FP1).", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_sensitivity_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/sensitivity", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 255 10 | ], 11 | "description": "The sensor sensitivity.", 12 | "default": 0 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/state_expectedeventduration_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/expectedeventduration", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The expected duration of the last received rotary event." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_gradient_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/gradient", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "managed": true, 8 | "description": "The currently active gradient (for Hue Gradient lights).", 9 | "default": "{}" 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/state_lastupdated_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/lastupdated", 4 | "datatype": "ISO 8601 timestamp", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "managed": true, 9 | "description": "Timestamp when state was last updated." 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/state_test_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/test", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "True when a test is detected.", 8 | "parse": { 9 | "fn": "ias:zonestatus" 10 | }, 11 | "default": false 12 | } 13 | -------------------------------------------------------------------------------- /devices/generic/items/config_windowopendetectionenabled_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/windowopendetectionenabled", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Turns the window open detection feature on or off.", 8 | "default": true 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/attr_lastannounced_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/lastannounced", 4 | "datatype": "ISO 8601 timestamp", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "managed": true, 9 | "description": "Timestamp of the last power-cyle or rejoin." 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/cap_sleeper_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/sleeper", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": false, 7 | "default": false, 8 | "description": "Says if the device is always listening, or can sleep and only receive when event.awake is emitted." 9 | } 10 | -------------------------------------------------------------------------------- /devices/develco/develco_battery.js: -------------------------------------------------------------------------------- 1 | const vmin = 26; 2 | const vmax = 30; 3 | let bat = Attr.val; 4 | 5 | if (bat > vmax) { bat = vmax; } 6 | else if (bat < vmin) { bat = vmin; } 7 | 8 | bat = ((bat - vmin) /(vmax - vmin)) * 100; 9 | 10 | if (bat > 100) { bat = 100; } 11 | else if (bat <= 0) { bat = 1; } // ? 12 | 13 | Item.val = bat; -------------------------------------------------------------------------------- /devices/frient/develco_battery.js: -------------------------------------------------------------------------------- 1 | const vmin = 26; 2 | const vmax = 30; 3 | let bat = Attr.val; 4 | 5 | if (bat > vmax) { bat = vmax; } 6 | else if (bat < vmin) { bat = vmin; } 7 | 8 | bat = ((bat - vmin) /(vmax - vmin)) * 100; 9 | 10 | if (bat > 100) { bat = 100; } 11 | else if (bat <= 0) { bat = 1; } // ? 12 | 13 | Item.val = bat; -------------------------------------------------------------------------------- /devices/generic/items/config_interfacemode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/interfacemode", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Sets the protocol used for processing metering data.", 8 | "default": 0, 9 | "refresh.interval": 86400 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/config_sensitivitymax_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/sensitivitymax", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 255 10 | ], 11 | "default": 0, 12 | "description": "The maximum sensor sensitivity." 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_temperature_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/temperature", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 255 10 | ], 11 | "default": 0, 12 | "description": "The current device temperature in °C." 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_triggerdistance_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/triggerdistance", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "A device specific distance setting when it triggers the associated function (e.g. detect presence or motion)." 8 | } 9 | -------------------------------------------------------------------------------- /device_js/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_library (device_js 3 | device_js.h 4 | device_js.cpp 5 | device_js_wrappers.h 6 | device_js_wrappers.cpp 7 | ) 8 | 9 | target_link_libraries(device_js 10 | PUBLIC deconz_common 11 | PUBLIC resource 12 | ) 13 | 14 | target_include_directories (device_js PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 15 | -------------------------------------------------------------------------------- /devices/bosch/bosch_battery.js: -------------------------------------------------------------------------------- 1 | const vmin = 26; 2 | const vmax = 30; 3 | let bat = Attr.val; 4 | 5 | if (bat > vmax) { bat = vmax; } 6 | else if (bat < vmin) { bat = vmin; } 7 | 8 | bat = ((bat - vmin) /(vmax - vmin)) * 100; 9 | 10 | if (bat > 100) { bat = 100; } 11 | else if (bat <= 0) { bat = 1; } // ? 12 | 13 | Item.val = bat; 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_detectionrange_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/detectionrange", 4 | "datatype": "UInt32", 5 | "access": "RW", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 600 10 | ], 11 | "description": "The sensor detection range in cm.", 12 | "default": 0 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_loadbalancing_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/loadbalancing", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Thermostat runs stand alone (false) or shares load with others in the same room (true).", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/config_reachable_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/reachable", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "managed": true, 9 | "default": false, 10 | "description": "When true the device is assumed to be operational." 11 | } 12 | -------------------------------------------------------------------------------- /devices/generic/items/config_triggerdistance_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/triggerdistance_bis", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": false, 7 | "description": "A device specific distance setting when it triggers the associated function (e.g. detect presence or motion)." 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/state_reachable_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/reachable", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "managed": true, 9 | "default": false, 10 | "description": "When true the device is assumed to be operational." 11 | } 12 | -------------------------------------------------------------------------------- /devices/dresden_elektronik/lighting_switch_bri.js: -------------------------------------------------------------------------------- 1 | var i = R.item("state/buttonevent"); 2 | if (ZclFrame.cmd == 1) { 3 | if (ZclFrame.at(0) == 0) 4 | i.val = (SrcEp == 1) ? 1001 : 3001; 5 | else 6 | i.val = (SrcEp == 1) ? 2001 : 4001; 7 | } else if (ZclFrame.cmd == 3) { 8 | var v = i.val >> 2; 9 | i.val = ((v << 2) / 1000) * 1000 + 3; 10 | } 11 | -------------------------------------------------------------------------------- /devices/dresden_elektronik/lighting_switch_scenes.js: -------------------------------------------------------------------------------- 1 | var i = R.item("state/buttonevent"); 2 | if (ZclFrame.cmd == 5) { 3 | if (ZclFrame.at(2) == 1) 4 | i.val = 3002; 5 | else 6 | i.val = 4002; 7 | } else if (ZclFrame.cmd == 4) { 8 | if (ZclFrame.at(2) == 1) 9 | i.val = 3003; 10 | else 11 | i.val = 4003; 12 | } 13 | R.item("attr/mode").val = 1; -------------------------------------------------------------------------------- /devices/generic/items/config_battery_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/battery", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 100 10 | ], 11 | "description": "The current device battery level in 0–100 %.", 12 | "default": 0 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_coolsetpoint_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/coolsetpoint", 4 | "datatype": "Int16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "Target cooling temperature of a thermostat.", 9 | "range": [ 10 | 500, 11 | 3200 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/state_lightlevel_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/lightlevel", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 65534 10 | ], 11 | "description": "The current Light level in 10000 log10 (lux) + 1.", 12 | "default": 0 13 | } 14 | -------------------------------------------------------------------------------- /devices/philips/fc00_rotaryevent.js: -------------------------------------------------------------------------------- 1 | /* global Item, R, ZclFrame */ 2 | 3 | if (ZclFrame.at(2) === 0x01) { 4 | Item.val = ZclFrame.at(4) 5 | R.item('state/expectedeventduration').val = ZclFrame.at(22) << 8 | ZclFrame.at(21) 6 | const v = ZclFrame.at(13) << 8 | ZclFrame.at(12) 7 | R.item('state/expectedrotation').val = v > 0x7FFF ? v - 0x10000 : v 8 | } 9 | -------------------------------------------------------------------------------- /devices/xiaomi/xiaomi_known_issues_difficult_pairing.md: -------------------------------------------------------------------------------- 1 | 2 | ### Difficult pairing 3 | 4 | To pair the sensor it needs to be reset first, by pressing the pin-hole button for 10 seconds. 5 | 6 | Then after starting sensor search, press the button again until the LED blinks. 7 | Finally continuously press the button every 2 seconds until joining is confirmed. 8 | -------------------------------------------------------------------------------- /devices/generic/items/state_dark_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/dark", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "True when lightlevel is lower than tholddark.", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_fire_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/fire", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "default": false, 8 | "description": "True when fire is detected.", 9 | "parse": { 10 | "fn": "ias:zonestatus", 11 | "mask": "alarm1,alarm2" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/state_open_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/open", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "default": false, 8 | "description": "True when open is detected.", 9 | "parse": { 10 | "fn": "ias:zonestatus", 11 | "mask": "alarm1,alarm2" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/state_tampered_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/tampered", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "default": false, 8 | "description": "True when the device tampered alarm was triggered.", 9 | "parse": { 10 | "fn": "ias:zonestatus" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /devices/generic/items/state_vibrationstrength_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/vibrationstrength", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 65535 10 | ], 11 | "default": 0, 12 | "description": "The strength of the detected vibration." 13 | } 14 | -------------------------------------------------------------------------------- /devices/computime-salus/computime_battery.js: -------------------------------------------------------------------------------- 1 | const vmin = 26; 2 | const vmax = 30; 3 | let bat = Attr.val; 4 | 5 | if (bat > vmax) { bat = vmax; } 6 | else if (bat < vmin) { bat = vmin; } 7 | 8 | bat = ((bat - vmin) /(vmax - vmin)) * 100; 9 | 10 | if (bat > 100) { bat = 100; } 11 | else if (bat <= 0) { bat = 1; } // ? 12 | 13 | Item.val = bat; 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_battery_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/battery_bis", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": false, 7 | "range": [ 8 | 0, 9 | 100 10 | ], 11 | "default": 0, 12 | "description": "The current device battery level in 0–100 %." 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_externalsensortemp_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/externalsensortemp", 4 | "datatype": "Int16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The temperature measured by an external sensor, can be used for regulation or displayed on screen." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_water_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/water", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "default": false, 8 | "description": "True when water is detected.", 9 | "parse": { 10 | "fn": "ias:zonestatus", 11 | "mask": "alarm1,alarm2" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_duration_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/duration", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 65535 10 | ], 11 | "default": 60, 12 | "description": "The duration until presence is automatically turned back to false." 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_filterlifetime_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/filterlifetime", 4 | "datatype": "UInt32", 5 | "access": "RW", 6 | "public": true, 7 | "default": 259200, 8 | "description": "Filter life time in minutes (default: 6 months). Set this to indicate that the filter has been replaced." 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/items/state_alarm_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/alarm", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "True when an alarm is detected.", 8 | "default": false, 9 | "parse": { 10 | "fn": "ias:zonestatus", 11 | "mask": "alarm1,alarm2" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/subdevices/range_extender.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_RANGE_EXTENDER", 4 | "name": "Range extender", 5 | "ui_name": "Range extender", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/reachable" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /devices/generic/items/state_lowbattery_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/lowbattery", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "managed": true, 8 | "default": false, 9 | "description": "True when the device battery runs low.", 10 | "parse": { 11 | "fn": "ias:zonestatus" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/state_presence_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/presence", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "True when presence is detected.", 8 | "parse": { 9 | "fn": "ias:zonestatus", 10 | "mask": "alarm1,alarm2" 11 | }, 12 | "default": false 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/state_vibration_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/vibration", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "default": false, 8 | "description": "True when vibration is detected.", 9 | "parse": { 10 | "fn": "ias:zonestatus", 11 | "mask": "alarm1,alarm2" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/subdevices/smart_plug.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_SMART_PLUG", 4 | "name": "Smart plug", 5 | "ui_name": "Smart plug", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/on", 14 | "state/reachable" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /devices/danfoss/danfoss_errorcode.js: -------------------------------------------------------------------------------- 1 | var error = []; 2 | 3 | if (Attr.val == 0) 4 | { 5 | error.push("none"); 6 | } 7 | else 8 | { 9 | for (i = 0; i < 15; i++) 10 | { 11 | if (Attr.val >> i & 0x01) 12 | { 13 | error.push("E" + (i + 1)); 14 | } 15 | } 16 | } 17 | 18 | var res = error.join(","); 19 | Item.val = res.toString(16); 20 | -------------------------------------------------------------------------------- /devices/generic/items/config_pulseconfiguration_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/pulseconfiguration", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Pulse Configuration represents the number of pulses the meter outputs per unit.", 8 | "default": 0, 9 | "refresh.interval": 86400 10 | } 11 | -------------------------------------------------------------------------------- /devices/generic/items/config_radiatorcovered_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/radiatorcovered", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Radiator is standing freely (false) or is covered (true). Set this to true for Danfoss Ally to use external temp sensor.", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /resourcelinks.cpp: -------------------------------------------------------------------------------- 1 | #include "resourcelinks.h" 2 | 3 | Resourcelinks::Resourcelinks() : 4 | state(StateNormal), 5 | m_needSaveDatabase(false) 6 | { 7 | } 8 | 9 | bool Resourcelinks::needSaveDatabase() const 10 | { 11 | return m_needSaveDatabase; 12 | } 13 | 14 | void Resourcelinks::setNeedSaveDatabase(bool needSave) 15 | { 16 | m_needSaveDatabase = needSave; 17 | } 18 | -------------------------------------------------------------------------------- /devices/generic/items/state_carbonmonoxide_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/carbonmonoxide", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "True when carbonmonoxide is detected.", 8 | "parse": { 9 | "fn": "ias:zonestatus", 10 | "mask": "alarm1,alarm2" 11 | }, 12 | "default": false 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/subdevices/on_off_output.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_ON_OFF_OUTPUT", 4 | "name": "On/Off output", 5 | "ui_name": "On/off output", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/on", 14 | "state/reachable" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/on_off_switch.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_ON_OFF_SWITCH", 4 | "name": "On/Off switch", 5 | "ui_name": "On/off switch", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/on", 14 | "state/reachable" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/warning_device.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_WARNING_DEVICE", 4 | "name": "Warning device", 5 | "ui_name": "Warning device", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/alert", 14 | "state/reachable" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/items/config_clickmode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/clickmode", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Allows configuration of the individual Button(s), primarily for Xiaomi devices. Current usable values (device dependent) are 'coupled', 'decoupled', 'multiclick' and 'highspeed'." 8 | } 9 | -------------------------------------------------------------------------------- /devices/ikea/starkvind_parse_target_mode.js: -------------------------------------------------------------------------------- 1 | /* global Attr, Item */ 2 | 3 | let mode = Attr.val 4 | 5 | if (mode === 0) mode = 'off' 6 | else if (mode === 1) mode = 'auto' 7 | else if (mode <= 10) mode = 'speed_1' 8 | else if (mode <= 20) mode = 'speed_2' 9 | else if (mode <= 30) mode = 'speed_3' 10 | else if (mode <= 40) mode = 'speed_4' 11 | else mode = 'speed_5' 12 | 13 | Item.val = mode 14 | -------------------------------------------------------------------------------- /devices/generic/subdevices/on_off_plugin_unit.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_ON_OFF_PLUGIN_UNIT", 4 | "name": "On/Off plug-in unit", 5 | "ui_name": "On/off plug-in unit", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/on", 14 | "state/reachable" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/door_lock_controller.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_DOOR_LOCK_CONTROLLER", 4 | "name": "Door Lock Controller", 5 | "ui_name": "Door lock controller", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/reachable", 14 | "state/on" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/items/state_y_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/y", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The current color y coordinate.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 255, 12 | "cl": "0x0300", 13 | "at": "0x0004", 14 | "eval": "Item.val = Attr.val" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/level_control_switch.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_LEVEL_CONTROL_SWITCH", 4 | "name": "Level control switch", 5 | "ui_name": "Level control switch", 6 | "restapi": "/sensors", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0101" 12 | ], 13 | "items": [ 14 | "state/reachable", 15 | "state/on" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /devices/ikea/0400_lightlevel.js: -------------------------------------------------------------------------------- 1 | /* global Attr, Item, R */ 2 | 3 | const v = Attr.val 4 | const tholddark = R.item('config/tholddark').val 5 | const tholdoffset = R.item('config/tholdoffset').val 6 | 7 | Item.val = v 8 | R.item('state/dark').val = v <= tholddark 9 | R.item('state/daylight').val = v > tholddark + tholdoffset 10 | R.item('state/lux').val = Math.round(Math.pow(10, (Math.max(0, Math.min(v, 60001)) - 1) / 10000)) 11 | -------------------------------------------------------------------------------- /devices/philips/0400_lightlevel.js: -------------------------------------------------------------------------------- 1 | /* global Attr, Item, R */ 2 | 3 | const v = Attr.val 4 | const tholddark = R.item('config/tholddark').val 5 | const tholdoffset = R.item('config/tholdoffset').val 6 | 7 | Item.val = v 8 | R.item('state/dark').val = v <= tholddark 9 | R.item('state/daylight').val = v > tholddark + tholdoffset 10 | R.item('state/lux').val = Math.round(Math.pow(10, (Math.max(0, Math.min(v, 60001)) - 1) / 10000)) 11 | -------------------------------------------------------------------------------- /devices/b-parasite/0400_lightlevel.js: -------------------------------------------------------------------------------- 1 | /* global Attr, Item, R */ 2 | 3 | const v = Attr.val 4 | const tholddark = R.item('config/tholddark').val 5 | const tholdoffset = R.item('config/tholdoffset').val 6 | 7 | Item.val = v 8 | R.item('state/dark').val = v <= tholddark 9 | R.item('state/daylight').val = v > tholddark + tholdoffset 10 | R.item('state/lux').val = Math.round(Math.pow(10, (Math.max(0, Math.min(v, 60001)) - 1) / 10000)) 11 | -------------------------------------------------------------------------------- /devices/danfoss/danfoss_windowopen_state.js: -------------------------------------------------------------------------------- 1 | switch (Attr.val) { 2 | case 0: 3 | Item.val = "quarantine"; 4 | break; 5 | case 1: 6 | Item.val = "closed"; 7 | break; 8 | case 2: 9 | Item.val = "hold"; 10 | break; 11 | case 3: 12 | Item.val = "open"; 13 | break; 14 | case 4: 15 | Item.val = "open (external), closed (internal)"; 16 | break; 17 | } -------------------------------------------------------------------------------- /devices/generic/items/attr_modelid_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/modelid", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "description": "Model identifier of the device.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 255, 12 | "cl": "0x0000", 13 | "at": "0x0005", 14 | "eval": "Item.val = Attr.val" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/dimmable_plugin_unit.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_DIMMABLE_PLUGIN_UNIT", 4 | "name": "Dimmable plug-in unit", 5 | "ui_name": "Dimmable plug-in unit", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/bri", 14 | "state/reachable", 15 | "state/on" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /devices/generic/items/config_controlsequence_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/controlsequence", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 5 10 | ], 11 | "default": 0, 12 | "description": "Specifies the overall operating environment of the thermostat, and thus the possible system modes that the thermostat can operate in." 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/config_tholddark_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/tholddark", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 65534 10 | ], 11 | "default": 12000, 12 | "description": "Specifies at which lightlevel the dark attribute turns false." 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/items/state_daylight_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/daylight", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": true, 7 | "description": "True when lightlevel suits daylight according tholddark and tholdoffset configuration.", 8 | "default": false 9 | } 10 | -------------------------------------------------------------------------------- /devices/generic/subdevices/switch.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_SWITCH", 4 | "name": "ZHASwitch", 5 | "ui_name": "Switch", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0000" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/lastupdated", 17 | "state/buttonevent" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /devices/generic/subdevices/fire_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_FIRE_SENSOR", 4 | "name": "ZHAFire", 5 | "ui_name": "Fire sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0500" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/fire", 17 | "state/lastupdated" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /devices/generic/subdevices/window_covering_device.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_WINDOW_COVERING_DEVICE", 4 | "name": "Window covering device", 5 | "ui_name": "Window covering device", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/lift", 14 | "state/open", 15 | "state/reachable" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /devices/generic/subdevices/zgp_switch.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_ZGP_SWITCH", 4 | "name": "ZGPSwitch", 5 | "ui_name": "Switch", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0000" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/buttonevent", 17 | "state/lastupdated" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /xiaomi.h: -------------------------------------------------------------------------------- 1 | #ifndef XIAOMI_H 2 | #define XIAOMI_H 3 | 4 | #define XIAOMI_ATTRID_DEVICE_MODE 0x0009 5 | #define XIAOMI_ATTRID_SPECIAL_REPORT 0x00F7 6 | #define XIAOMI_ATTRID_MOTION_SENSITIVITY 0x010C 7 | #define XIAOMI_ATTRID_P1_MOTION_DETECTION 0x0112 8 | #define XIAOMI_ATTRID_MULTICLICK_MODE 0x0125 9 | #define XIAOMI_ATTRID_SPEED 0x0408 10 | #define XIAOMI_ATTRID_CHARGING 0x0409 11 | 12 | #endif // XIAOMI_H 13 | -------------------------------------------------------------------------------- /devices/generic/items/attr_manufacturername_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/manufacturername", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "description": "Manufacturer name of the device.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 255, 12 | "cl": "0x0000", 13 | "at": "0x0004", 14 | "eval": "Item.val = Attr.val" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_xy_blue_x_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/xy/blue_x", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "X coordinate of blue point of color gamut.", 8 | "default": 0, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x003a", 14 | "eval": "Item.val = Attr.val" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_xy_blue_y_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/xy/blue_y", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Y coordinate of blue point of color gamut.", 8 | "default": 0, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x003b", 14 | "eval": "Item.val = Attr.val" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_xy_red_y_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/xy/red_y", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Y coordinate of red point of color gamut.", 8 | "default": 0, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x0033", 14 | "eval": "Item.val = Attr.val" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/time.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_TIME", 4 | "name": "ZHATime", 5 | "ui_name": "Time", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x000a" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/lastupdated", 17 | "state/localtime", 18 | "state/utc" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_xy_green_x_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/xy/green_x", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "X coordinate of green point of color gamut.", 8 | "default": 0, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x0036", 14 | "eval": "Item.val = Attr.val" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/battery_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_BATTERY_SENSOR", 4 | "name": "ZHABattery", 5 | "ui_name": "Battery sensor", 6 | "restapi": "/sensors", 7 | "order": 30, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0001" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/battery", 17 | "state/lastupdated" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_xy_green_y_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/xy/green_y", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Y coordinate of green point of color gamut.", 8 | "default": "0xfeff", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x0037", 14 | "eval": "Item.val = Attr.val" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/items/state_flow_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/flow", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": true, 7 | "description": "The current relative flow in dm3/h.", 8 | "parse": { 9 | "at": "0x0000", 10 | "cl": "0x0404", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val * 100 + R.item('config/offset').val", 13 | "fn": "zcl:attr" 14 | }, 15 | "default": 0 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/items/state_pressure_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/pressure", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": true, 7 | "description": "The current air pressure (hPa).", 8 | "parse": { 9 | "at": "0x0000", 10 | "cl": "0x0403", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val + R.item('config/offset').val", 13 | "fn": "zcl:attr" 14 | }, 15 | "default": 0 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/water_leak_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_WATER_LEAK_SENSOR", 4 | "name": "ZHAWater", 5 | "ui_name": "Water leak sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0500" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/water", 17 | "state/lastupdated" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /devices/ikea/starkvind_write_target_mode.js: -------------------------------------------------------------------------------- 1 | /* global Item */ 2 | 3 | let mode = Item.val 4 | 5 | if (mode === 'off') mode = 0 6 | else if (mode === 'auto') mode = 1 7 | else if (mode === 'speed_1') mode = 10 8 | else if (mode === 'speed_2') mode = 20 9 | else if (mode === 'speed_3') mode = 30 10 | else if (mode === 'speed_4') mode = 40 11 | else if (mode === 'speed_5') mode = 50 12 | else mode = 0 13 | 14 | /* eslint-disable no-unused-expressions */ 15 | mode 16 | -------------------------------------------------------------------------------- /ui/ddf_itemlist.h: -------------------------------------------------------------------------------- 1 | #ifndef DDF_ITEMLIST_H 2 | #define DDF_ITEMLIST_H 3 | 4 | #include 5 | 6 | class DDF_ItemListPrivate; 7 | class DeviceDescriptions; 8 | 9 | class DDF_ItemList : public QListView 10 | { 11 | public: 12 | DDF_ItemList(QWidget *parent = nullptr); 13 | ~DDF_ItemList(); 14 | 15 | void update(DeviceDescriptions *dd); 16 | 17 | private: 18 | DDF_ItemListPrivate *d = nullptr; 19 | }; 20 | 21 | #endif // DDF_ITEMLIST_H 22 | -------------------------------------------------------------------------------- /devices/generic/items/config_devicemode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/devicemode", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Mode of the Hue wall switch module with possible values 'singlerocker', 'singlepushbutton', 'dualrocker', 'dualpushbutton'. Xiaomi devices have possible values of 'compatibility' and 'zigbee', but DO NOT CHANGE UNLESS YOU KNOW EXACTLY, WHAT YOU'RE DOING" 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/state_utc_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/utc", 4 | "datatype": "ISO 8601 timestamp", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Current timestamp in UTC set on the device.", 8 | "parse": { 9 | "fn": "time" 10 | }, 11 | "read": { 12 | "at": "0x0000", 13 | "cl": "0x000A", 14 | "ep": 0, 15 | "fn": "zcl:attr" 16 | }, 17 | "refresh.interval": 3600 18 | } 19 | -------------------------------------------------------------------------------- /devices/generic/subdevices/on_off_light.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_ON_OFF_LIGHT", 4 | "name": "On/Off light", 5 | "ui_name": "On/off light", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/on", 14 | "state/reachable" 15 | ], 16 | "items_optional": [ 17 | "config/on/startup", 18 | "state/alert" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /devices/generic/subdevices/open_close_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_OPEN_CLOSE_SENSOR", 4 | "name": "ZHAOpenClose", 5 | "ui_name": "Open/close sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0500" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/open", 17 | "state/lastupdated" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /devices/generic/subdevices/vibration_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_VIBRATION_SENSOR", 4 | "name": "ZHAVibration", 5 | "ui_name": "Vibration sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0000" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/vibration", 17 | "state/lastupdated" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /devices/tuya/lux_to_lightlevel_50.js: -------------------------------------------------------------------------------- 1 | const tholddark = R.item('config/tholddark').val; 2 | const tholdoffset = R.item('config/tholdoffset').val; 3 | const lux = Attr.val/50; 4 | var ll = 0; 5 | 6 | if (lux > 0 && lux < 0xffff) { 7 | ll = Math.round(10000 * Math.log10(lux) + 1); 8 | } 9 | 10 | R.item('state/lightlevel').val = ll; 11 | R.item('state/dark').val = ll <= tholddark; 12 | R.item('state/daylight').val = ll >= tholddark + tholdoffset; 13 | 14 | Item.val = lux; -------------------------------------------------------------------------------- /crypto/random.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef RANDOM_H 12 | #define RANDOM_H 13 | 14 | void CRYPTO_RandomBytes(unsigned char *buf, unsigned int size); 15 | 16 | #endif // RANDOM_H 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/door_lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_DOOR_LOCK", 4 | "name": "Door Lock", 5 | "ui_name": "Door Lock", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0101" 12 | ], 13 | "items": [ 14 | "config/lock", 15 | "state/open", 16 | "state/lockstate" 17 | ], 18 | "items_optional": [ 19 | "state/reachable" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /devices/xiaomi/0101_orientation.js: -------------------------------------------------------------------------------- 1 | /* global Attr, R */ 2 | 3 | const x = Attr.val << 16 >> 16 4 | const y = Attr.val >> 16 5 | const z = (Attr.val / 0x10000) >> 16 6 | R.item('state/orientation_x').val = Math.round(Math.atan(x / Math.sqrt(z * z + y * y)) * 180 / Math.PI) 7 | R.item('state/orientation_y').val = Math.round(Math.atan(y / Math.sqrt(x * x + z * z)) * 180 / Math.PI) 8 | R.item('state/orientation_z').val = Math.round(Math.atan(z / Math.sqrt(x * x + y * y)) * 180 / Math.PI) 9 | -------------------------------------------------------------------------------- /devices/generic/items/config_devicemode_bis_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/devicemode_bis", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": false, 7 | "description": "Mode of the Hue wall switch module with possible values 'singlerocker', 'singlepushbutton', 'dualrocker', 'dualpushbutton'. Xiaomi devices have possible values of 'compatibility' and 'zigbee', but DO NOT CHANGE UNLESS YOU KNOW EXACTLY, WHAT YOU'RE DOING" 8 | } 9 | -------------------------------------------------------------------------------- /devices/generic/items/state_humidity_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/humidity", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "The current relative humidity in 0.01 percent.", 8 | "parse": { 9 | "at": "0x0000", 10 | "cl": "0x0405", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val + R.item('config/offset').val", 13 | "fn": "zcl:attr" 14 | }, 15 | "default": 0 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/items/state_localtime_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/localtime", 4 | "datatype": "ISO 8601 timestamp", 5 | "access": "R", 6 | "public": true, 7 | "description": "The current local time set on the device.", 8 | "parse": { 9 | "fn": "time" 10 | }, 11 | "read": { 12 | "at": "0x0007", 13 | "cl": "0x000A", 14 | "ep": 0, 15 | "fn": "zcl:attr" 16 | }, 17 | "refresh.interval": 3600 18 | } 19 | -------------------------------------------------------------------------------- /devices/generic/items/state_temperature_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/temperature", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": true, 7 | "description": "The current temperature in °C × 100.", 8 | "parse": { 9 | "at": "0x0000", 10 | "cl": "0x0402", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val + R.item('config/offset').val", 13 | "fn": "zcl:attr" 14 | }, 15 | "default": 0 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/subdevices/consumption_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_CONSUMPTION_SENSOR", 4 | "name": "ZHAConsumption", 5 | "ui_name": "Consumption sensor", 6 | "restapi": "/sensors", 7 | "order": 22, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0702" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/consumption", 17 | "state/lastupdated" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /devices/ikea/ikea_known_issues_radio_silence.md: -------------------------------------------------------------------------------- 1 | ### Radio Silence 2 | 3 | All mains powered IKEA lights and repeaters have a bug that causes the device to not operate correctly anymore. The bug is triggered mostly in larger networks with many end-devices likely after receiving a Parent Announce message a few times. 4 | 5 | **Workaround:** To get the device back online it must be power-cycled. Which means cut the power for a few seconds. After that the device should work normally again. 6 | -------------------------------------------------------------------------------- /devices/generic/items/state_moisture_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/moisture", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "The current relative moisture in percent × 100.", 8 | "parse": { 9 | "at": "0x0000", 10 | "cl": "0x0408", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val + R.item('config/offset').val", 13 | "fn": "zcl:attr" 14 | }, 15 | "default": 0 16 | } 17 | -------------------------------------------------------------------------------- /devices/generic/items/config_ctmax_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/ctmax", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Deprecated. Maximum supported color temperature.", 8 | "deprecated": "2022-11-11", 9 | "default": "0xfeff", 10 | "parse": { 11 | "fn": "zcl:attr", 12 | "ep": 0, 13 | "cl": "0x0300", 14 | "at": "0x400c", 15 | "eval": "Item.val = Attr.val" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /devices/lutron/lutron_known_issues.md: -------------------------------------------------------------------------------- 1 | ### Compatibility 2 | 3 | The Lutron Aurora only works well with the Hue bridge. 4 | Its latest firmware, v3.8, won't work al all with the deCONZ REST API. 5 | You need to downgrade the firmware to 6 | [v3.4](http://fds.dc1.philips.com/firmware/ZGB_1144_0000/3040/Superman_v3_04_Release_3040.ota). 7 | Even then, the Aurora won't issue reports from the Hue-specific cluster FC00. 8 | Consequently, the REST API cannot generate advanced button and rotary events. 9 | -------------------------------------------------------------------------------- /devices/generic/illuminance_cluster/lux_to_lightlevel.js: -------------------------------------------------------------------------------- 1 | const tholddark = R.item('config/tholddark').val; 2 | const tholdoffset = R.item('config/tholdoffset').val; 3 | const lux = Attr.val; 4 | var ll = 0; 5 | 6 | if (lux > 0 && lux < 0xffff) { 7 | ll = Math.round(10000 * Math.log10(lux) + 1); 8 | } 9 | 10 | R.item('state/lightlevel').val = ll; 11 | R.item('state/dark').val = ll <= tholddark; 12 | R.item('state/daylight').val = ll >= tholddark + tholdoffset; 13 | 14 | Item.val = lux; 15 | -------------------------------------------------------------------------------- /devices/generic/items/state_lastset_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/lastset", 4 | "datatype": "ISO 8601 timestamp", 5 | "access": "R", 6 | "public": true, 7 | "description": "Timestamp when the time attribute was last set on the device.", 8 | "parse": { 9 | "fn": "time" 10 | }, 11 | "read": { 12 | "at": "0x0008", 13 | "cl": "0x000A", 14 | "ep": 0, 15 | "fn": "zcl:attr" 16 | }, 17 | "refresh.interval": 3600 18 | } 19 | -------------------------------------------------------------------------------- /devices/generic/subdevices/humidity_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_HUMIDITY_SENSOR", 4 | "name": "ZHAHumidity", 5 | "ui_name": "Humidity sensor", 6 | "restapi": "/sensors", 7 | "order": 23, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0405" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/offset", 16 | "config/reachable", 17 | "state/humidity", 18 | "state/lastupdated" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /devices/generic/subdevices/moisture_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_MOISTURE_SENSOR", 4 | "name": "ZHAMoisture", 5 | "ui_name": "Moisture sensor", 6 | "restapi": "/sensors", 7 | "order": 23, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0408" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/offset", 16 | "config/reachable", 17 | "state/moisture", 18 | "state/lastupdated" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /devices/generic/subdevices/pressure_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_PRESSURE_SENSOR", 4 | "name": "ZHAPressure", 5 | "ui_name": "Pressure sensor", 6 | "restapi": "/sensors", 7 | "order": 24, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0403" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/offset", 16 | "config/reachable", 17 | "state/pressure", 18 | "state/lastupdated" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_gamut_type_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/gamut_type", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Color gamut type for Hue lights.", 8 | "parse": { 9 | "fn": "zcl:attr", 10 | "ep": 0, 11 | "cl": "0x0300", 12 | "at": "0x0032", 13 | "eval": "Item.val = Attr.val === 45317 ? 'C' : Attr.val === 44236 ? 'B' : Attr.val === 46137 ? 'A' : ''" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /devices/generic/subdevices/carbonmonoxide_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_CARBONMONOXIDE_SENSOR", 4 | "name": "ZHACarbonMonoxide", 5 | "ui_name": "Carbon monoxide sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0500" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/carbonmonoxide", 17 | "state/lastupdated" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /devices/generic/items/config_tholdoffset_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/tholdoffset", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "range": [ 8 | 1, 9 | 65534 10 | ], 11 | "default": 7000, 12 | "description": "Relative offset to tholddark. Sets daylight attribute to true when when lightlevel is at or above (tholddark + tholdoffset)." 13 | } 14 | -------------------------------------------------------------------------------- /devices/generic/subdevices/temperature_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_TEMPERATURE_SENSOR", 4 | "name": "ZHATemperature", 5 | "ui_name": "Temperature sensor", 6 | "restapi": "/sensors", 7 | "order": 23, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0402" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/offset", 16 | "config/reachable", 17 | "state/temperature", 18 | "state/lastupdated" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /devices/terncy/terncy_sd01_known_issues.md: -------------------------------------------------------------------------------- 1 | ### Compatibility 2 | 3 | In order for the device to work properly, the [firmware](https://github.com/Koenkk/zigbee-OTA/raw/master/images/Terncy/TERNCY-SD01_v46.OTA) 4 | must be updated, as in earlier versions, there is no manufacturer name included. Additionally, it must be ensured that deconz exposes 5 | endpoint 6E through the coordinator. Please see [this](https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4728#issuecomment-860883260) 6 | post for guidance. -------------------------------------------------------------------------------- /devices/generic/items/cap_color_gradient_max_segments_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/gradient/max_segments", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Number of segments on Hue gradient light.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": "0x0b", 12 | "cl": "0xfc03", 13 | "mf": "0x100b", 14 | "at": "0x0036", 15 | "eval": "Item.val = Attr.val >> 3" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /devices/xiaomi/xiaomi_rtcgq14lm_lux_to_lightlevel.js: -------------------------------------------------------------------------------- 1 | const tholddark = R.item('config/tholddark').val; 2 | const tholdoffset = R.item('config/tholdoffset').val; 3 | const lux = (Attr.val - 65536); 4 | var ll = 0; 5 | 6 | if (lux > 0 && lux < 65520) { 7 | ll = Math.round(10000 * Math.log10(lux) + 1); 8 | } 9 | 10 | R.item('state/lightlevel').val = ll; 11 | R.item('state/dark').val = ll <= tholddark; 12 | R.item('state/daylight').val = ll >= tholddark + tholdoffset; 13 | 14 | Item.val = lux < 65520 ? lux : 0; 15 | -------------------------------------------------------------------------------- /linux/deCONZ/usr/bin/deCONZ-wait-for-X.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Wait for X server to start. 3 | 4 | LOG_ERROR="<3>" 5 | LOG_INFO="<6>" 6 | 7 | for ((i = 0; i < 120; i++)) ; do 8 | if [ -S /tmp/.X11-unix/X0 ] ; then 9 | echo "${LOG_INFO}X server started." 10 | sleep 3 11 | exit 0 12 | fi 13 | if ((i % 5 == 0)) ; then 14 | echo "${LOG_INFO}Waiting for X server to start..." 15 | fi 16 | sleep 1 17 | done 18 | echo "${LOG_ERROR}X server not started after ${i} seconds. Giving up." 19 | exit 1 20 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_gradient_pixel_length_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/gradient/pixel_length", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Length (in 0.1 mm) of a pixel on Hue gradient light.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": "0x0b", 12 | "cl": "0xfc03", 13 | "mf": "0x100b", 14 | "at": "0x0031", 15 | "eval": "Item.val = Attr.val" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /devices/generic/items/cap_otau_image_type_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/otau/image_type", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "implicit": false, 8 | "default": 0, 9 | "description": "Firmware image type.", 10 | "parse": { 11 | "fn": "zcl:cmd", 12 | "ep": 255, 13 | "cl": "0x0019", 14 | "cmd": "0x01", 15 | "eval": "if (ZclFrame.payloadSize >= 9) Item.val = ZclFrame.at(4) << 8 | ZclFrame.at(3)" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /crypto/password.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef U_PASSWORD_H 12 | #define U_PASSWORD_H 13 | 14 | #include 15 | 16 | std::string CRYPTO_EncryptGatewayPassword(const std::string &str); 17 | 18 | #endif /* U_PASSWORD_H */ 19 | -------------------------------------------------------------------------------- /devices/generic/subdevices/door_lock_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_DOOR_LOCK_SENSOR", 4 | "name": "ZHADoorLock", 5 | "ui_name": "Door lock sensor", 6 | "restapi": "/sensors", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0101" 12 | ], 13 | "items": [ 14 | "config/lock", 15 | "state/open", 16 | "state/lockstate" 17 | ], 18 | "items_optional": [ 19 | "config/battery", 20 | "state/reachable" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/subdevices/presence_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_PRESENCE_SENSOR", 4 | "name": "ZHAPresence", 5 | "ui_name": "Presence sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0406" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/presence", 17 | "state/lastupdated" 18 | ], 19 | "items_optional": [ 20 | "config/duration" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /devices/tuya/tuya_trv_preset.js: -------------------------------------------------------------------------------- 1 | switch (Attr.val) { 2 | case 0: 3 | Item.val = 'holiday'; 4 | break; 5 | case 1: 6 | Item.val = 'auto'; 7 | break; 8 | case 2: 9 | Item.val = 'manual'; 10 | break; 11 | case 3: 12 | Item.val = 'comfort'; 13 | break; 14 | case 4: 15 | Item.val = 'eco'; 16 | break; 17 | case 5: 18 | Item.val = 'boost'; 19 | break; 20 | case 6: 21 | Item.val = 'complex'; 22 | break; 23 | } -------------------------------------------------------------------------------- /devices/dresden_elektronik/lighting_switch_ct.js: -------------------------------------------------------------------------------- 1 | var i = R.item("state/buttonevent"); 2 | if (ZclFrame.cmd == 0x4b) { 3 | var mode = ZclFrame.at(0); 4 | var rate = ZclFrame.at(1); 5 | var button; 6 | if (mode == 1) button = 3000; 7 | else if (mode == 3) button = 4000; 8 | else { 9 | button = i.val >> 2; 10 | button = ((button << 2) / 1000) * 1000; 11 | } 12 | 13 | if (mode == 0) button += 3; 14 | else if (rate == 0xfe) button += 2; 15 | else button += 1; 16 | 17 | i.val = button; 18 | R.item("attr/mode").val = 3; 19 | } 20 | -------------------------------------------------------------------------------- /devices/generic/subdevices/power_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_POWER_SENSOR", 4 | "name": "ZHAPower", 5 | "ui_name": "Power sensor", 6 | "restapi": "/sensors", 7 | "order": 21, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0b04" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/lastupdated", 17 | "state/power" 18 | ], 19 | "items_optional": [ 20 | "state/current", 21 | "state/voltage" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/subdevices/air_purifier.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_AIR_PURIFIER", 4 | "name": "ZHAAirPurifier", 5 | "ui_name": "Air purifier", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0000" 12 | ], 13 | "items": [ 14 | "config/mode", 15 | "config/on", 16 | "config/reachable", 17 | "state/lastupdated", 18 | "state/speed" 19 | ], 20 | "items_optional": [ 21 | "state/airquality" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/touchlink_commissioning_cluster/1000_get_group_identifiers.js: -------------------------------------------------------------------------------- 1 | /* global Item, ZclFrame */ 2 | /* eslint-disable no-var */ 3 | 4 | // const total = ZclFrame.at(0) 5 | const startIndex = ZclFrame.at(1) 6 | if (startIndex === 0) { 7 | const count = ZclFrame.at(2) 8 | 9 | var list = (startIndex === 0) ? '' : Item.val 10 | for (var i = 1; i <= count; i++) { 11 | const groupId = ZclFrame.at(3 * i) | ZclFrame.at(3 * i + 1) << 8 12 | list += (i > 1 ? ',' : '') + groupId.toString() 13 | } 14 | Item.val = list 15 | } 16 | -------------------------------------------------------------------------------- /devices/generic/subdevices/air_quality_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_AIR_QUALITY_SENSOR", 4 | "name": "ZHAAirQuality", 5 | "ui_name": "Air quality sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0000" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/lastupdated" 17 | ], 18 | "items_optional": [ 19 | "state/airquality", 20 | "state/airqualityppb" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/illuminance_cluster/sml_light_level.js: -------------------------------------------------------------------------------- 1 | const tholddark = R.item('config/tholddark').val; 2 | const tholdoffset = R.item('config/tholdoffset').val; 3 | const measuredValue = Attr.val; 4 | 5 | R.item('state/dark').val = measuredValue <= tholddark; 6 | R.item('state/daylight').val = measuredValue >= tholddark + tholdoffset; 7 | if (measuredValue >= 0 && measuredValue < 0xffff) { 8 | const exp = measuredValue - 1; 9 | const l = Math.pow(10, exp / 10000.0); 10 | R.item('state/lux').val = Math.floor(l); 11 | } 12 | Item.val = measuredValue; 13 | -------------------------------------------------------------------------------- /devices/generic/subdevices/relative_rotary.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_RELATIVE_ROTARY", 4 | "name": "ZHARelativeRotary", 5 | "ui_name": "Relative rotary sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0000" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/expectedeventduration", 17 | "state/expectedrotation", 18 | "state/lastupdated", 19 | "state/rotaryevent" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /devices/generic/items/state_production_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/production", 4 | "datatype": "UInt64", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The measured production (in Wh).", 9 | "read": { 10 | "at": "0x0001", 11 | "cl": "0x0702", 12 | "ep": 0, 13 | "fn": "zcl:attr" 14 | }, 15 | "parse": { 16 | "at": "0x0001", 17 | "cl": "0x0702", 18 | "ep": 0, 19 | "eval": "Item.val = Attr.val" 20 | }, 21 | "refresh.interval": 300 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/state_valve_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/valve", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "description": "The open percentage of the thermostat valve.", 8 | "parse": { 9 | "at": "0x0008", 10 | "cl": "0x0201", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val;", 13 | "fn": "zcl:attr" 14 | }, 15 | "read": { 16 | "at": "0x0008", 17 | "cl": "0x0201", 18 | "ep": 0, 19 | "fn": "zcl:attr" 20 | }, 21 | "default": 0 22 | } 23 | -------------------------------------------------------------------------------- /devices/ikea/0008_rotaryevent.js: -------------------------------------------------------------------------------- 1 | /* global Item, R, ZclFrame */ 2 | 3 | const rotation = 30 4 | const duration = 1000 5 | const delta = new Date().getTime() - new Date(R.item('state/lastupdated').val).getTime() 6 | const expectedrotation = ZclFrame.at(0) === 0x00 ? rotation : -rotation 7 | const changed = expectedrotation !== R.item('state/expectedrotation').val 8 | Item.val = (changed || delta > duration) ? 1 : 2 9 | R.item('state/expectedeventduration').val = duration 10 | R.item('state/expectedrotation').val = ZclFrame.at(0) === 0x00 ? rotation : -rotation 11 | -------------------------------------------------------------------------------- /crypto/mmohash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | #ifndef MMO_HASH_H 11 | #define MMO_HASH_H 12 | 13 | #include 14 | #include 15 | 16 | bool CRYPTO_GetMmoHashFromInstallCode(const std::string &hexString, std::vector &result); 17 | 18 | #endif // MMO_HASH_H 19 | -------------------------------------------------------------------------------- /devices/generic/items/cap_otau_file_version_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/otau/file_version", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": true, 7 | "implicit": false, 8 | "default": 0, 9 | "description": "Firmware file version.", 10 | "parse": { 11 | "fn": "zcl:cmd", 12 | "ep": 255, 13 | "cl": "0x0019", 14 | "cmd": "0x01", 15 | "eval": "if (ZclFrame.payloadSize >= 9) Item.val = ZclFrame.at(8) << 24 | ZclFrame.at(7) << 16 | ZclFrame.at(6) << 8 | ZclFrame.at(5)" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /devices/generic/items/config_alert_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/alert", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "description": "The currently active alert.", 8 | "default": "none", 9 | "values": [ 10 | [ 11 | "\"none\"", 12 | "no alert is set" 13 | ], 14 | [ 15 | "\"select\"", 16 | "device is identifying a short time" 17 | ], 18 | [ 19 | "\"lselect\"", 20 | "device is identifying a longer time" 21 | ] 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/state_consumption_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/consumption", 4 | "datatype": "UInt64", 5 | "access": "RW", 6 | "public": true, 7 | "description": "The measured consumption (in Wh).", 8 | "read": { 9 | "at": "0x0000", 10 | "cl": "0x0702", 11 | "ep": 0, 12 | "fn": "zcl:attr" 13 | }, 14 | "parse": { 15 | "at": "0x0000", 16 | "cl": "0x0702", 17 | "ep": 0, 18 | "eval": "Item.val = Attr.val" 19 | }, 20 | "refresh.interval": 300, 21 | "default": 0 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/state_current_p1_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/current_P1", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The measured current on phase 1.", 9 | "read": { 10 | "at": "0x0508", 11 | "cl": "0x0b04", 12 | "ep": 0, 13 | "fn": "zcl:attr" 14 | }, 15 | "parse": { 16 | "at": "0x0508", 17 | "cl": "0x0b04", 18 | "ep": 0, 19 | "eval": "Item.val = Attr.val;" 20 | }, 21 | "refresh.interval": 300 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/state_current_p2_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/current_P2", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The measured current on phase 2.", 9 | "read": { 10 | "at": "0x0908", 11 | "cl": "0x0b04", 12 | "ep": 0, 13 | "fn": "zcl:attr" 14 | }, 15 | "parse": { 16 | "at": "0x0908", 17 | "cl": "0x0b04", 18 | "ep": 0, 19 | "eval": "Item.val = Attr.val;" 20 | }, 21 | "refresh.interval": 300 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/state_current_p3_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/current_P3", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The measured current on phase 3.", 9 | "read": { 10 | "at": "0x0a08", 11 | "cl": "0x0b04", 12 | "ep": 0, 13 | "fn": "zcl:attr" 14 | }, 15 | "parse": { 16 | "at": "0x0a08", 17 | "cl": "0x0b04", 18 | "ep": 0, 19 | "eval": "Item.val = Attr.val;" 20 | }, 21 | "refresh.interval": 300 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/state_hue_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/hue", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The current color hue.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x4000", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": "0x4000" 21 | }, 22 | "refresh.interval": 5 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/attr_mode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/mode", 4 | "datatype": "UInt32", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Operational mode.", 8 | "default": 1, 9 | "values": [ 10 | [ 11 | 0, 12 | "none" 13 | ], 14 | [ 15 | 1, 16 | "scenes" 17 | ], 18 | [ 19 | 2, 20 | "two_groups" 21 | ], 22 | [ 23 | 3, 24 | "color_temperature" 25 | ], 26 | [ 27 | 4, 28 | "dimmer" 29 | ] 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /devices/generic/items/config_bri_options_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/bri/options", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": false, 7 | "description": "Options.", 8 | "default": 0, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0008", 13 | "at": "0x000F", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0008", 20 | "at": "0x000F" 21 | }, 22 | "refresh.interval": 3600 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/state_consumption_2_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/consumption_2", 4 | "datatype": "UInt64", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The measured consumption (in Wh).", 9 | "read": { 10 | "at": "0x0000", 11 | "cl": "0x0702", 12 | "ep": 0, 13 | "fn": "zcl:attr" 14 | }, 15 | "parse": { 16 | "at": "0x0000", 17 | "cl": "0x0702", 18 | "ep": 0, 19 | "eval": "Item.val = Attr.val" 20 | }, 21 | "refresh.interval": 300 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/state_sat_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/sat", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The current color saturation.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x0001", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": "0x0001" 21 | }, 22 | "refresh.interval": 5 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/cap_measured_value_unit_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/measured_value/unit", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "default": "", 8 | "description": "The unit of state/measured_value. To be defined by static in DDF", 9 | "values": [ 10 | [ 11 | "ug/m^3", 12 | "microgram per cubic meter" 13 | ], 14 | [ 15 | "PPM", 16 | "parts per million" 17 | ], 18 | [ 19 | "PPB", 20 | "parts per billion" 21 | ] 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/state_current_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/current", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "description": "The measured current (in mA).", 8 | "read": { 9 | "at": "0x0508", 10 | "cl": "0x0b04", 11 | "ep": 0, 12 | "fn": "zcl:attr" 13 | }, 14 | "parse": { 15 | "at": "0x0508", 16 | "cl": "0x0b04", 17 | "ep": 0, 18 | "eval": "if (Attr.val != 65535) { Item.val = Attr.val; }" 19 | }, 20 | "refresh.interval": 300, 21 | "default": 0 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/state_on_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/on", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "default": false, 8 | "description": "True when device is on; false when off.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0006", 13 | "at": "0x0000", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0006", 20 | "at": "0x0000" 21 | }, 22 | "refresh.interval": 5 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/state_voltage_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/voltage", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "description": "The measured voltage (in V).", 8 | "read": { 9 | "at": "0x0505", 10 | "cl": "0x0b04", 11 | "ep": 0, 12 | "fn": "zcl:attr" 13 | }, 14 | "parse": { 15 | "at": "0x0505", 16 | "cl": "0x0b04", 17 | "ep": 0, 18 | "eval": "if (Attr.val != 65535) { Item.val = Attr.val; }" 19 | }, 20 | "refresh.interval": 300, 21 | "default": 0 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/attr_swversion_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/swversion", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "implicit": true, 8 | "description": "Firmware version of the device.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 255, 12 | "cl": "0x0000", 13 | "at": "0x4000", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0000", 20 | "at": "0x4000" 21 | }, 22 | "refresh.interval": 86400 23 | } 24 | -------------------------------------------------------------------------------- /tests/201-device-js.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // string conversion so catch can print QString 4 | std::ostream& operator << ( std::ostream& os, const QString &str) 5 | { 6 | os << str.toStdString(); 7 | return os; 8 | } 9 | 10 | #include "catch2/catch.hpp" 11 | #include "device_js/device_js.h" 12 | 13 | int argc = 0; 14 | QCoreApplication app(argc, nullptr); 15 | 16 | 17 | TEST_CASE( "001: Basic Math", "[DeviceJs]" ) 18 | { 19 | DeviceJs js; 20 | 21 | REQUIRE(js.evaluate("1 + 2") == JsEvalResult::Ok); 22 | 23 | REQUIRE(js.result().toInt() == 3); 24 | } 25 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_ct_min_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/ct/min", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Minimum supported color temperature.", 8 | "default": 0, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x400b", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": "0x400b" 21 | }, 22 | "refresh.interval": 86400 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/state_power_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/power", 4 | "datatype": "Int16", 5 | "access": "RW", 6 | "public": true, 7 | "description": "The measured power (in W).", 8 | "read": { 9 | "at": "0x050b", 10 | "cl": "0x0b04", 11 | "ep": 0, 12 | "fn": "zcl:attr" 13 | }, 14 | "parse": { 15 | "at": "0x050b", 16 | "cl": "0x0b04", 17 | "ep": 0, 18 | "eval": "if (Attr.val != -32768 && Attr.val != 32768) { Item.val = Attr.val; }" 19 | }, 20 | "refresh.interval": 300, 21 | "default": 0 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/subdevices/alarm_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_ALARM_SENSOR", 4 | "name": "ZHAAlarm", 5 | "ui_name": "Alarm sensor", 6 | "restapi": "/sensors", 7 | "order": 30, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0500" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/alarm", 17 | "state/lastupdated" 18 | ], 19 | "items_optional": [ 20 | "config/enrolled", 21 | "config/pending", 22 | "config/battery", 23 | "state/lowbattery" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /devices/generic/items/attr_zonetype_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/zonetype", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "implicit": false, 8 | "default": 0, 9 | "description": "IAS Zone zone type.", 10 | "parse": { 11 | "fn": "zcl:attr", 12 | "ep": 255, 13 | "cl": "0x0500", 14 | "at": "0x0001", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": 0, 20 | "cl": "0x0500", 21 | "at": "0x0001" 22 | }, 23 | "refresh.interval": 86400 24 | } 25 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_ct_max_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/ct/max", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Maximum supported color temperature.", 8 | "default": "0xfeff", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x400c", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": "0x400c" 21 | }, 22 | "refresh.interval": 86400 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/state_alert_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/alert", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "managed": true, 8 | "description": "The currently active alert effect.", 9 | "default": "none", 10 | "values": [ 11 | [ 12 | "\"none\"", 13 | "light is not performing an alert" 14 | ], 15 | [ 16 | "\"select\"", 17 | "light is blinking a short time" 18 | ], 19 | [ 20 | "\"lselect\"", 21 | "light is blinking a longer time" 22 | ] 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_capabilities_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/capabilities", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "The supported color modes as bitmap.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x400a", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": "0x400a" 21 | }, 22 | "refresh.interval": 86400 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/subdevices/light_level_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_LIGHT_LEVEL_SENSOR", 4 | "name": "ZHALightLevel", 5 | "ui_name": "Light level sensor", 6 | "restapi": "/sensors", 7 | "order": 22, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0400" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "config/tholddark", 17 | "config/tholdoffset", 18 | "state/dark", 19 | "state/daylight", 20 | "state/lightlevel", 21 | "state/lux", 22 | "state/lastupdated" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /devices/generic/items/attr_otaversion_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/otaversion", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": false, 7 | "implicit": false, 8 | "default": 0, 9 | "description": "OTA cluster file version.", 10 | "parse": { 11 | "fn": "zcl:attr", 12 | "ep": 255, 13 | "cl": "0x0019", 14 | "at": "0x0002", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": 0, 20 | "cl": "0x0019", 21 | "at": "0x0002" 22 | }, 23 | "refresh.interval": 86400 24 | } 25 | -------------------------------------------------------------------------------- /devices/generic/items/config_lastchange_time_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/lastchange_time", 4 | "datatype": "ISO 8601 timestamp", 5 | "access": "R", 6 | "public": true, 7 | "description": "Specifies the time in UTC at which the setpoint change was recorded.", 8 | "parse": { 9 | "at": "0x0032", 10 | "cl": "0x0201", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val", 13 | "fn": "zcl:attr" 14 | }, 15 | "read": { 16 | "at": "0x0032", 17 | "cl": "0x0201", 18 | "ep": 0, 19 | "fn": "zcl:attr" 20 | }, 21 | "default": 0 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/state_bri_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/bri", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "default": 0, 7 | "public": true, 8 | "range": [ 9 | 0, 10 | 254 11 | ], 12 | "description": "The current brightness.", 13 | "parse": { 14 | "fn": "zcl:attr", 15 | "ep": 0, 16 | "cl": "0x0008", 17 | "at": "0x0000", 18 | "eval": "Item.val = Attr.val" 19 | }, 20 | "read": { 21 | "fn": "zcl:attr", 22 | "ep": 0, 23 | "cl": "0x0008", 24 | "at": "0x0000" 25 | }, 26 | "refresh.interval": 5 27 | } 28 | -------------------------------------------------------------------------------- /devices/generic/items/state_x_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/x", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The current color x coordinate.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 255, 12 | "cl": "0x0300", 13 | "at": "0x0003", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": [ 21 | "0x0003", 22 | "0x0004" 23 | ] 24 | }, 25 | "refresh.interval": 5 26 | } 27 | -------------------------------------------------------------------------------- /devices/generic/subdevices/thermostat.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_THERMOSTAT", 4 | "name": "ZHAThermostat", 5 | "ui_name": "Thermostat", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0201" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "config/heatsetpoint", 17 | "state/lastupdated", 18 | "state/temperature" 19 | ], 20 | "items_optional": [ 21 | "config/mode", 22 | "config/offset", 23 | "state/on", 24 | "state/valve" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /devices/generic/items/attr_appversion_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/appversion", 4 | "datatype": "UInt32", 5 | "access": "R", 6 | "public": true, 7 | "implicit": false, 8 | "default": 0, 9 | "description": "ZCL Basic cluster application version.", 10 | "parse": { 11 | "fn": "zcl:attr", 12 | "ep": 255, 13 | "cl": "0x0000", 14 | "at": "0x0001", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": 0, 20 | "cl": "0x0000", 21 | "at": "0x0001" 22 | }, 23 | "refresh.interval": 86400 24 | } 25 | -------------------------------------------------------------------------------- /devices/xiaomi/xiaomi_known_issues_firmware_update.md: -------------------------------------------------------------------------------- 1 | 2 | ### Firmware update required 3 | 4 | This applies for Xiaomi smart plugs ZNCZ04LM (lumi.plug.mmeu01) and SP-EUC01 (lumi.plug.maeu01). It is mandatory that RaspBee/ConBee I firmware version 0x26400500 (or higher) or RaspBee/ConBeeII firmware version 0x266f0700 (or higher) is installed. 5 | 6 | Further the plugs firmware need to be updated via OTA to work well with this DDF. 7 | A more detailed description can be found at: [wiki/Xiaomi-smart-plugs-not-working-correctly](https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Xiaomi-smart-plugs-not-working-correctly) 8 | -------------------------------------------------------------------------------- /devices/generic/items/attr_productid_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/productid", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Product identifier of the device.", 8 | "parse": { 9 | "fn": "zcl:attr", 10 | "ep": "0x0b", 11 | "cl": "0x0000", 12 | "mf": "0x100b", 13 | "at": "0x0040", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": "0x0b", 19 | "cl": "0x0000", 20 | "mf": "0x100b", 21 | "at": "0x0040" 22 | }, 23 | "refresh.interval": 86400 24 | } 25 | -------------------------------------------------------------------------------- /devices/generic/items/state_airquality_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/airquality", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Text representation of the air quality based on tVOC level.", 8 | "parse": { 9 | "fn": "numtostr", 10 | "srcitem": "state/airqualityppb", 11 | "op": "le", 12 | "to": [ 13 | 65, 14 | "excellent", 15 | 220, 16 | "good", 17 | 660, 18 | "moderate", 19 | 5000, 20 | "unhealthy", 21 | 65535, 22 | "out of scale" 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /devices/generic/items/state_power_divisor_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/power_divisor", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": false, 7 | "description": "AC Power Divisor to be applied to the Active Power attribute.", 8 | "parse": { 9 | "ep": 0, 10 | "cl": "0x0B04", 11 | "at": "0x0605", 12 | "eval": "if (Attr.val != 65535) { Item.val = Attr.val }" 13 | }, 14 | "default": 1, 15 | "read": { 16 | "fn": "zcl:attr", 17 | "ep": 0, 18 | "cl": "0x0B04", 19 | "at": "0x0605" 20 | }, 21 | "refresh.interval": 360 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/config_lastchange_amount_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/lastchange_amount", 4 | "datatype": "Int16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Specifies the delta between the current active setpoint and the previous active setpoint.", 8 | "parse": { 9 | "at": "0x0031", 10 | "cl": "0x0201", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val", 13 | "fn": "zcl:attr" 14 | }, 15 | "read": { 16 | "at": "0x0031", 17 | "cl": "0x0201", 18 | "ep": 0, 19 | "fn": "zcl:attr" 20 | }, 21 | "default": 0 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/subdevices/formaldehyde_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_FORMALDEHYDE_SENSOR", 4 | "name": "ZHAFormaldehyde", 5 | "ui_name": "Formaldehyde sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x042B" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/measured_value", 17 | "cap/measured_value/min", 18 | "cap/measured_value/max", 19 | "cap/measured_value/unit", 20 | "cap/measured_value/substance", 21 | "state/lastupdated" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/state_lift_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/lift", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 100 10 | ], 11 | "description": "The lift percentage of a roller blind.", 12 | "parse": { 13 | "at": "0x0008", 14 | "cl": "0x0102", 15 | "ep": 0, 16 | "eval": "Item.val = Attr.val;", 17 | "fn": "zcl:attr" 18 | }, 19 | "read": { 20 | "at": "0x0008", 21 | "cl": "0x0102", 22 | "ep": 0, 23 | "fn": "zcl:attr" 24 | }, 25 | "refresh.interval": 300, 26 | "default": 0 27 | } 28 | -------------------------------------------------------------------------------- /devices/generic/subdevices/carbondioxide_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_CARBONDIOXIDE_SENSOR", 4 | "name": "ZHACarbonDioxide", 5 | "ui_name": "Carbon dioxide sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x040D" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/measured_value", 17 | "cap/measured_value/min", 18 | "cap/measured_value/max", 19 | "cap/measured_value/unit", 20 | "cap/measured_value/substance", 21 | "state/lastupdated" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/state_tilt_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/tilt", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 100 10 | ], 11 | "description": "The tilt percentage of a shutter or blind.", 12 | "parse": { 13 | "at": "0x0009", 14 | "cl": "0x0102", 15 | "ep": 0, 16 | "eval": "Item.val = Attr.val;", 17 | "fn": "zcl:attr" 18 | }, 19 | "read": { 20 | "at": "0x0009", 21 | "cl": "0x0102", 22 | "ep": 0, 23 | "fn": "zcl:attr" 24 | }, 25 | "refresh.interval": 300, 26 | "default": 0 27 | } 28 | -------------------------------------------------------------------------------- /zdp/zdp_handlers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef ZDP_HANDLERS_H 12 | #define ZDP_HANDLERS_H 13 | 14 | 15 | namespace deCONZ { 16 | class ApsController; 17 | class ApsDataIndication; 18 | } 19 | 20 | void ZDP_HandleNodeDescriptorRequest(const deCONZ::ApsDataIndication &ind, deCONZ::ApsController *apsCtrl); 21 | 22 | #endif // ZDP_HANDLERS_H 23 | -------------------------------------------------------------------------------- /devices/generic/items/state_battery_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/battery", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 100 10 | ], 11 | "description": "The current device battery level in range 0–100 %.", 12 | "parse": { 13 | "fn": "zcl:attr", 14 | "ep": 0, 15 | "cl": "0x0001", 16 | "at": "0x0021", 17 | "eval": "Item.val = Attr.val / 2" 18 | }, 19 | "read": { 20 | "fn": "zcl:attr", 21 | "ep": 0, 22 | "cl": "0x0001", 23 | "at": "0x0021" 24 | }, 25 | "refresh.interval": 3600 26 | } 27 | -------------------------------------------------------------------------------- /devices/generic/items/state_ct_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/ct", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "The current Mired color temperature of the light. Where Mired is 1000000 / color temperature (in kelvins).", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x0007", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": "0x0007" 21 | }, 22 | "refresh.interval": 5 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_effects_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/effects", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Supported effects for Hue lights.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": "0x0b", 12 | "cl": "0xfc03", 13 | "mf": "0x100b", 14 | "at": "0x0011", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": "0x0b", 20 | "cl": "0xfc03", 21 | "mf": "0x100b", 22 | "at": "0x0011" 23 | }, 24 | "refresh.interval": 86400 25 | } 26 | -------------------------------------------------------------------------------- /devices/generic/subdevices/particulatematter_sensor.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_PARTICULATEMATTER_SENSOR", 4 | "name": "ZHAParticulateMatter", 5 | "ui_name": "Particulate matter sensor", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x042A" 12 | ], 13 | "items": [ 14 | "config/on", 15 | "config/reachable", 16 | "state/measured_value", 17 | "cap/measured_value/min", 18 | "cap/measured_value/max", 19 | "cap/measured_value/unit", 20 | "cap/measured_value/substance", 21 | "state/lastupdated" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /sqlite3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | include(FetchContent) 4 | 5 | if(${CMAKE_VERSION} VERSION_GREATER "3.23.0") 6 | cmake_policy(SET CMP0135 NEW) 7 | endif() 8 | 9 | FetchContent_GetProperties(sqlite3) 10 | if (NOT sqlite3_POPULATED) 11 | FetchContent_Populate(sqlite3 12 | URL "https://www.sqlite.org/2023/sqlite-amalgamation-3420000.zip" 13 | URL_HASH MD5=eb9a6e56044bc518e6705521a1a929ed) 14 | endif() 15 | 16 | add_library(sqlite3 SHARED ${sqlite3_SOURCE_DIR}/sqlite3.c) 17 | add_library(SQLite::SQLite3 ALIAS sqlite3) 18 | 19 | target_include_directories(sqlite3 PUBLIC ${sqlite3_SOURCE_DIR}) 20 | -------------------------------------------------------------------------------- /device_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef DEVICE_COMPAT_H 12 | #define DEVICE_COMPAT_H 13 | 14 | #include "device_descriptions.h" 15 | 16 | class Device; 17 | 18 | Resource *DEV_InitCompatNodeFromDescription(Device *device, const DeviceDescription &ddf, const DeviceDescription::SubDevice &sub, const QString &uniqueId); 19 | 20 | #endif // DEVICE_COMPAT_H 21 | -------------------------------------------------------------------------------- /devices/generic/items/cap_group_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/group", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Comma-seperated list of groups which a device controls.", 8 | "parse": { 9 | "fn": "zcl:cmd", 10 | "ep": 1, 11 | "cl": "0x1000", 12 | "cmd": "0x41", 13 | "script": "../generic/touchlink_commissioning_cluster/1000_get_group_identifiers.js" 14 | }, 15 | "read": { 16 | "fn": "zcl:cmd", 17 | "ep": 1, 18 | "cl": "0x1000", 19 | "cmd": "0x41", 20 | "eval": "'00'" 21 | }, 22 | "refresh.interval": 86400 23 | } 24 | -------------------------------------------------------------------------------- /devices/generic/items/config_schedule_on_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/schedule_on", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Determines if on-device schedules for setting the heatsetpoint are currently used or if the thermostat is operated manually.", 8 | "parse": { 9 | "at": "0x0025", 10 | "cl": "0x0201", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val;", 13 | "fn": "zcl:attr" 14 | }, 15 | "read": { 16 | "at": "0x0025", 17 | "cl": "0x0201", 18 | "ep": 0, 19 | "fn": "zcl:attr" 20 | }, 21 | "default": false 22 | } 23 | -------------------------------------------------------------------------------- /ui/text_lineedit.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTLINEEDIT_H 2 | #define TEXTLINEEDIT_H 3 | 4 | #include 5 | 6 | class TextLineEdit : public QLineEdit 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | TextLineEdit(QWidget *parent); 12 | void setIsOptional(bool optional) { m_isOptional = optional; } 13 | void setInputText(const QString &text); 14 | 15 | private Q_SLOTS: 16 | void inputTextChanged(const QString &text); 17 | bool verifyInputText(const QString &text); 18 | 19 | Q_SIGNALS: 20 | void valueChanged(); 21 | 22 | private: 23 | bool m_isOptional = false; 24 | QString m_origValue; 25 | }; 26 | 27 | #endif // TEXTLINEEDIT_H 28 | -------------------------------------------------------------------------------- /devices/generic/items/cap_bri_min_dim_level_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/bri/min_dim_level", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "default": 1, 8 | "description": "Minimum dim level of the device.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": "0x0b", 12 | "cl": "0x0008", 13 | "mf": "0x100b", 14 | "at": "0x0003", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": "0x0b", 20 | "cl": "0x0008", 21 | "mf": "0x100b", 22 | "at": "0x0003" 23 | }, 24 | "refresh.interval": 86400 25 | } 26 | -------------------------------------------------------------------------------- /devices/generic/items/config_lastchange_source_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/lastchange_source", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "description": "Determine whether changes to setpoints were initiated by manual interaction, scheduled programming or some other source.", 8 | "parse": { 9 | "at": "0x0030", 10 | "cl": "0x0201", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val", 13 | "fn": "zcl:attr" 14 | }, 15 | "read": { 16 | "at": "0x0030", 17 | "cl": "0x0201", 18 | "ep": 0, 19 | "fn": "zcl:attr" 20 | }, 21 | "default": 0 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/config_colorcapabilities_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/colorcapabilities", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Deprecated. The supported color capabilities as bitmap.", 8 | "deprecated": "2022-11-11", 9 | "default": 0, 10 | "parse": { 11 | "fn": "zcl:attr", 12 | "ep": 0, 13 | "cl": "0x0300", 14 | "at": "0x400a", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": 0, 20 | "cl": "0x0300", 21 | "at": "0x400a" 22 | }, 23 | "refresh.interval": 86400 24 | } 25 | -------------------------------------------------------------------------------- /devices/xiaomi/xiaomi_known_issues_sticky_parents.md: -------------------------------------------------------------------------------- 1 | 2 | ### Sticky Parents 3 | 4 | Almost all Xiaomi end-devices stick to their parent after pairing. 5 | The parent is the device which repeats the signal, it can be a router or the coordinator. 6 | 7 | Once a parent is cut from power or otherwise lost, the end-device won't automatically search for a new parent and appears to be offline. 8 | 9 | → Best practice for pairing is therefore to pair the device at the place where it's gonna be installed to force it to select a *good* parent. It's also advisable to power off all routers which aren't powered all the time, so that they aren't considered as parent when pairing. 10 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_gradient_styles_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/gradient/styles", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Supported styles on Hue gradient light.", 8 | "default": "0x0001", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": "0x0b", 12 | "cl": "0xfc03", 13 | "mf": "0x100b", 14 | "at": "0x0013", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": "0x0b", 20 | "cl": "0xfc03", 21 | "mf": "0x100b", 22 | "at": "0x0013" 23 | }, 24 | "refresh.interval": 86400 25 | } 26 | -------------------------------------------------------------------------------- /devices/generic/items/config_ctmin_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/ctmin", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "Deprecated. Minimum supported color temperature.", 8 | "deprecated": "2022-11-11", 9 | "default": 0, 10 | "parse": { 11 | "fn": "zcl:attr", 12 | "ep": 0, 13 | "cl": "0x0300", 14 | "at": "0x400b", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": 0, 20 | "cl": "0x0300", 21 | "at": [ 22 | "0x400b", 23 | "0x400c" 24 | ] 25 | }, 26 | "refresh.interval": 86400 27 | } 28 | -------------------------------------------------------------------------------- /devices/generic/subdevices/dimmer_switch.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_DIMMER_SWITCH", 4 | "name": "Dimmer switch", 5 | "ui_name": "Dimmer switch", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/bri", 14 | "state/on", 15 | "state/reachable" 16 | ], 17 | "items_optional": [ 18 | "cap/alert/trigger_effect", 19 | "cap/bri/move_with_onoff", 20 | "cap/groups/not_supported", 21 | "cap/on/off_with_effect", 22 | "config/bri/execute_if_off", 23 | "config/bri/startup", 24 | "config/on/startup" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /backup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef BACKUP_H 12 | #define BACKUP_H 13 | 14 | namespace deCONZ { 15 | class ApsController; 16 | } 17 | 18 | bool BAK_ExportConfiguration(deCONZ::ApsController *apsCtrl); 19 | bool BAK_ImportConfiguration(deCONZ::ApsController *apsCtrl); 20 | bool BAK_ResetConfiguration(deCONZ::ApsController *apsCtrl, bool resetGW, bool deleteDB); 21 | 22 | #endif // BACKUP_H 23 | -------------------------------------------------------------------------------- /devices/generic/items/attr_swconfigid_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/swconfigid", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "Software config identifier of the device.", 8 | "parse": { 9 | "fn": "zcl:attr", 10 | "ep": "0x0b", 11 | "cl": "0x0000", 12 | "mf": "0x100b", 13 | "at": "0x0041", 14 | "eval": "Item.val = ('00000000' + Attr.val.toString(16)).slice(-8).toUpperCase()" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": "0x0b", 19 | "cl": "0x0000", 20 | "mf": "0x100b", 21 | "at": "0x0041" 22 | }, 23 | "refresh.interval": 86400 24 | } 25 | -------------------------------------------------------------------------------- /device_ddf_init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef DEVICE_DDF_INIT_H 12 | #define DEVICE_DDF_INIT_H 13 | 14 | class Device; 15 | class DeviceDescription; 16 | 17 | bool DEV_InitDeviceBasic(Device *device); 18 | bool DEV_InitDeviceFromDescription(Device *device, const DeviceDescription &ddf); 19 | bool DEV_InitBaseDescriptionForDevice(Device *device, DeviceDescription &ddf); 20 | 21 | #endif // DEVICE_DDF_INIT_H 22 | -------------------------------------------------------------------------------- /devices/generic/subdevices/ancillary_control.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_ANCILLARY_CONTROL", 4 | "name": "ZHAAncillaryControl", 5 | "ui_name": "Ancillary control", 6 | "restapi": "/sensors", 7 | "order": 20, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01", 11 | "0x0501" 12 | ], 13 | "items": [ 14 | "config/battery", 15 | "config/on", 16 | "config/reachable", 17 | "state/action", 18 | "state/lastupdated", 19 | "state/seconds_remaining", 20 | "state/panel" 21 | ], 22 | "items_optional": [ 23 | "config/enrolled", 24 | "config/pending", 25 | "state/lowbattery", 26 | "state/tampered" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /devices/generic/subdevices/dimmable_light.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_DIMMABLE_LIGHT", 4 | "name": "Dimmable light", 5 | "ui_name": "Dimmable light", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "state/alert", 14 | "state/bri", 15 | "state/on", 16 | "state/reachable" 17 | ], 18 | "items_optional": [ 19 | "cap/alert/trigger_effect", 20 | "cap/bri/move_with_onoff", 21 | "cap/groups/not_supported", 22 | "cap/on/off_with_effect", 23 | "config/bri/execute_if_off", 24 | "config/bri/startup", 25 | "config/on/startup" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /devices/generic/items/config_bri_couple_ct_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/bri/couple_ct", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Couple color temperature to brightness.", 8 | "default": true, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0008", 13 | "at": "0x000F", 14 | "eval": "Item.val = (Attr.val & 0x02) !== 0" 15 | }, 16 | "write": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0008", 20 | "at": "0x000F", 21 | "dt": "0x18", 22 | "eval": "Item.val ? R.item('config/bri/options').val | 0x02 : R.item('config/bri/options').val & ~0x02" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /devices/generic/items/config_tuya_unlock_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/tuya_unlock", 4 | "datatype": "Bool", 5 | "access": "R", 6 | "public": false, 7 | "description": "Tuya sequence to unlock some device.", 8 | "default": false, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 1, 12 | "cl": "0x0000", 13 | "at": "0xfffe", 14 | "eval": "Item.val = (Attr.val != 0)" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 1, 19 | "cl": "0x0000", 20 | "at": [ 21 | "0x0004", 22 | "0x0000", 23 | "0x0001", 24 | "0x0005", 25 | "0x0007", 26 | "0xfffe" 27 | ] 28 | }, 29 | "refresh.interval": 86400 30 | } 31 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_xy_red_x_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/xy/red_x", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "description": "X coordinate of red point of color gamut.", 8 | "default": "0xfeff", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x0032", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": [ 21 | "0x0032", 22 | "0x0033", 23 | "0x0036", 24 | "0x0037", 25 | "0x003a", 26 | "0x003b" 27 | ] 28 | }, 29 | "refresh.interval": 86400 30 | } 31 | -------------------------------------------------------------------------------- /devices/generic/items/cap_otau_manufacturer_code_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/otau/manufacturer_code", 4 | "datatype": "UInt16", 5 | "access": "R", 6 | "public": true, 7 | "implicit": false, 8 | "default": 0, 9 | "description": "Firmware manufacturer code.", 10 | "parse": { 11 | "fn": "zcl:cmd", 12 | "ep": 255, 13 | "cl": "0x0019", 14 | "cmd": "0x01", 15 | "eval": "if (ZclFrame.payloadSize >= 9) Item.val = ZclFrame.at(2) << 8 | ZclFrame.at(1)" 16 | }, 17 | "read": { 18 | "fn": "zcl:cmd", 19 | "ep": 255, 20 | "fc": "0x19", 21 | "cl": "0x0019", 22 | "cmd": "0x00", 23 | "eval": "'0064'" 24 | }, 25 | "refresh.interval": 86400 26 | } 27 | -------------------------------------------------------------------------------- /devices/generic/items/config_bri_execute_if_off_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/bri/execute_if_off", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Execute brightness changes when the device is off.", 8 | "default": true, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0008", 13 | "at": "0x000F", 14 | "eval": "Item.val = (Attr.val & 0x01) !== 0" 15 | }, 16 | "write": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0008", 20 | "at": "0x000F", 21 | "dt": "0x18", 22 | "eval": "Item.val ? R.item('config/bri/options').val | 0x01 : R.item('config/bri/options').val & ~0x01" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /devices/generic/items/cap_color_gradient_pixel_count_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "cap/color/gradient/pixel_count", 4 | "datatype": "UInt8", 5 | "access": "R", 6 | "public": true, 7 | "default": 0, 8 | "description": "Number of pixels on Hue gradient light.", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": "0x0b", 12 | "cl": "0xfc03", 13 | "mf": "0x100b", 14 | "at": "0x0030", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": "0x0b", 20 | "cl": "0xfc03", 21 | "mf": "0x100b", 22 | "at": [ 23 | "0x0030", 24 | "0x0031", 25 | "0x0036" 26 | ] 27 | }, 28 | "refresh.interval": 86400 29 | } 30 | -------------------------------------------------------------------------------- /devices/generic/items/config_bri_min_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/bri/min", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Minimum brightness supported by ballast.", 8 | "default": 1, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0301", 13 | "at": "0x0010", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0301", 20 | "at": "0x0010" 21 | }, 22 | "refresh.interval": 3600, 23 | "write": { 24 | "fn": "zcl:attr", 25 | "ep": 0, 26 | "cl": "0x0301", 27 | "at": "0x0010", 28 | "dt": "0x20", 29 | "eval": "Item.val" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /rest_ddf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef REST_DDF_H 12 | #define REST_DDF_H 13 | 14 | class ApiRequest; 15 | class ApiResponse; 16 | 17 | /*! REST-API endpoint for DDF. */ 18 | int REST_DDF_HandleApi(const ApiRequest &req, ApiResponse &rsp); 19 | 20 | /*! Callback for POST DDF bundle request to notify device description code 21 | of updated bundle data. 22 | */ 23 | void DEV_DDF_BundleUpdated(unsigned char *data, unsigned dataSize); 24 | 25 | #endif // REST_DDF_H 26 | -------------------------------------------------------------------------------- /devices/generic/items/config_bri_max_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/bri/max", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Maximum brightness supported by ballast.", 8 | "default": 254, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0301", 13 | "at": "0x0011", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0301", 20 | "at": "0x0011" 21 | }, 22 | "refresh.interval": 3600, 23 | "write": { 24 | "fn": "zcl:attr", 25 | "ep": 0, 26 | "cl": "0x0301", 27 | "at": "0x0011", 28 | "dt": "0x20", 29 | "eval": "Item.val" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /devices/generic/items/config_locked_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/locked", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Locks or unlocks the device. This item has to be understood as child-lock.", 8 | "parse": { 9 | "at": "0x0001", 10 | "cl": "0x0204", 11 | "ep": 0, 12 | "eval": "Item.val = Attr.val;", 13 | "fn": "zcl:attr" 14 | }, 15 | "read": { 16 | "at": "0x0001", 17 | "cl": "0x0204", 18 | "ep": 0, 19 | "fn": "zcl:attr" 20 | }, 21 | "write": { 22 | "at": "0x0001", 23 | "cl": "0x0204", 24 | "dt": "0x30", 25 | "ep": 0, 26 | "eval": "Item.val", 27 | "fn": "zcl:attr" 28 | }, 29 | "default": false 30 | } 31 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | # branches to consider in the event; optional, defaults to all 6 | branches: 7 | - master 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | jobs: 13 | update_release_draft: 14 | runs-on: ubuntu-latest 15 | steps: 16 | # Drafts your next Release notes as Pull Requests are merged into "master" 17 | - uses: release-drafter/release-drafter@v5 18 | with: 19 | # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml 20 | config-name: release-drafter-config.yml 21 | env: 22 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 23 | -------------------------------------------------------------------------------- /devices/generic/items/config_bri_on_level_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/bri/on_level", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Brightness when device is turned on.", 8 | "default": 255, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0008", 13 | "at": "0x0011", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0008", 20 | "at": "0x0011" 21 | }, 22 | "refresh.interval": 3600, 23 | "write": { 24 | "fn": "zcl:attr", 25 | "ep": 0, 26 | "cl": "0x0008", 27 | "at": "0x0011", 28 | "dt": "0x20", 29 | "eval": "Item.val" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /devices/generic/items/config_bri_startup_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/bri/startup", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Brightness on device startup (power on).", 8 | "default": 255, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0008", 13 | "at": "0x4000", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0008", 20 | "at": "0x4000" 21 | }, 22 | "refresh.interval": 3600, 23 | "write": { 24 | "fn": "zcl:attr", 25 | "ep": 0, 26 | "cl": "0x0008", 27 | "at": "0x4000", 28 | "dt": "0x20", 29 | "eval": "Item.val" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /devices/generic/items/config_on_startup_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/on/startup", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "description": "On/Off state on device startup (power on).", 8 | "default": 255, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0006", 13 | "at": "0x4003", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0006", 20 | "at": "0x4003" 21 | }, 22 | "refresh.interval": 3600, 23 | "write": { 24 | "fn": "zcl:attr", 25 | "ep": 0, 26 | "cl": "0x0006", 27 | "at": "0x4003", 28 | "dt": "0x30", 29 | "eval": "Item.val" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /devices/xiaomi/xiaomi_rtczcgq11lm_presenceevent.js: -------------------------------------------------------------------------------- 1 | switch (Attr.val) { 2 | case 0: 3 | Item.val = "enter"; 4 | break; 5 | case 1: 6 | Item.val = "leave"; 7 | break; 8 | case 2: 9 | Item.val = "enterleft"; 10 | break; 11 | case 3: 12 | Item.val = "rightleave"; 13 | break; 14 | case 4: 15 | Item.val = "enterright"; 16 | break; 17 | case 5: 18 | Item.val = "leftleave"; 19 | break; 20 | case 6: 21 | Item.val = "approaching"; 22 | break; 23 | case 7: 24 | Item.val = "absenting"; 25 | break; 26 | case 8: 27 | Item.val = "8"; 28 | break; 29 | case 9: 30 | Item.val = "9"; 31 | break; 32 | } -------------------------------------------------------------------------------- /device/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_library (event 3 | ../event.h 4 | ../event.cpp 5 | ) 6 | 7 | target_link_libraries(event 8 | PRIVATE resource 9 | ) 10 | 11 | target_include_directories (event PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) 12 | 13 | 14 | add_library (device 15 | ../device.h 16 | ../device.cpp 17 | ../device_access_fn.h 18 | ../device_access_fn.cpp 19 | ../device_descriptions.h 20 | ../device_descriptions.cpp 21 | ../device_ddf_init.h 22 | ../device_ddf_init.cpp 23 | ) 24 | 25 | target_link_libraries(device 26 | PUBLIC deconz_common 27 | PUBLIC device_js 28 | PUBLIC event 29 | PUBLIC resource 30 | PUBLIC zcl 31 | PUBLIC zdp 32 | ) 33 | 34 | target_include_directories (device PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) 35 | -------------------------------------------------------------------------------- /devices/generic/items/attr_ddf_policy_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "attr/ddf_policy", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "implicit": true, 8 | "description": "Determines how DDF bundle is selected.", 9 | "default": "latest_prefer_stable", 10 | "values": [ 11 | [ 12 | "latest_prefer_stable", 13 | "Use latest DDF bundle: Beta signed one if no stable available." 14 | ], 15 | [ 16 | "latest", 17 | "Use latest DDF bundle either Beta or Stable signed." 18 | ], 19 | [ 20 | "pin", 21 | "Stay on the pinned version (DDF bundle hash)." 22 | ], 23 | [ 24 | "raw_json", 25 | "For development just use raw .json DDF." 26 | ] 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /devices/generic/items/config_color_ct_startup_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/color/ct/startup", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Color temperature on device startup (power on).", 8 | "default": 336, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x4010", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": "0x4010" 21 | }, 22 | "refresh.interval": 3600, 23 | "write": { 24 | "fn": "zcl:attr", 25 | "ep": 0, 26 | "cl": "0x0300", 27 | "at": "0x4010", 28 | "dt": "0x21", 29 | "eval": "Item.val" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /devices/generic/items/config_heatsetpoint_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/heatsetpoint", 4 | "datatype": "Int16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 0, 8 | "description": "Target temperature of a thermostat.", 9 | "parse": { 10 | "at": "0x0012", 11 | "cl": "0x0201", 12 | "ep": 0, 13 | "eval": "Item.val = Attr.val;", 14 | "fn": "zcl:attr" 15 | }, 16 | "read": { 17 | "at": "0x0012", 18 | "cl": "0x0201", 19 | "ep": 0, 20 | "fn": "zcl:attr" 21 | }, 22 | "write": { 23 | "at": "0x0012", 24 | "cl": "0x0201", 25 | "dt": "0x29", 26 | "ep": 0, 27 | "eval": "Item.val;", 28 | "fn": "zcl:attr" 29 | }, 30 | "range": [ 31 | 500, 32 | 3200 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /devices/generic/items/state_windowopen_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/windowopen", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "The current window state detected by the thermostat.", 8 | "default": "Quarantine", 9 | "values": [ 10 | [ 11 | "\"Quarantine\"", 12 | "Default" 13 | ], 14 | [ 15 | "\"Closed\"", 16 | "Window is closed" 17 | ], 18 | [ 19 | "\"Hold\"", 20 | "Window is maybe about to open" 21 | ], 22 | [ 23 | "\"Open\"", 24 | "Window is open" 25 | ], 26 | [ 27 | "\"Open (external), closed (internal)\"", 28 | "In window open state from external, but detected closed locally" 29 | ] 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /devices/ikea/fc7e_tvoc_level.js: -------------------------------------------------------------------------------- 1 | /* global Attr, Item, R */ 2 | 3 | // Translate VOC index to tVOC density. 4 | const table = [ 5 | [0, 50, 0, 220, 'good'], 6 | [51, 100, 221, 660, 'moderate'], 7 | [101, 150, 661, 1430, 'high'], 8 | [151, 200, 1431, 2200, 'very high'], 9 | [201, 300, 2201, 3300, 'very high'], 10 | [301, 500, 3301, 5500, 'very high'] 11 | ] 12 | 13 | for (let i = 0; i < table.length; i++) { 14 | const entry = table[i] 15 | if (Attr.val <= entry[1]) { 16 | const aq = Math.round((Attr.val - entry[0]) / (entry[1] - entry[0]) * (entry[3] - entry[2]) + entry[2]) 17 | Item.val = aq 18 | R.item('state/airqualityppb').val = aq // deprecated 19 | // R.item('state/airquality').val = entry[4] // use standard (?) num2str instead 20 | break 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /devices/generic/items/config_bri_onoff_transitiontime_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/bri/onoff_transitiontime", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Transition time in 1/10 seconds for turning the device on or off.", 8 | "default": 4, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0008", 13 | "at": "0x0010", 14 | "eval": "Item.val = Attr.val" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0008", 20 | "at": "0x0010" 21 | }, 22 | "refresh.interval": 3600, 23 | "write": { 24 | "fn": "zcl:attr", 25 | "ep": 0, 26 | "cl": "0x0008", 27 | "at": "0x0010", 28 | "dt": "0x21", 29 | "eval": "Item.val" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /devices/generic/items/config_color_execute_if_off_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/color/execute_if_off", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Execute colour changes when the device is off.", 8 | "default": true, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": 0, 12 | "cl": "0x0300", 13 | "at": "0x000f", 14 | "eval": "Item.val = (Attr.val & 0x01) !== 0" 15 | }, 16 | "read": { 17 | "fn": "zcl:attr", 18 | "ep": 0, 19 | "cl": "0x0300", 20 | "at": "0x000f" 21 | }, 22 | "refresh.interval": 3600, 23 | "write": { 24 | "fn": "zcl:attr", 25 | "ep": 0, 26 | "cl": "0x0300", 27 | "at": "0x000f", 28 | "dt": "0x18", 29 | "eval": "Item.val ? 0x01 : 0x00" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /devices/generic/items/state_effect_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/effect", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "managed": true, 8 | "description": "The currently active effect.", 9 | "default": "none", 10 | "values": [ 11 | [ 12 | "\"none\"", 13 | "no effect is active" 14 | ], 15 | [ 16 | "\"colorloop\"", 17 | "colorloop through hue values" 18 | ] 19 | ], 20 | "parse": { 21 | "fn": "zcl:attr", 22 | "ep": 0, 23 | "cl": "0x0300", 24 | "at": "0x4002", 25 | "eval": "Item.val = Attr.val ? 'colorloop' : 'none'" 26 | }, 27 | "read": { 28 | "fn": "zcl:attr", 29 | "ep": 0, 30 | "cl": "0x0300", 31 | "at": "0x4002" 32 | }, 33 | "refresh.interval": 300 34 | } 35 | -------------------------------------------------------------------------------- /devices/generic/items/config_volume_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/volume", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "range": [ 8 | 0, 9 | 2 10 | ], 11 | "values": [ 12 | [ 13 | 0, 14 | "Silent Mode" 15 | ], 16 | [ 17 | 1, 18 | "Low Volume" 19 | ], 20 | [ 21 | 2, 22 | "High" 23 | ] 24 | ], 25 | "default": 0, 26 | "description": "The sound volume has three possible settings: silent, low and high volumes.", 27 | "parse": { 28 | "at": "0x0024", 29 | "cl": "0x0101", 30 | "ep": 0, 31 | "eval": "Item.val = Attr.val;", 32 | "fn": "zcl:attr" 33 | }, 34 | "read": { 35 | "at": "0x0024", 36 | "cl": "0x0101", 37 | "ep": 0, 38 | "fn": "zcl:attr" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /devices/tuya/_TZ3000_TS004F_smart_knob_group_view.js: -------------------------------------------------------------------------------- 1 | // Handle a Group View Membership Response command (value 0x02) from a Tuya Smart Knob to the GROUP cluster (ID 0x0004). 2 | // Extracts the last group only. The device only sends groupcasts to the last added group. 3 | // global Item (string of comma-separated group ID numbers), R, ZclFrame 4 | 5 | // const capacity = ZclFrame.at(0); // unused 6 | const group_count = ZclFrame.at(1); 7 | 8 | if (group_count > 0) { 9 | // Groups IDs are a list of uint16s starting at offset 2 10 | const last_group = ZclFrame.at(group_count * 2 + 1) << 8 | ZclFrame.at(group_count * 2); 11 | Item.val = last_group; 12 | } else { 13 | // No groups set 14 | // deCONZ's JS engine won't accept an empty string, so use a single space (which gets converted to an empty string) 15 | Item.val = " "; 16 | } 17 | -------------------------------------------------------------------------------- /alarm_system_event_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef ALARM_SYSTEM_EVENT_HANDLER_H 12 | #define ALARM_SYSTEM_EVENT_HANDLER_H 13 | 14 | class Event; 15 | class EventEmitter; 16 | class AlarmSystems; 17 | class AS_DeviceTable; 18 | class WebSocketServer; 19 | 20 | void AS_HandleAlarmSystemEvent(const Event &event, AlarmSystems &alarmSystems, EventEmitter *eventEmitter, WebSocketServer *webSocket); 21 | void AS_HandleAlarmSystemDeviceEvent(const Event &event, const AS_DeviceTable *devTable, EventEmitter *eventEmitter); 22 | 23 | #endif // ALARM_SYSTEM_EVENT_HANDLER_H 24 | -------------------------------------------------------------------------------- /devices/generic/items/config_checkin_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/checkin", 4 | "datatype": "UInt32", 5 | "access": "RW", 6 | "public": false, 7 | "range": [ 8 | 0, 9 | 4294967295 10 | ], 11 | "default": 14400, 12 | "description": "Configures the check-in interval for the Poll Control cluster (1/4 seconds).", 13 | "parse": { 14 | "fn": "zcl:attr", 15 | "ep": 0, 16 | "cl": "0x0020", 17 | "at": "0x0000", 18 | "eval": "Item.val = Attr.val" 19 | }, 20 | "read": { 21 | "fn": "zcl:attr", 22 | "ep": 0, 23 | "cl": "0x0020", 24 | "at": "0x0000" 25 | }, 26 | "write": { 27 | "fn": "zcl:attr", 28 | "ep": 0, 29 | "cl": "0x0020", 30 | "at": "0x0000", 31 | "dt": "0x23", 32 | "eval": "Item.val" 33 | }, 34 | "refresh.interval": 3600 35 | } 36 | -------------------------------------------------------------------------------- /devices/generic/items/state_colormode_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/colormode", 4 | "datatype": "String", 5 | "access": "R", 6 | "public": true, 7 | "description": "The currently active color mode.", 8 | "values": [ 9 | [ 10 | "\"hs\"", 11 | "hue and saturation" 12 | ], 13 | [ 14 | "\"xy\"", 15 | "CIE xy color space coordinates" 16 | ], 17 | [ 18 | "\"ct\"", 19 | "color temperature" 20 | ] 21 | ], 22 | "parse": { 23 | "fn": "zcl:attr", 24 | "ep": 0, 25 | "cl": "0x0300", 26 | "at": "0x0008", 27 | "eval": "if (Attr.val <= 2) Item.val = ['hs', 'xy', 'ct'][Attr.val]" 28 | }, 29 | "read": { 30 | "fn": "zcl:attr", 31 | "ep": 0, 32 | "cl": "0x0300", 33 | "at": "0x0008" 34 | }, 35 | "refresh.interval": 300 36 | } 37 | -------------------------------------------------------------------------------- /devices/generic/items/config_unoccupiedheatsetpoint_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/unoccupiedheatsetpoint", 4 | "datatype": "Int16", 5 | "access": "RW", 6 | "public": true, 7 | "default": 1800, 8 | "description": "Target temperature of a thermostat when local is unoccupied.", 9 | "refresh.interval": 300, 10 | "read": { 11 | "at": "0x0014", 12 | "cl": "0x0201", 13 | "ep": 1, 14 | "fn": "zcl:attr" 15 | }, 16 | "parse": { 17 | "at": "0x0014", 18 | "cl": "0x0201", 19 | "ep": 1, 20 | "eval": "Item.val = Attr.val;", 21 | "fn": "zcl:attr" 22 | }, 23 | "write": { 24 | "at": "0x0014", 25 | "cl": "0x0201", 26 | "dt": "0x29", 27 | "ep": 1, 28 | "eval": "Item.val", 29 | "fn": "zcl:attr" 30 | }, 31 | "range": [ 32 | 500, 33 | 3200 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /devices/generic/items/config_color_gradient_reversed_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/color/gradient/reversed", 4 | "datatype": "Bool", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Reverse gradient.", 8 | "default": false, 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": "0x0b", 12 | "cl": "0xfc03", 13 | "mf": "0x100b", 14 | "at": "0x0033", 15 | "eval": "Item.val = Attr.val == 1" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": "0x0b", 20 | "cl": "0xfc03", 21 | "mf": "0x100b", 22 | "at": "0x0033" 23 | }, 24 | "refresh.interval": 3600, 25 | "write": { 26 | "fn": "zcl:attr", 27 | "ep": "0x0b", 28 | "cl": "0xfc03", 29 | "mf": "0x100b", 30 | "at": "0x0033", 31 | "dt": "0x20", 32 | "eval": "Item.val ? 1 : 0" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /devices/generic/items/config_color_xy_startup_x_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/color/xy/startup_x", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Color X on device startup (power on).", 8 | "default": "0xffff", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": "0x0b", 12 | "cl": "0x0300", 13 | "mf": "0x100b", 14 | "at": "0x0003", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": "0x0b", 20 | "cl": "0x0300", 21 | "mf": "0x100b", 22 | "at": "0x0003" 23 | }, 24 | "refresh.interval": 3600, 25 | "write": { 26 | "fn": "zcl:attr", 27 | "ep": "0x0b", 28 | "cl": "0x0300", 29 | "mf": "0x100b", 30 | "at": "0x0003", 31 | "dt": "0x21", 32 | "eval": "Item.val" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /devices/generic/items/config_color_xy_startup_y_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/color/xy/startup_y", 4 | "datatype": "UInt16", 5 | "access": "RW", 6 | "public": true, 7 | "description": "Color Y on device startup (power on).", 8 | "default": "0xffff", 9 | "parse": { 10 | "fn": "zcl:attr", 11 | "ep": "0x0b", 12 | "cl": "0x0300", 13 | "mf": "0x100b", 14 | "at": "0x0004", 15 | "eval": "Item.val = Attr.val" 16 | }, 17 | "read": { 18 | "fn": "zcl:attr", 19 | "ep": "0x0b", 20 | "cl": "0x0300", 21 | "mf": "0x100b", 22 | "at": "0x0004" 23 | }, 24 | "refresh.interval": 3600, 25 | "write": { 26 | "fn": "zcl:attr", 27 | "ep": "0x0b", 28 | "cl": "0x0300", 29 | "mf": "0x100b", 30 | "at": "0x0004", 31 | "dt": "0x21", 32 | "eval": "Item.val" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /group_info.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #include "group_info.h" 12 | 13 | /*! Constructor. 14 | */ 15 | GroupInfo::GroupInfo() : 16 | state(StateInGroup), 17 | actions(ActionNone), 18 | id(0), 19 | modifyScenesRetries(0), 20 | m_sceneCount(0) 21 | { 22 | } 23 | 24 | /*! Returns the scene Count. 25 | */ 26 | uint8_t GroupInfo::sceneCount() const 27 | { 28 | return m_sceneCount; 29 | } 30 | 31 | /*! Sets the sceneCount. 32 | \param sceneCount the sceneCount 33 | */ 34 | void GroupInfo::setSceneCount(uint8_t sceneCount) 35 | { 36 | m_sceneCount = sceneCount; 37 | } 38 | -------------------------------------------------------------------------------- /crypto/scrypt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef SCRYPT_H 12 | #define SCRYPT_H 13 | 14 | #include 15 | 16 | struct ScryptParameters 17 | { 18 | int N; 19 | int r; 20 | int p; 21 | std::string salt; 22 | }; 23 | 24 | std::string CRYPTO_GenerateSalt(); 25 | 26 | bool CRYPTO_ParsePhcScryptParameters(const std::string &phcHash, ScryptParameters *param); 27 | std::string CRYPTO_ScryptPassword(const std::string &input, const std::string &salt, int N = 1024, int r = 8, int p = 16); 28 | bool CRYPTO_ScryptVerify(const std::string &phcHash, const std::string &password); 29 | 30 | #endif // SCRYPT_H 31 | -------------------------------------------------------------------------------- /devices/tuya/_TZ3000_TS004F_smart_knob_group_add.js: -------------------------------------------------------------------------------- 1 | // Generate contents for a Group Add command (value 0x00) to a Tuya Smart Knob on the GROUP cluster (ID 0x0004). 2 | // Uses the first defined group (group 0) only, as the device only supports one group at a time. 3 | // Does not check for existing membership, we're unable to send a Group View command from this script. 4 | // global Item (string of comma-separated group ID numbers), R, ZclFrame 5 | 6 | let group = Number(Item.val.split(',')[0]); 7 | 8 | if (isNaN(group)) { 9 | // Group might be "auto", which this script cannot resolve. Don't try to add a group. 10 | throw new TypeError('Invalid group ID: ' + Item.val); 11 | } else { 12 | const group_hexstr = (group & 0xFF).toString(16) + (group >> 8).toString(16).padStart(2, '0'); 13 | const name_hexstr = '00'; // Empty string for the group name 14 | group_hexstr + name_hexstr; 15 | } 16 | -------------------------------------------------------------------------------- /rest_scenes.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #include "de_web_plugin.h" 12 | #include "de_web_plugin_private.h" 13 | 14 | /*! Scenes REST API broker. 15 | \param req - request data 16 | \param rsp - response data 17 | \return REQ_READY_SEND 18 | REQ_NOT_HANDLED 19 | */ 20 | int DeRestPluginPrivate::handleScenesApi(const ApiRequest &req, ApiResponse &rsp) 21 | { 22 | Q_UNUSED(req); 23 | if (rsp.map.isEmpty()) 24 | { 25 | rsp.str = "{}"; // return empty object 26 | } 27 | rsp.httpStatus = HttpStatusOk; 28 | return REQ_READY_SEND; 29 | // return REQ_NOT_HANDLED; 30 | } 31 | -------------------------------------------------------------------------------- /.github/release-drafter-config.yml: -------------------------------------------------------------------------------- 1 | name-template: 'v$RESOLVED_VERSION' 2 | tag-template: 'v$RESOLVED_VERSION' 3 | categories: 4 | - title: 'Device Support' 5 | labels: 6 | - 'Device Request' 7 | - 'Device Improvement' 8 | - title: 'Enhancements' 9 | labels: 10 | - 'Feature Request' 11 | - 'Enhancement' 12 | - title: 'Bug Fixes' 13 | labels: 14 | - 'Fix' 15 | - 'bugfix' 16 | - 'bug' 17 | 18 | change-template: '- $TITLE [#$NUMBER]($URL)' 19 | 20 | include-pre-releases: true 21 | 22 | version-resolver: 23 | major: 24 | labels: 25 | - 'major' 26 | minor: 27 | labels: 28 | - 'minor' 29 | patch: 30 | labels: 31 | - 'patch' 32 | default: patch 33 | template: | 34 | # Contributors: 35 | The following users have been contributing to this release. Thank you for that!
36 | $CONTRIBUTORS
37 | # Changes 38 | $CHANGES 39 | -------------------------------------------------------------------------------- /simple_metering.h: -------------------------------------------------------------------------------- 1 | #ifndef SIMPLE_METERING_H 2 | #define SIMPLE_METERING_H 3 | 4 | #include "utils/utils.h" 5 | 6 | //Attribute IDs 7 | #define METERING_ATTRID_CURRENT_SUMMATION_DELIVERED 0x0000 8 | #define METERING_ATTRID_PULSE_CONFIGURATION 0x0300 // Develco specific 9 | #define METERING_ATTRID_INTERFACE_MODE 0x0302 // Develco specific 10 | #define METERING_ATTRID_INSTANTANEOUS_DEMAND 0x0400 11 | 12 | // Values for attribute Interface Mode (0x0302), Develco specific 13 | #define NORWEGIAN_HAN 0x0200 14 | #define NORWEGIAN_HAN_EXTRA_LOAD 0x0201 15 | #define AIDON_METER 0x0202 16 | #define KAIFA_KAMSTRUP_METERS 0x0203 17 | #define AUTO_DETECT 0x0204 18 | 19 | extern const std::array RConfigInterfaceModeValuesEMIZB; 20 | 21 | #endif // SIMPLE_METERING_H 22 | -------------------------------------------------------------------------------- /resourcelinks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | #ifndef RESOURCELINKS_H 11 | #define RESOURCELINKS_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | /*! \class Resourcelinks 18 | 19 | Represents REST API resourcelinks. 20 | */ 21 | class Resourcelinks 22 | { 23 | public: 24 | enum State { StateNormal, StateDeleted }; 25 | Resourcelinks(); 26 | bool needSaveDatabase() const; 27 | void setNeedSaveDatabase(bool needSave); 28 | 29 | State state; 30 | QString id; 31 | QVariantMap data; 32 | 33 | private: 34 | bool m_needSaveDatabase; 35 | }; 36 | 37 | #endif // RESOURCELINKS_H 38 | -------------------------------------------------------------------------------- /gateway_scanner.h: -------------------------------------------------------------------------------- 1 | #ifndef GATEWAYSCANNER_H 2 | #define GATEWAYSCANNER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class GatewayScannerPrivate; 9 | 10 | class GatewayScanner : public QObject 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit GatewayScanner(QObject *parent = 0); 15 | ~GatewayScanner(); 16 | bool isRunning() const; 17 | void queryGateway(const QString &url); 18 | 19 | Q_SIGNALS: 20 | void foundGateway(const QHostAddress &host, quint16 port, const QString &uuid, const QString &name); 21 | 22 | public Q_SLOTS: 23 | void startScan(); 24 | 25 | private Q_SLOTS: 26 | void scanTimerFired(); 27 | void requestFinished(QNetworkReply *reply); 28 | void onError(QNetworkReply::NetworkError code); 29 | 30 | private: 31 | Q_DECLARE_PRIVATE(GatewayScanner) 32 | GatewayScannerPrivate *d_ptr; 33 | }; 34 | 35 | #endif // GATEWAYSCANNER_H 36 | -------------------------------------------------------------------------------- /devices/generic/items/state_action_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "state/action", 4 | "datatype": "String", 5 | "access": "RW", 6 | "public": true, 7 | "managed": true, 8 | "description": "The IAS arm action.", 9 | "default": "disarmed", 10 | "values": [ 11 | [ 12 | "\"disarmed\"", 13 | "disarmed not triggering alarm" 14 | ], 15 | [ 16 | "\"armed_stay\"", 17 | "trigger in stay mode" 18 | ], 19 | [ 20 | "\"armed_night\"", 21 | "trigger in night mode" 22 | ], 23 | [ 24 | "\"armed_away\"", 25 | "trigger in away mode" 26 | ], 27 | [ 28 | "\"invalid_code\"", 29 | "invalid code was entered" 30 | ], 31 | [ 32 | "\"not_ready\"", 33 | "alarm system not ready" 34 | ], 35 | [ 36 | "\"already_disarmed\"", 37 | "attempt to disarm was ignored" 38 | ] 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /rest_alarmsystems.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef REST_ALARMSYSTEMS_H 12 | #define REST_ALARMSYSTEMS_H 13 | 14 | #include 15 | 16 | class ApiRequest; 17 | class ApiResponse; 18 | class EventEmitter; 19 | class AlarmSystems; 20 | 21 | /*! Alarm systems REST API broker. 22 | \param req - request data 23 | \param rsp - response data 24 | \return REQ_READY_SEND 25 | REQ_NOT_HANDLED 26 | */ 27 | int AS_handleAlarmSystemsApi(const ApiRequest &req, ApiResponse &rsp, AlarmSystems &alarmSystems, EventEmitter *eventEmitter); 28 | QVariantMap AS_AlarmSystemsToMap(const AlarmSystems &alarmSystems); 29 | 30 | #endif // REST_ALARMSYSTEMS_H 31 | -------------------------------------------------------------------------------- /read_files.h: -------------------------------------------------------------------------------- 1 | #ifndef READ_FILES_H 2 | #define READ_FILES_H 3 | 4 | #include 5 | #include "button_maps.h" 6 | 7 | QJsonDocument readButtonMapJson(const QString &path); 8 | bool checkRootLevelObjectsJson(const QJsonDocument &buttonMaps, const QStringList &requiredObjects); 9 | std::vector loadButtonMapClustersJson(const QJsonDocument &buttonMaps); 10 | std::vector loadButtonMapCommadsJson(const QJsonDocument &buttonMaps); 11 | std::vector loadButtonMapModelIdsJson(const QJsonDocument &buttonMapsDoc, const std::vector &buttonMaps); 12 | std::vector loadButtonMetaJson(const QJsonDocument &buttonMapsDoc, const std::vector &buttonMaps); 13 | std::vector loadButtonMapsJson(const QJsonDocument &buttonMaps, const std::vector &btnMapClusters, const std::vector &btnMapClusterCommands); 14 | 15 | #endif // READ_FILES_H 16 | -------------------------------------------------------------------------------- /devices/generic/items/config_windowcoveringtype_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "resourceitem1.schema.json", 3 | "id": "config/windowcoveringtype", 4 | "datatype": "UInt8", 5 | "access": "RW", 6 | "public": true, 7 | "description": "The window cover type.", 8 | "default": 0, 9 | "values": [ 10 | [ 11 | 0, 12 | "Roller Shade" 13 | ], 14 | [ 15 | 1, 16 | "Roller Shade two motors" 17 | ], 18 | [ 19 | 2, 20 | "Roller Shade exterior" 21 | ], 22 | [ 23 | 3, 24 | "Roller Shade two motors ext" 25 | ], 26 | [ 27 | 4, 28 | "Drapery" 29 | ], 30 | [ 31 | 5, 32 | "Awning" 33 | ], 34 | [ 35 | 6, 36 | "Shutter" 37 | ], 38 | [ 39 | 7, 40 | "Tilt Blind Lift only" 41 | ], 42 | [ 43 | 8, 44 | "Tilt Blind lift & tilt" 45 | ], 46 | [ 47 | 9, 48 | "Projector Screen" 49 | ] 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /device_ddf_bundle.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICE_DDF_BUNDLE_H 2 | #define DEVICE_DDF_BUNDLE_H 3 | 4 | #include "deconz/u_bstream.h" 5 | #include "deconz/u_sha256.h" 6 | 7 | #define MAX_BUNDLE_SIZE (1 << 20) // 1 MB 8 | 9 | struct DDFB_ExtfChunk 10 | { 11 | struct DDFB_ExtfChunk *next; 12 | char fileType[5]; // fourcc + '\0' 13 | char emptyString; 14 | unsigned pathLength; 15 | const char *path; 16 | unsigned modificationTimeLength; 17 | const char *modificationTime; 18 | unsigned fileSize; 19 | unsigned char *fileData; 20 | }; 21 | 22 | int DDFB_FindChunk(U_BStream *bs, const char *tag, unsigned *size); 23 | int DDFB_IsChunk(U_BStream *bs, const char *tag); 24 | int DDFB_SkipChunk(U_BStream *bs); 25 | int DDFB_ReadExtfChunk(U_BStream *bs, DDFB_ExtfChunk *extf); 26 | int IsValidDDFBundle(U_BStream *bs, unsigned char sha256[U_SHA256_HASH_SIZE]); 27 | bool DDFB_SanitizeBundleHashString(char *str, unsigned len); 28 | 29 | 30 | #endif // DEVICE_DDF_BUNDLE_H 31 | -------------------------------------------------------------------------------- /ikea-ota-download.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Snipped to download current IKEA ZLL OTA files into ~/otau 4 | compatible with python 3. 5 | """ 6 | 7 | import os 8 | import json 9 | try: 10 | from urllib.request import urlopen, urlretrieve 11 | except ImportError: 12 | from urllib2 import urlopen 13 | from urllib import urlretrieve 14 | 15 | 16 | f = urlopen("http://fw.ota.homesmart.ikea.net/feed/version_info.json") 17 | data = f.read() 18 | 19 | arr = json.loads(data.decode('utf-8')) 20 | 21 | otapath = '%s/otau' % os.path.expanduser('~') 22 | 23 | if not os.path.exists(otapath): 24 | os.makedirs(otapath) 25 | 26 | for i in arr: 27 | if 'fw_binary_url' in i: 28 | url = i['fw_binary_url'] 29 | ls = url.split('/') 30 | fname = ls[len(ls) - 1] 31 | path = '%s/%s' % (otapath, fname) 32 | 33 | if not os.path.isfile(path): 34 | urlretrieve(url, path) 35 | print(path) 36 | else: 37 | print('%s already exists' % fname) 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /devices/generic/subdevices/color_temperature_light.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": "subdevice1.schema.json", 3 | "type": "$TYPE_COLOR_TEMPERATURE_LIGHT", 4 | "name": "Color temperature light", 5 | "ui_name": "Color temperature light", 6 | "restapi": "/lights", 7 | "order": 11, 8 | "uuid": [ 9 | "$address.ext", 10 | "0x01" 11 | ], 12 | "items": [ 13 | "cap/color/capabilities", 14 | "cap/color/ct/max", 15 | "cap/color/ct/min", 16 | "state/alert", 17 | "state/bri", 18 | "state/colormode", 19 | "state/ct", 20 | "state/on", 21 | "state/reachable" 22 | ], 23 | "items_optional": [ 24 | "cap/alert/trigger_effect", 25 | "cap/bri/move_with_onoff", 26 | "cap/groups/not_supported", 27 | "cap/on/off_with_effect", 28 | "cap/transition_block", 29 | "config/bri/execute_if_off", 30 | "config/bri/startup", 31 | "config/color/ct/startup", 32 | "config/color/execute_if_off", 33 | "config/on/startup" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /utils/scratchmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef SCRATCHMEM_H 12 | #define SCRATCHMEM_H 13 | 14 | void ScratchMemInit(void); 15 | void ScratchMemDestroy(void); 16 | unsigned long ScratchMemPos(void); 17 | void *ScratchMemAlloc(unsigned long); 18 | void ScratchMemRewind(unsigned long); 19 | 20 | 21 | #define SCRATCH_ALLOC(type, size) (static_cast(ScratchMemAlloc(size))) 22 | 23 | /* helper to restore scratch position on stack unwind */ 24 | class ScratchMemWaypoint 25 | { 26 | public: 27 | ScratchMemWaypoint() { m_pos = ScratchMemPos(); } 28 | ~ScratchMemWaypoint() { ScratchMemRewind(m_pos); } 29 | 30 | private: 31 | unsigned long m_pos; 32 | }; 33 | 34 | 35 | #endif // SCRATCHMEM_H 36 | -------------------------------------------------------------------------------- /product_match.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021-2025 dresden elektronik ingenieurtechnik gmbh. 3 | * All rights reserved. 4 | * 5 | * The software in this package is published under the terms of the BSD 6 | * style license a copy of which has been included with this distribution in 7 | * the LICENSE.txt file. 8 | * 9 | */ 10 | 11 | #ifndef PRODUCT_MATCH_H 12 | #define PRODUCT_MATCH_H 13 | 14 | #include 15 | 16 | class Resource; 17 | 18 | struct lidlDevice { 19 | const char *zigbeeManufacturerName; 20 | const char *zigbeeModelIdentifier; 21 | const char *manufacturername; 22 | const char *modelid; 23 | }; 24 | 25 | const QString R_GetProductId(Resource *resource); 26 | bool isTuyaManufacturerName(const QString &manufacturer); 27 | bool isLidlDevice(const QString &zigbeeModelIdentifier, const QString &manufacturername); 28 | const lidlDevice *getLidlDevice(const QString &zigbeeManufacturerName); 29 | unsigned int productHash(const Resource *r); 30 | 31 | #endif // PRODUCT_MATCH_H 32 | -------------------------------------------------------------------------------- /.github/workflows/staleAction.yml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues and PRs' 2 | on: 3 | schedule: 4 | - cron: '30 1 * * *' 5 | workflow_dispatch: 6 | 7 | 8 | jobs: 9 | stale: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/stale@v3 13 | with: 14 | stale-issue-message: 'As there has not been any response in 21 days, this issue has been automatically marked as stale. **At OP: Please either close this issue or keep it active** It will be closed in 7 days if no further activity occurs.' 15 | stale-issue-label: 'stale' 16 | exempt-issue-labels: 'To-Do,Backlog,Feature Request,Awaiting Merge,Announcement,Confirmed Bug' 17 | days-before-stale: 21 18 | days-before-close: 7 19 | remove-stale-when-updated: true 20 | close-issue-message: 'As there has not been any response in 28 days, this issue will be closed. **@ OP: If this issue is solved post what fixed it for you. If it is not solved, request to get this opened again.**' 21 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 21 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - To-Do 8 | - Backlog 9 | - Feature Request 10 | - Awaiting Merge 11 | - Announcement 12 | # Label to use when marking an issue as stale 13 | staleLabel: stale 14 | # Comment to post when marking an issue as stale. Set to `false` to disable 15 | markComment: > 16 | As there hasn't been any response in 21 days, this issue has been automatically marked as stale. **At OP: Please either close this issue or keep it active** 17 | It will be closed in 7 days if no further activity occurs. 18 | # Comment to post when closing a stale issue. Set to `false` to disable 19 | closeComment: > 20 | As there hasn't been any response in 28 days, this issue will be closed. **@ OP: If this issue is solved post what fixed it for you. If it isn't solved, request to get this opened again.** 21 | 22 | 23 | --------------------------------------------------------------------------------