Sorry ich bin was das coden betrifft einfach total unbegabt.
Ich habe über eine tuya zu mqtt bridge meine tuya steckdosen von der cloud befreit (tasmota geht leider bei denen nicht mehr) und kann diese nun per mqtt steuern.
Bei der Integration der Geräte habe ich nun mit den Feinheiten zu kämpfen.
Ein device sieht derzeit so aus:
Internals:
DEF
FUUID 6359a455-f33f-5f80-0c25-4156bed29d5dc98e
IODev myBroker
LASTInputDev myBroker
MSGCNT 107
NAME homeoffice
NR 268
STATE false
TYPE MQTT2_DEVICE
eventCount 137
myBroker_MSGCNT 107
myBroker_TIME 2022-10-28 00:42:26
OLDREADINGS:
READINGS:
2022-10-27 23:11:42 IODev myBroker
2022-10-28 00:42:26 state false
Attributes:
alias Homeoffice
devStateIcon devStateIcon on:light_light_dim_100@green off:off@red
genericDeviceType switch
group Steckdosen
icon message_socket
readingList tuya/homeoffice/dps/1/state:.* state
room Keller,MQTT,Steckdosen
setList off:noArg tuya/homeoffice/dps/1/command false
on:noArg tuya/homeoffice/dps/1/command true
webCmd on:off
Damit kann ich zumindest via FHEM schalten und auch Schaltungen über andere Systeme (Alexa via TuyaCloud) werden auch in FHEM registriert.
Allerdings bekomme ich mit der Einstellung immer nur den Wert "false" bzw. "true" für das Reading state. Ich hätte aber gerne on und off.
wenn ich aber ein eventmap true:on und false:off anlege, passt das Reading aber ich kann nicht mehr per WebCmd schalten. Es kommt dann folgende Meldung Unknown argument true, choose one of off:noArg on:noArg off-till off-for-timer off-till-overnight intervals on-till-overnight on-till blink on-for-timer toggle attrTemplate:?,General_Info,MQTT2_CLIENT_general_bridge,MQTT2_mosquitto_SYS,MQTT2_IO_ignoreRegexp_basic,MQTT2_IO_ignoreRegexp_tasmota,MQTT2_IO_ignoreRegexp_shelly,MQTT2_IO_ignoreRegexp_homeassistant,speechcontrol_general_naming_master_template,tasmota_basic,tasmota_basic_state_power1,tasmota_1ch+motion+SI7021,tasmota_POW,tasmota_POW_USB_split,tasmota_plug_with_rgbw_split,tasmota_plug_with_rgb_split,tasmota_ir,tasmota_rf,tasmota_rf_keys_example,tasmota_use_DS18x20_id,tasmota_zigbee2tasmota_bridge,tasmota_clear_readings_reset_readingsList_and_reboot,tasmota_set_lowercase_texts_and_state1,tasmota_set_uppercase_texts_and_state1,tasmota_set_power1_state_to_power,tasmota_2channel_split,tasmota_2ch_unified,tasmota_2channel_split_energy,tasmota_NSPanel_split,tasmota_2ch_shutter_invert_1,tasmota_2ch_shutter_invert_0,tasmota_4ch_two_shutters_invert_0,tasmota_2ch_shutter_venetian_invert_0,tasmota_3channel_input_shelly_i3,tasmota_4channel_split,tasmota_3socketUSB_split,tasmota_4ch_unified_basic_text,tasmota_4ch_unified_icon,tasmota_8ch_unified_icon,tasmota_8channel_split,tasmota_rgb_led_controller,tasmota_rgbw_led,tasmota_rgbcct_light,tasmota_cct_led,tasmota_TuyaMCU_dimmer,tasmota_window_sensor_MC400A,tasmota_bt2tasmota_bridge,shelly1,shellyPlus_1,shellyPlus_1pm,shellyPlus_2pm_roller_invert_0,shellypro4pm,shellyPlus_i4,ESPurna_single_relay,eBus_daemon_splitter,ebus_update_files_from_svn,ems-esp_heater_device,ems-esp_boiler,ems-esp_thermostat_read-only,ems-esp_thermostat_RC35_type,ems-esp_thermostat_simple,WThermostatBeca,zigbee2mqtt_bridge,sonos2mqtt_bridge,sonos2mqtt_speaker,sonos2mqtt_bridge_comfort,roon,InstarCam,wled_controller,go_eCharger,go_eCharger_old,8channel_ethernet_board_split,8channel_ethernet_board_unified,6channel_ethernet_board_6input_split,6channel_ethernet_board_6input_unified,8channel_relay_board_8di_split,hoymiles_microinverter_hub_bridge,esp_milight_hub_bridge,OpenMQTTGateway_MCU,valetudo,worx_landroid,wallpanel_app,weewx_weather_station,McLighting
Vielleicht hat jemand ne idee
versuch mal so:
attr homeoffice readingList tuya/homeoffice/dps/1/state:.* { $EVENT eq 'false' ? 'off' : 'on';}
attr homeoffice readingList tuya/homeoffice/dps/1/state:.* { my $onoff= $EVENT eq 'false' ? 'off' : 'on';my $ret->{state} = "$onoff"; return $ret}
Danke dir, funktioniert!