Report helpers for every tier-1 property, asset ids, AlexaCapability::isValid()
AlexaStatusMessage gets a helper for color, percentage, power level, range, mode, lock state, contact, motion, humidity and the thermostat (target, lower and upper setpoint, mode), and addProperty(row, place, value) for a property without one. Each is a function of its own on one shared builder; a value outside of the range of its property is reported as the nearest of the range with an error. AlexaResources.h holds the 103 asset ids of resources-and-assets.html (AlexaAssets, AlexaUnits); AlexaState has the seven states that were missing; addStateMapping() takes a number of any type. A setter that refuses its argument makes isValid() false, and the capability is left out of discovery with an error instead of being announced without what was refused. basicLight: static RAM 30,520 B (was 30,540), flash 333,389 B (was 334,981); 130 host tests (was 112). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
3215457f91
commit
77156ffbe5
10 changed files with 995 additions and 100 deletions
141
src/AlexaResources.h
Normal file
141
src/AlexaResources.h
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
// The names Alexa has in its own catalog, which it translates into the language of the user: the assets of
|
||||
// resources-and-assets.html under https://developer.amazon.com/en-US/docs/alexa/device-apis/
|
||||
//
|
||||
// capability->addFriendlyAsset(AlexaAssets::Setting_Opening);
|
||||
// configuration["unitOfMeasure"] = FPSTR(AlexaUnits::Percent);
|
||||
// labelOfAMode["value"]["assetId"] = FPSTR(AlexaAssets::Value_Open);
|
||||
//
|
||||
// Every id is a string in program memory that belongs to the file which includes this one: an id that the sketch
|
||||
// does not name takes no room in it. The words a user says and the states Alexa names, "Alexa.Actions.Open" and
|
||||
// "Alexa.States.Closed", are AlexaAction and AlexaState in AlexaCapability.h.
|
||||
#ifndef ALEXA_RESOURCES_H
|
||||
#define ALEXA_RESOURCES_H
|
||||
|
||||
#include "AlexaCompat.h"
|
||||
|
||||
#define ALEXA_RESOURCE(name, id) static const char name[] PROGMEM = id;
|
||||
|
||||
namespace AlexaAssets
|
||||
{
|
||||
// What a device does, as the name of a mode or a preset. Not the actions of an action mapping.
|
||||
ALEXA_RESOURCE(Actions_Charge, "Alexa.Actions.Charge")
|
||||
ALEXA_RESOURCE(Actions_Clean, "Alexa.Actions.Clean")
|
||||
ALEXA_RESOURCE(Actions_Dispense, "Alexa.Actions.Dispense")
|
||||
ALEXA_RESOURCE(Actions_Dock, "Alexa.Actions.Dock")
|
||||
ALEXA_RESOURCE(Actions_Empty, "Alexa.Actions.Empty")
|
||||
ALEXA_RESOURCE(Actions_Mop, "Alexa.Actions.Mop")
|
||||
ALEXA_RESOURCE(Actions_Skip, "Alexa.Actions.Skip")
|
||||
ALEXA_RESOURCE(Actions_Sweep, "Alexa.Actions.Sweep")
|
||||
ALEXA_RESOURCE(Actions_Vacuum, "Alexa.Actions.Vacuum")
|
||||
|
||||
// The buttons of a remote and how they are pressed, for Alexa.SimpleEventSource
|
||||
ALEXA_RESOURCE(Button_OffButton, "Alexa.Button.OffButton")
|
||||
ALEXA_RESOURCE(Button_OnButton, "Alexa.Button.OnButton")
|
||||
ALEXA_RESOURCE(Button_BrightenButton, "Alexa.Button.BrightenButton")
|
||||
ALEXA_RESOURCE(Button_DimButton, "Alexa.Button.DimButton")
|
||||
ALEXA_RESOURCE(Button_MainButton, "Alexa.Button.MainButton")
|
||||
ALEXA_RESOURCE(Button_TopButton, "Alexa.Button.TopButton")
|
||||
ALEXA_RESOURCE(Button_BottomButton, "Alexa.Button.BottomButton")
|
||||
ALEXA_RESOURCE(Button_CenterButton, "Alexa.Button.CenterButton")
|
||||
ALEXA_RESOURCE(Button_MiddleButton, "Alexa.Button.MiddleButton")
|
||||
ALEXA_RESOURCE(Button_UpButton, "Alexa.Button.UpButton")
|
||||
ALEXA_RESOURCE(Button_DownButton, "Alexa.Button.DownButton")
|
||||
ALEXA_RESOURCE(Button_LeftButton, "Alexa.Button.LeftButton")
|
||||
ALEXA_RESOURCE(Button_RightButton, "Alexa.Button.RightButton")
|
||||
ALEXA_RESOURCE(Button_FirstButton, "Alexa.Button.FirstButton")
|
||||
ALEXA_RESOURCE(Button_SecondButton, "Alexa.Button.SecondButton")
|
||||
ALEXA_RESOURCE(Button_ThirdButton, "Alexa.Button.ThirdButton")
|
||||
ALEXA_RESOURCE(Button_FourthButton, "Alexa.Button.FourthButton")
|
||||
ALEXA_RESOURCE(Button_FifthButton, "Alexa.Button.FifthButton")
|
||||
ALEXA_RESOURCE(Button_SixthButton, "Alexa.Button.SixthButton")
|
||||
ALEXA_RESOURCE(Button_SeventhButton, "Alexa.Button.SeventhButton")
|
||||
ALEXA_RESOURCE(Button_EighthButton, "Alexa.Button.EighthButton")
|
||||
ALEXA_RESOURCE(Button_SinglePress, "Alexa.Button.SinglePress")
|
||||
ALEXA_RESOURCE(Button_SinglePush, "Alexa.Button.SinglePush")
|
||||
ALEXA_RESOURCE(Button_DoublePress, "Alexa.Button.DoublePress")
|
||||
ALEXA_RESOURCE(Button_DoublePush, "Alexa.Button.DoublePush")
|
||||
ALEXA_RESOURCE(Button_LongPress, "Alexa.Button.LongPress")
|
||||
ALEXA_RESOURCE(Button_LongPush, "Alexa.Button.LongPush")
|
||||
|
||||
ALEXA_RESOURCE(DeviceName_AirPurifier, "Alexa.DeviceName.AirPurifier")
|
||||
ALEXA_RESOURCE(DeviceName_Camera, "Alexa.DeviceName.Camera")
|
||||
ALEXA_RESOURCE(DeviceName_Fan, "Alexa.DeviceName.Fan")
|
||||
ALEXA_RESOURCE(DeviceName_Router, "Alexa.DeviceName.Router")
|
||||
ALEXA_RESOURCE(DeviceName_Shade, "Alexa.DeviceName.Shade")
|
||||
ALEXA_RESOURCE(DeviceName_Shower, "Alexa.DeviceName.Shower")
|
||||
ALEXA_RESOURCE(DeviceName_SpaceHeater, "Alexa.DeviceName.SpaceHeater")
|
||||
ALEXA_RESOURCE(DeviceName_Washer, "Alexa.DeviceName.Washer")
|
||||
|
||||
ALEXA_RESOURCE(Gesture_SingleClick, "Alexa.Gesture.SingleClick")
|
||||
ALEXA_RESOURCE(Gesture_DoubleClick, "Alexa.Gesture.DoubleClick")
|
||||
ALEXA_RESOURCE(Gesture_Tap, "Alexa.Gesture.Tap")
|
||||
ALEXA_RESOURCE(Gesture_DoubleTap, "Alexa.Gestures.DoubleTap") // "Gestures": the id as the page has it
|
||||
ALEXA_RESOURCE(Gesture_SwipeUp, "Alexa.Gesture.SwipeUp")
|
||||
ALEXA_RESOURCE(Gesture_SwipeDown, "Alexa.Gesture.SwipeDown")
|
||||
ALEXA_RESOURCE(Gesture_SwipeLeft, "Alexa.Gesture.SwipeLeft")
|
||||
ALEXA_RESOURCE(Gesture_SwipeRight, "Alexa.Gesture.SwipeRight")
|
||||
|
||||
ALEXA_RESOURCE(Setting_2GGuestWiFi, "Alexa.Setting.2GGuestWiFi")
|
||||
ALEXA_RESOURCE(Setting_5GGuestWiFi, "Alexa.Setting.5GGuestWiFi")
|
||||
ALEXA_RESOURCE(Setting_Auto, "Alexa.Setting.Auto")
|
||||
ALEXA_RESOURCE(Setting_Direction, "Alexa.Setting.Direction")
|
||||
ALEXA_RESOURCE(Setting_DryCycle, "Alexa.Setting.DryCycle")
|
||||
ALEXA_RESOURCE(Setting_FanSpeed, "Alexa.Setting.FanSpeed")
|
||||
ALEXA_RESOURCE(Setting_GuestWiFi, "Alexa.Setting.GuestWiFi")
|
||||
ALEXA_RESOURCE(Setting_Heat, "Alexa.Setting.Heat")
|
||||
ALEXA_RESOURCE(Setting_Mode, "Alexa.Setting.Mode")
|
||||
ALEXA_RESOURCE(Setting_Night, "Alexa.Setting.Night")
|
||||
ALEXA_RESOURCE(Setting_Opening, "Alexa.Setting.Opening")
|
||||
ALEXA_RESOURCE(Setting_Oscillate, "Alexa.Setting.Oscillate")
|
||||
ALEXA_RESOURCE(Setting_Preset, "Alexa.Setting.Preset")
|
||||
ALEXA_RESOURCE(Setting_Quiet, "Alexa.Setting.Quiet")
|
||||
ALEXA_RESOURCE(Setting_Temperature, "Alexa.Setting.Temperature")
|
||||
ALEXA_RESOURCE(Setting_WashCycle, "Alexa.Setting.WashCycle")
|
||||
ALEXA_RESOURCE(Setting_WaterTemperature, "Alexa.Setting.WaterTemperature")
|
||||
|
||||
ALEXA_RESOURCE(Shower_HandHeld, "Alexa.Shower.HandHeld")
|
||||
ALEXA_RESOURCE(Shower_RainHead, "Alexa.Shower.RainHead")
|
||||
|
||||
// The names of modes and presets
|
||||
ALEXA_RESOURCE(Value_Open, "Alexa.Value.Open")
|
||||
ALEXA_RESOURCE(Value_Close, "Alexa.Value.Close")
|
||||
ALEXA_RESOURCE(Value_Minimum, "Alexa.Value.Minimum")
|
||||
ALEXA_RESOURCE(Value_Low, "Alexa.Value.Low")
|
||||
ALEXA_RESOURCE(Value_Medium, "Alexa.Value.Medium")
|
||||
ALEXA_RESOURCE(Value_High, "Alexa.Value.High")
|
||||
ALEXA_RESOURCE(Value_Maximum, "Alexa.Value.Maximum")
|
||||
ALEXA_RESOURCE(Value_Delicate, "Alexa.Value.Delicate")
|
||||
ALEXA_RESOURCE(Value_QuickWash, "Alexa.Value.QuickWash")
|
||||
}
|
||||
|
||||
// What the value of a range is measured in: "unitOfMeasure" in the configuration of Alexa.RangeController
|
||||
namespace AlexaUnits
|
||||
{
|
||||
ALEXA_RESOURCE(Angle_Degrees, "Alexa.Unit.Angle.Degrees")
|
||||
ALEXA_RESOURCE(Angle_Radians, "Alexa.Unit.Angle.Radians")
|
||||
ALEXA_RESOURCE(Distance_Feet, "Alexa.Unit.Distance.Feet")
|
||||
ALEXA_RESOURCE(Distance_Inches, "Alexa.Unit.Distance.Inches")
|
||||
ALEXA_RESOURCE(Distance_Kilometers, "Alexa.Unit.Distance.Kilometers")
|
||||
ALEXA_RESOURCE(Distance_Meters, "Alexa.Unit.Distance.Meters")
|
||||
ALEXA_RESOURCE(Distance_Miles, "Alexa.Unit.Distance.Miles")
|
||||
ALEXA_RESOURCE(Distance_Yards, "Alexa.Unit.Distance.Yards")
|
||||
ALEXA_RESOURCE(Mass_Grams, "Alexa.Unit.Mass.Grams")
|
||||
ALEXA_RESOURCE(Mass_Kilograms, "Alexa.Unit.Mass.Kilograms")
|
||||
ALEXA_RESOURCE(Percent, "Alexa.Unit.Percent")
|
||||
ALEXA_RESOURCE(Temperature_Celsius, "Alexa.Unit.Temperature.Celsius")
|
||||
ALEXA_RESOURCE(Temperature_Degrees, "Alexa.Unit.Temperature.Degrees")
|
||||
ALEXA_RESOURCE(Temperature_Fahrenheit, "Alexa.Unit.Temperature.Fahrenheit")
|
||||
ALEXA_RESOURCE(Temperature_Kelvin, "Alexa.Unit.Temperature.Kelvin")
|
||||
ALEXA_RESOURCE(Volume_CubicFeet, "Alexa.Unit.Volume.CubicFeet")
|
||||
ALEXA_RESOURCE(Volume_CubicMeters, "Alexa.Unit.Volume.CubicMeters")
|
||||
ALEXA_RESOURCE(Volume_Gallons, "Alexa.Unit.Volume.Gallons")
|
||||
ALEXA_RESOURCE(Volume_Liters, "Alexa.Unit.Volume.Liters")
|
||||
ALEXA_RESOURCE(Volume_Pints, "Alexa.Unit.Volume.Pints")
|
||||
ALEXA_RESOURCE(Volume_Quarts, "Alexa.Unit.Volume.Quarts")
|
||||
ALEXA_RESOURCE(Weight_Ounces, "Alexa.Unit.Weight.Ounces")
|
||||
ALEXA_RESOURCE(Weight_Pounds, "Alexa.Unit.Weight.Pounds")
|
||||
}
|
||||
|
||||
#undef ALEXA_RESOURCE
|
||||
|
||||
#endif // ALEXA_RESOURCES_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue