Skip to content

Instantly share code, notes, and snippets.

@florian-asche
Created January 29, 2021 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save florian-asche/9ec686e09aa4cb95d38a369dee3b12cf to your computer and use it in GitHub Desktop.
Save florian-asche/9ec686e09aa4cb95d38a369dee3b12cf to your computer and use it in GitHub Desktop.
FHEM - Zigbee Heating Example - Archetype
define dev_zigbee_heating_0x5c0272fffec265a6 MQTT2_DEVICE
attr dev_zigbee_heating_0x5c0272fffec265a6 archetypeFilter ZIGBEE-HEATING
attr dev_zigbee_heating_0x5c0272fffec265a6 alias Heizung - Schlafzimmer
attr dev_zigbee_heating_0x5c0272fffec265a6 room Alle
attr dev_zigbee_heating_0x5c0272fffec265a6 group Heizung
attr dev_zigbee_heating_0x5c0272fffec265a6 deviceID 0x5c0272fffec265a6
attr dev_zigbee_heating_0x5c0272fffec265a6 readingList zigbee2mqtt/0x5c0272fffec265a6:.* { my %h;;;; my $temp = $EVENT;;;; $temp =~ s/,?("(holidays|workdays)":.([^]]+))./$h{$2}=$3/ge;;;; $EVENT =~ s/,?("(holidays|workdays)":.([^]]+)).//g;;;; my $h2 = json2nameValue($EVENT,'',$JSONMAP);;;; %h = (%h,%$h2);;;; \%h }
#####################
# EXAMPLE - HEATING #
#####################
define archetype_zigbee_heating archetype TYPE=MQTT2_DEVICE:FILTER=archetypeFilter=ZIGBEE-HEATING
attr archetype_zigbee_heating userattr userattr weekprofile periodicCmd IODev stateFormat DbLogExclude devStateIcon event-min-interval event-on-change-reading group icon jsonMap lightSceneParamsToSave retain setList readingList useSetExtensions webCmd widgetOverride setStateList userReadings
attr archetype_zigbee_heating IODev mqtt2server
attr archetype_zigbee_heating DbLogInclude desired-temp,measured-temp,position,batteryPercent
attr archetype_zigbee_heating devStateIcon LOCKED:secur_locked:child_lock+UNLOCK UNLOCKED:secur_open:child_lock+LOCK
attr archetype_zigbee_heating event-min-interval (desired-temp|measured-temp|position|batteryPercent):1800
attr archetype_zigbee_heating event-on-change-reading (desired-temp|measured-temp|position|batteryPercent)
attr archetype_zigbee_heating icon temp_control
attr archetype_zigbee_heating jsonMap\
current_heating_setpoint:desired-temp\
local_temperature:measured-temp\
Battery:batteryPercent\
preset:mode
attr archetype_zigbee_heating lightSceneParamsToSave desired-temp
attr archetype_zigbee_heating retain 1
attr archetype_zigbee_heating actual_setList\
desired-temp:slider,5.0,0.5,30.0,1 zigbee2mqtt/%deviceID%/set {"current_heating_setpoint": $EVTPART1 }\
child_lock:LOCK,UNLOCK zigbee2mqtt/%deviceID%/set {"child_lock": "$EVTPART1"}\
boost:noArg zigbee2mqtt/%deviceID%/set {"preset": "boost"}\
mode:schedule,manual,boost,complex,comfort,eco zigbee2mqtt/%deviceID%/set {"preset": "$EVTPART1"}\
holidays zigbee2mqtt/%deviceID%/set/schedule { "holidays":[$EVTPART1] }\
workdays zigbee2mqtt/%deviceID%/set/schedule { "workdays":[$EVTPART1] }\
week:5+2,6+1,7 zigbee2mqtt/%deviceID%/set $EVTPART1\
weekprofile { FHEM::attrT_z2m_thermostat_Utils::z2t_send_weekprofile($NAME, $EVTPART1, $EVTPART2) }\
x_send_set_payload:textField { my $payload = $EVENT;;;;$payload =~ s/$EVTPART0 //;;;; qq(zigbee2mqtt/%deviceID%/set $payload)}
attr archetype_zigbee_heating actual_getList\
desired-temp:noArg desired-temp zigbee2mqtt/%deviceID%/get {"current_heating_setpoint": ""}\
measured-temp:noArg measured-temp zigbee2mqtt/%deviceID%/get {"local_temperature": ""}\
mode:noArg mode zigbee2mqtt/%deviceID%/get {"preset": ""}
#attr archetype_zigbee_heating actual_readingList zigbee2mqtt/%deviceID%:.* { my %h;;;; my $temp = $EVENT;;;; $temp =~ s/,?("(holidays|workdays)":.([^]]+))./$h{$2}=$3/ge;;;; $EVENT =~ s/,?("(holidays|workdays)":.([^]]+)).//g;;;; my $h2 = json2nameValue($EVENT,'',$JSONMAP);;;; %h = (%h,%$h2);;;; \%h }
attr archetype_zigbee_heating periodicCmd measured-temp:55
attr archetype_zigbee_heating useSetExtensions 1
attr archetype_zigbee_heating webCmd desired-temp
attr archetype_zigbee_heating widgetOverride desired-temp:knob,min:5,max:30,angleArc:180,width:40,height:40,fgColor:#FF9900,bgColor:#CCCCCC,step:0.5,lineCap:round,angleOffset:225
attr archetype_zigbee_heating weekprofile dev_zigbee_heating_%deviceID%
attr archetype_zigbee_heating setStateList on off
attr archetype_zigbee_heating stateFormat\
child_lock\
Mode: mode\
Measured: measured-temp\
Desired: desired-temp\
Position: position
#SELF
attr archetype_zigbee_heating room System
attr archetype_zigbee_heating attributes userattr weekprofile periodicCmd setStateList stateFormat getList IODev DbLogExclude devStateIcon event-min-interval event-on-change-reading group icon jsonMap lightSceneParamsToSave retain setList readingList useSetExtensions webCmd widgetOverride setStateList userReadings
attr archetype_zigbee_heating attributesExclude attributes attributesExclude room
#attr archetype_zigbee_heating delteAttributes 0
#attr archetype_zigbee_heating defined_by archetype.archetype_zigbee_heating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment